summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-09-20 17:17:32 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-09-20 17:17:32 +0300
commitdc0b8f7ada9df6ea4b40d28766a672581526d9d8 (patch)
tree4b2b7364d1e622b3b02db3fb9d0c898fb9293a87
parent702d559fd5e19e9d0ef462c50c2da97360fc9def (diff)
parent9141bb587892f3bfb59f0aad5eb8ef38e4310199 (diff)
downloadmariadb-git-dc0b8f7ada9df6ea4b40d28766a672581526d9d8.tar.gz
merge of mysql-5.5 into mysql-5.5-wl1054
-rw-r--r--.bzrignore3
-rw-r--r--Makefile.am3
-rw-r--r--README2
-rw-r--r--client/CMakeLists.txt5
-rw-r--r--client/mysql.cc5
-rw-r--r--client/mysqltest.cc2
-rw-r--r--client/sql_string.cc10
-rw-r--r--cmake/abi_check.cmake18
-rw-r--r--cmake/do_abi_check.cmake5
-rw-r--r--config/ac-macros/plugins.m42
-rw-r--r--configure.in4
-rw-r--r--extra/yassl/taocrypt/src/coding.cpp2
-rw-r--r--include/CMakeLists.txt1
-rw-r--r--include/Makefile.am9
-rw-r--r--include/atomic/x86-gcc.h18
-rw-r--r--include/m_ctype.h5
-rw-r--r--include/my_pthread.h20
-rw-r--r--include/myisam.h2
-rw-r--r--include/mysql/plugin.h3
-rw-r--r--include/mysql/plugin_audit.h.pp217
-rw-r--r--include/mysql/plugin_ftparser.h.pp (renamed from include/mysql/plugin.h.pp)112
-rw-r--r--include/mysql/psi/mysql_thread.h8
-rw-r--r--include/mysql/service_thd_wait.h83
-rw-r--r--include/mysql/service_thread_scheduler.h65
-rw-r--r--include/mysql/services.h2
-rw-r--r--include/service_versions.h3
-rw-r--r--include/thr_lock.h2
-rw-r--r--include/violite.h1
-rw-r--r--libmysqld/CMakeLists.txt3
-rw-r--r--libmysqld/Makefile.am8
-rw-r--r--libservices/CMakeLists.txt6
-rw-r--r--libservices/Makefile.am4
-rw-r--r--libservices/my_thread_scheduler_service.c21
-rw-r--r--libservices/thd_wait_service.c19
-rw-r--r--mysql-test/CMakeLists.txt1
-rw-r--r--mysql-test/collections/default.experimental2
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test8
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test1
-rw-r--r--mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test9
-rw-r--r--mysql-test/extra/rpl_tests/rpl_innodb.test2
-rw-r--r--mysql-test/include/check_no_concurrent_insert.inc3
-rw-r--r--mysql-test/include/commit.inc2
-rw-r--r--mysql-test/include/ctype_filesort2.inc16
-rw-r--r--mysql-test/include/ctype_numconv.inc102
-rw-r--r--mysql-test/include/deadlock.inc2
-rw-r--r--mysql-test/include/handler.inc60
-rw-r--r--mysql-test/include/have_thread_concurrency.inc10
-rw-r--r--mysql-test/include/mix1.inc5
-rw-r--r--mysql-test/include/mysqlhotcopy.inc2
-rw-r--r--mysql-test/include/not_blackhole.inc5
-rwxr-xr-xmysql-test/mysql-test-run.pl10
-rw-r--r--mysql-test/r/auto_increment.result2
-rw-r--r--mysql-test/r/case.result2
-rw-r--r--mysql-test/r/commit_1innodb.result2
-rw-r--r--mysql-test/r/create.result404
-rw-r--r--mysql-test/r/ctype_binary.result150
-rw-r--r--mysql-test/r/ctype_cp1251.result150
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result2
-rw-r--r--mysql-test/r/ctype_latin1.result150
-rw-r--r--mysql-test/r/ctype_ucs.result147
-rw-r--r--mysql-test/r/ctype_utf16.result25
-rw-r--r--mysql-test/r/ctype_utf16_def.result9
-rw-r--r--mysql-test/r/ctype_utf32.result61
-rw-r--r--mysql-test/r/ctype_utf8.result2766
-rw-r--r--mysql-test/r/ctype_utf8mb4.result25
-rw-r--r--mysql-test/r/delayed.result77
-rw-r--r--mysql-test/r/delete.result9
-rw-r--r--mysql-test/r/endspace.result18
-rw-r--r--mysql-test/r/events_trans.result19
-rw-r--r--mysql-test/r/flush.result139
-rw-r--r--mysql-test/r/func_gconcat.result20
-rw-r--r--mysql-test/r/func_group.result23
-rw-r--r--mysql-test/r/func_if.result10
-rw-r--r--mysql-test/r/func_misc.result15
-rw-r--r--mysql-test/r/func_str.result25
-rw-r--r--mysql-test/r/func_time.result8
-rw-r--r--mysql-test/r/group_by.result35
-rw-r--r--mysql-test/r/handler_read_last.result60
-rw-r--r--mysql-test/r/information_schema_inno.result12
-rw-r--r--mysql-test/r/insert.result15
-rw-r--r--mysql-test/r/insert_select.result1
-rw-r--r--mysql-test/r/join.result1
-rw-r--r--mysql-test/r/join_outer.result1
-rw-r--r--mysql-test/r/locale.result2
-rw-r--r--mysql-test/r/mdl_sync.result149
-rw-r--r--mysql-test/r/merge.result3
-rw-r--r--mysql-test/r/mysql_client_test.result2
-rw-r--r--mysql-test/r/mysql_not_windows.result5
-rw-r--r--mysql-test/r/mysqlbinlog.result6
-rw-r--r--mysql-test/r/mysqlbinlog_row.result138
-rw-r--r--mysql-test/r/mysqld--help-notwin.result8
-rw-r--r--mysql-test/r/mysqld--help-win.result8
-rw-r--r--mysql-test/r/not_partition.result18
-rw-r--r--mysql-test/r/null_key.result1
-rw-r--r--mysql-test/r/partition.result6
-rw-r--r--mysql-test/r/partition_disabled.result2
-rw-r--r--mysql-test/r/partition_innodb.result98
-rw-r--r--mysql-test/r/partition_not_blackhole.result16
-rw-r--r--mysql-test/r/partition_range.result44
-rw-r--r--mysql-test/r/partition_truncate.result8
-rw-r--r--mysql-test/r/ps_ddl.result4
-rw-r--r--mysql-test/r/query_cache.result16
-rw-r--r--mysql-test/r/range.result53
-rw-r--r--mysql-test/r/rowid_order_innodb.result2
-rw-r--r--mysql-test/r/schema.result6
-rw-r--r--mysql-test/r/select.result1
-rw-r--r--mysql-test/r/single_delete_update.result42
-rw-r--r--mysql-test/r/sp-destruct.result16
-rw-r--r--mysql-test/r/sp-lock.result46
-rw-r--r--mysql-test/r/sp-threads.result2
-rw-r--r--mysql-test/r/subselect3.result1
-rw-r--r--mysql-test/r/subselect4.result21
-rw-r--r--mysql-test/r/trigger.result27
-rw-r--r--mysql-test/r/type_bit_innodb.result2
-rw-r--r--mysql-test/r/union.result2
-rw-r--r--mysql-test/r/update.result10
-rw-r--r--mysql-test/std_data/parts/t1_blackhole.frmbin0 -> 8556 bytes
-rw-r--r--mysql-test/std_data/parts/t1_blackhole.parbin0 -> 24 bytes
-rw-r--r--mysql-test/std_data/server8k-cert.pem172
-rw-r--r--mysql-test/std_data/server8k-key.pem194
-rw-r--r--mysql-test/suite/binlog/r/binlog_database.result8
-rw-r--r--mysql-test/suite/binlog/r/binlog_innodb_row.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_mixed_load_data.result10
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_binlog.result12
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_drop_tbl.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result6
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result53
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_binlog.result15
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_blackhole.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result14
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result29
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_row.result4
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed_simulate.test2
-rw-r--r--mysql-test/suite/binlog/t/binlog_mixed_load_data.test15
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_blackhole.test2
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_row.test2
-rw-r--r--mysql-test/suite/funcs_1/datadict/processlist_val.inc12
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_val_no_prot.result6
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_val_ps.result6
-rw-r--r--mysql-test/suite/funcs_2/charset/charset_master.test2
-rw-r--r--mysql-test/suite/funcs_2/r/innodb_charset.result6
-rw-r--r--mysql-test/suite/funcs_2/r/memory_charset.result6
-rw-r--r--mysql-test/suite/funcs_2/r/myisam_charset.result6
-rw-r--r--mysql-test/suite/funcs_2/t/disabled.def6
-rw-r--r--mysql-test/suite/innodb/r/innodb_gis.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result105
-rw-r--r--mysql-test/suite/innodb/t/innodb-lock.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql.test25
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result2
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result2
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_log_bin.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_multi.result4
-rw-r--r--mysql-test/suite/ndb/t/disabled.def1
-rw-r--r--mysql-test/suite/parts/inc/partition_crash.inc28
-rw-r--r--mysql-test/suite/parts/inc/partition_crash_add.inc33
-rw-r--r--mysql-test/suite/parts/inc/partition_crash_change.inc40
-rw-r--r--mysql-test/suite/parts/inc/partition_crash_drop.inc30
-rw-r--r--mysql-test/suite/parts/inc/partition_fail.inc18
-rw-r--r--mysql-test/suite/parts/inc/partition_fail_add.inc33
-rw-r--r--mysql-test/suite/parts/inc/partition_fail_change.inc40
-rw-r--r--mysql-test/suite/parts/inc/partition_fail_drop.inc30
-rw-r--r--mysql-test/suite/parts/inc/partition_mgm.inc2
-rw-r--r--mysql-test/suite/parts/inc/partition_mgm_crash.inc34
-rw-r--r--mysql-test/suite/parts/r/part_ctype_utf32.result14
-rw-r--r--mysql-test/suite/parts/r/partition_debug_innodb.result3923
-rw-r--r--mysql-test/suite/parts/r/partition_debug_myisam.result4256
-rw-r--r--mysql-test/suite/parts/r/partition_debug_sync_innodb.result34
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc0_archive.result10
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc1_archive.result10
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc2_archive.result10
-rw-r--r--mysql-test/suite/parts/r/partition_special_innodb.result68
-rw-r--r--mysql-test/suite/parts/r/partition_special_myisam.result19
-rw-r--r--mysql-test/suite/parts/t/part_ctype_utf32.test28
-rw-r--r--mysql-test/suite/parts/t/partition_debug_innodb-master.opt1
-rw-r--r--mysql-test/suite/parts/t/partition_debug_innodb.test26
-rw-r--r--mysql-test/suite/parts/t/partition_debug_myisam-master.opt1
-rw-r--r--mysql-test/suite/parts/t/partition_debug_myisam.test17
-rw-r--r--mysql-test/suite/parts/t/partition_debug_sync_innodb.test42
-rw-r--r--mysql-test/suite/parts/t/partition_special_innodb-master.opt2
-rw-r--r--mysql-test/suite/parts/t/partition_special_innodb.test129
-rw-r--r--mysql-test/suite/parts/t/partition_special_myisam.test40
-rw-r--r--mysql-test/suite/perfschema/include/setup_helper.inc8
-rw-r--r--mysql-test/suite/perfschema/include/start_server_common.inc5
-rw-r--r--mysql-test/suite/perfschema/r/aggregate.result14
-rw-r--r--mysql-test/suite/perfschema/r/bad_option_3.result2
-rw-r--r--mysql-test/suite/perfschema/r/bad_option_4.result2
-rw-r--r--mysql-test/suite/perfschema/r/bad_option_5.result2
-rw-r--r--mysql-test/suite/perfschema/r/binlog_mix.result8
-rw-r--r--mysql-test/suite/perfschema/r/binlog_row.result8
-rw-r--r--mysql-test/suite/perfschema/r/binlog_stmt.result8
-rw-r--r--mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result7
-rw-r--r--mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result10
-rw-r--r--mysql-test/suite/perfschema/r/ddl_setup_objects.result7
-rw-r--r--mysql-test/suite/perfschema/r/ddl_threads.result (renamed from mysql-test/suite/perfschema/r/ddl_processlist.result)8
-rw-r--r--mysql-test/suite/perfschema/r/dml_ews_by_event_name.result28
-rw-r--r--mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result28
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_instruments.result2
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_objects.result35
-rw-r--r--mysql-test/suite/perfschema/r/dml_threads.result (renamed from mysql-test/suite/perfschema/r/dml_processlist.result)32
-rw-r--r--mysql-test/suite/perfschema/r/func_file_io.result8
-rw-r--r--mysql-test/suite/perfschema/r/information_schema.result45
-rw-r--r--mysql-test/suite/perfschema/r/misc.result2
-rw-r--r--mysql-test/suite/perfschema/r/no_threads.result4
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade.result95
-rw-r--r--mysql-test/suite/perfschema/r/schema.result45
-rw-r--r--mysql-test/suite/perfschema/r/selects.result6
-rw-r--r--mysql-test/suite/perfschema/r/server_init.result2
-rw-r--r--mysql-test/suite/perfschema/r/short_option_1.result27
-rw-r--r--mysql-test/suite/perfschema/r/short_option_2.result9
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result11
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result11
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result11
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result11
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result11
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result9
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result9
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result11
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result13
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result13
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result11
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result11
-rw-r--r--mysql-test/suite/perfschema/t/aggregate.test22
-rw-r--r--mysql-test/suite/perfschema/t/bad_option_3.test49
-rw-r--r--mysql-test/suite/perfschema/t/bad_option_4.test49
-rw-r--r--mysql-test/suite/perfschema/t/bad_option_5.test52
-rw-r--r--mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test (renamed from mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test)11
-rw-r--r--mysql-test/suite/perfschema/t/ddl_setup_objects.test32
-rw-r--r--mysql-test/suite/perfschema/t/ddl_threads.test (renamed from mysql-test/suite/perfschema/t/ddl_processlist.test)8
-rw-r--r--mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test (renamed from mysql-test/suite/perfschema/t/dml_ews_by_event_name.test)32
-rw-r--r--mysql-test/suite/perfschema/t/dml_setup_objects.test75
-rw-r--r--mysql-test/suite/perfschema/t/dml_threads.test (renamed from mysql-test/suite/perfschema/t/dml_processlist.test)32
-rw-r--r--mysql-test/suite/perfschema/t/func_file_io.test8
-rw-r--r--mysql-test/suite/perfschema/t/misc.test2
-rw-r--r--mysql-test/suite/perfschema/t/no_threads.test4
-rw-r--r--mysql-test/suite/perfschema/t/schema.test5
-rw-r--r--mysql-test/suite/perfschema/t/selects.test6
-rw-r--r--mysql-test/suite/perfschema/t/short_option_1-master.opt1
-rw-r--r--mysql-test/suite/perfschema/t/short_option_1.test35
-rw-r--r--mysql-test/suite/perfschema/t/short_option_2-master.opt1
-rw-r--r--mysql-test/suite/perfschema/t/short_option_2.test29
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_thread_class.test2
-rw-r--r--mysql-test/suite/perfschema/t/start_server_no_thread_inst.test2
-rw-r--r--mysql-test/suite/perfschema/t/thread_cache.test12
-rw-r--r--mysql-test/suite/rpl/r/rpl_conditional_comments.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_if_not_exists.result63
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_if_exists.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_flush_logs.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result388
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result64
-rw-r--r--mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result64
-rw-r--r--mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result40
-rw-r--r--mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result64
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_drop.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result227
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log_innodb.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mixing_engines.result40
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result338
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_log.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result112
-rw-r--r--mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result4
-rw-r--r--mysql-test/suite/rpl/t/disabled.def9
-rw-r--r--mysql-test/suite/rpl/t/rpl_create_if_not_exists.test53
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_flush_logs.test25
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_fatal.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_map.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_mixed_row_innodb.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_savepoint.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_innodb.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_log.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_view_multi.test4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result6
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result6
-rw-r--r--mysql-test/suite/rpl_ndb/t/disabled.def2
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt2
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-slave.opt1
-rw-r--r--mysql-test/suite/sys_vars/r/concurrent_insert_func.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result16
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result13
-rw-r--r--mysql-test/suite/sys_vars/t/concurrent_insert_func.test5
-rw-r--r--mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test4
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test14
-rw-r--r--mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test14
-rw-r--r--mysql-test/suite/sys_vars/t/thread_concurrency_basic.test1
-rw-r--r--mysql-test/t/auto_increment.test2
-rw-r--r--mysql-test/t/case.test3
-rw-r--r--mysql-test/t/create.test279
-rw-r--r--mysql-test/t/ctype_utf16.test1
-rw-r--r--mysql-test/t/ctype_utf16_def-master.opt1
-rw-r--r--mysql-test/t/ctype_utf16_def.test8
-rw-r--r--mysql-test/t/ctype_utf32.test30
-rw-r--r--mysql-test/t/ctype_utf8.test5
-rw-r--r--mysql-test/t/ctype_utf8mb4.test1
-rw-r--r--mysql-test/t/delayed.test166
-rw-r--r--mysql-test/t/delete.test13
-rw-r--r--mysql-test/t/disabled.def7
-rw-r--r--mysql-test/t/endspace.test6
-rw-r--r--mysql-test/t/events_trans.test25
-rw-r--r--mysql-test/t/flush.test191
-rw-r--r--mysql-test/t/func_gconcat.test21
-rw-r--r--mysql-test/t/func_group.test25
-rw-r--r--mysql-test/t/func_if.test12
-rw-r--r--mysql-test/t/func_misc.test14
-rw-r--r--mysql-test/t/func_str.test17
-rw-r--r--mysql-test/t/func_time.test11
-rw-r--r--mysql-test/t/group_by.test14
-rw-r--r--mysql-test/t/handler_read_last.test40
-rw-r--r--mysql-test/t/information_schema.test3
-rw-r--r--mysql-test/t/information_schema_inno.test20
-rw-r--r--mysql-test/t/innodb_mysql_lock.test12
-rw-r--r--mysql-test/t/innodb_mysql_lock2.test8
-rw-r--r--mysql-test/t/insert.test25
-rw-r--r--mysql-test/t/insert_notembedded.test2
-rw-r--r--mysql-test/t/kill.test25
-rw-r--r--mysql-test/t/lock_multi.test74
-rw-r--r--mysql-test/t/lock_sync.test4
-rw-r--r--mysql-test/t/mdl_sync.test576
-rw-r--r--mysql-test/t/merge-big.test4
-rw-r--r--mysql-test/t/merge.test2
-rw-r--r--mysql-test/t/multi_update.test4
-rw-r--r--mysql-test/t/mysql_client_test.test2
-rw-r--r--mysql-test/t/mysql_not_windows.test15
-rw-r--r--mysql-test/t/mysqlbinlog.test2
-rw-r--r--mysql-test/t/not_partition.test1
-rw-r--r--mysql-test/t/partition_innodb.test101
-rw-r--r--mysql-test/t/partition_not_blackhole-master.opt1
-rw-r--r--mysql-test/t/partition_not_blackhole.test26
-rw-r--r--mysql-test/t/partition_range.test41
-rw-r--r--mysql-test/t/partition_truncate.test7
-rw-r--r--mysql-test/t/query_cache.test8
-rw-r--r--mysql-test/t/query_cache_28249.test6
-rw-r--r--mysql-test/t/range.test41
-rw-r--r--mysql-test/t/schema.test16
-rw-r--r--mysql-test/t/sp-destruct.test30
-rw-r--r--mysql-test/t/sp-lock.test106
-rw-r--r--mysql-test/t/sp_notembedded.test2
-rw-r--r--mysql-test/t/sp_sync.test2
-rw-r--r--mysql-test/t/ssl_8k_key-master.opt1
-rw-r--r--mysql-test/t/status.test3
-rw-r--r--mysql-test/t/subselect4.test16
-rw-r--r--mysql-test/t/trigger.test12
-rw-r--r--mysql-test/t/trigger_notembedded.test2
-rw-r--r--mysql-test/t/union.test2
-rw-r--r--mysql-test/t/view.test5
-rw-r--r--mysys/my_getopt.c113
-rw-r--r--mysys/my_init.c2
-rw-r--r--mysys/my_thr_init.c2
-rw-r--r--mysys/stacktrace.c4
-rw-r--r--mysys/thr_lock.c33
-rw-r--r--mysys/thr_rwlock.c18
-rw-r--r--scripts/CMakeLists.txt2
-rwxr-xr-xscripts/make_win_bin_dist1
-rw-r--r--scripts/mysql_system_tables.sql86
-rwxr-xr-x[-rw-r--r--]scripts/mysqlaccess.conf0
-rw-r--r--sql/CMakeLists.txt10
-rw-r--r--sql/Makefile.am13
-rw-r--r--sql/authors.h1
-rw-r--r--sql/datadict.cc69
-rw-r--r--sql/datadict.h2
-rw-r--r--sql/event_db_repository.cc19
-rw-r--r--sql/events.cc5
-rw-r--r--sql/events.h2
-rw-r--r--sql/field.cc23
-rw-r--r--sql/ha_ndbcluster.cc29
-rw-r--r--sql/ha_ndbcluster_binlog.cc49
-rw-r--r--sql/ha_ndbcluster_binlog.h3
-rw-r--r--sql/ha_ndbcluster_cond.cc227
-rw-r--r--sql/ha_partition.cc7
-rw-r--r--sql/handler.cc28
-rw-r--r--sql/handler.h3
-rw-r--r--sql/item.cc12
-rw-r--r--sql/item.h26
-rw-r--r--sql/item_buff.cc6
-rw-r--r--sql/item_cmpfunc.cc55
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/item_strfunc.cc198
-rw-r--r--sql/item_strfunc.h16
-rw-r--r--sql/item_sum.cc45
-rw-r--r--sql/item_sum.h1
-rw-r--r--sql/lock.cc26
-rw-r--r--sql/lock.h42
-rw-r--r--sql/log.cc119
-rw-r--r--sql/log.h4
-rw-r--r--sql/log_event.cc54
-rw-r--r--sql/mdl.cc234
-rw-r--r--sql/mdl.h113
-rw-r--r--sql/mysqld.cc96
-rw-r--r--sql/mysqld.h20
-rw-r--r--sql/opt_range.cc4
-rw-r--r--sql/scheduler.cc167
-rw-r--r--sql/scheduler.h61
-rw-r--r--sql/set_var.cc11
-rw-r--r--sql/sp.cc4
-rw-r--r--sql/sql_admin.cc1001
-rw-r--r--sql/sql_admin.h132
-rw-r--r--sql/sql_alter.cc106
-rw-r--r--sql/sql_alter.h66
-rw-r--r--sql/sql_audit.cc44
-rw-r--r--sql/sql_audit.h1
-rw-r--r--sql/sql_base.cc768
-rw-r--r--sql/sql_base.h126
-rw-r--r--sql/sql_callback.h43
-rw-r--r--sql/sql_class.cc210
-rw-r--r--sql/sql_class.h21
-rw-r--r--sql/sql_connect.cc15
-rw-r--r--sql/sql_connect.h3
-rw-r--r--sql/sql_handler.cc2
-rw-r--r--sql/sql_insert.cc171
-rw-r--r--sql/sql_lex.cc153
-rw-r--r--sql/sql_lex.h221
-rw-r--r--sql/sql_load.cc8
-rw-r--r--sql/sql_parse.cc624
-rw-r--r--sql/sql_parse.h3
-rw-r--r--sql/sql_partition.cc328
-rw-r--r--sql/sql_partition_admin.cc139
-rw-r--r--sql/sql_partition_admin.h236
-rw-r--r--sql/sql_plugin.cc68
-rw-r--r--sql/sql_plugin_services.h16
-rw-r--r--sql/sql_prepare.cc12
-rw-r--r--sql/sql_reload.cc427
-rw-r--r--sql/sql_reload.h26
-rw-r--r--sql/sql_rename.cc21
-rw-r--r--sql/sql_select.cc106
-rw-r--r--sql/sql_select.h2
-rw-r--r--sql/sql_servers.cc4
-rw-r--r--sql/sql_show.cc58
-rw-r--r--sql/sql_string.cc10
-rw-r--r--sql/sql_table.cc1428
-rw-r--r--sql/sql_table.h35
-rw-r--r--sql/sql_test.cc4
-rw-r--r--sql/sql_trigger.cc19
-rw-r--r--sql/sql_truncate.cc54
-rw-r--r--sql/sql_truncate.h26
-rw-r--r--sql/sql_update.cc70
-rw-r--r--sql/sql_view.cc22
-rw-r--r--sql/sql_yacc.yy142
-rw-r--r--sql/sys_vars.cc24
-rw-r--r--sql/sys_vars.h14
-rw-r--r--sql/table.cc311
-rw-r--r--sql/table.h82
-rw-r--r--storage/innobase/btr/btr0cur.c176
-rw-r--r--storage/innobase/btr/btr0sea.c2
-rw-r--r--storage/innobase/buf/buf0flu.c39
-rw-r--r--storage/innobase/buf/buf0rea.c4
-rw-r--r--storage/innobase/dict/dict0load.c26
-rw-r--r--storage/innobase/ha/ha0ha.c2
-rw-r--r--storage/innobase/handler/ha_innodb.cc16
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.c335
-rw-r--r--storage/innobase/include/btr0cur.h5
-rw-r--r--storage/innobase/include/btr0sea.h4
-rw-r--r--storage/innobase/include/dict0load.h16
-rw-r--r--storage/innobase/include/ha0ha.h2
-rw-r--r--storage/innobase/include/ha_prototypes.h8
-rw-r--r--storage/innobase/include/ibuf0ibuf.ic11
-rw-r--r--storage/innobase/include/univ.i6
-rw-r--r--storage/innobase/plug.in2
-rw-r--r--storage/innobase/srv/srv0srv.c9
-rw-r--r--storage/myisam/ft_stopwords.c16
-rw-r--r--storage/myisam/mi_key.c11
-rw-r--r--storage/myisam/mi_static.c4
-rw-r--r--storage/perfschema/CMakeLists.txt8
-rw-r--r--storage/perfschema/Makefile.am12
-rw-r--r--storage/perfschema/ha_perfschema.cc12
-rw-r--r--storage/perfschema/pfs.cc109
-rw-r--r--storage/perfschema/pfs_engine_table.cc9
-rw-r--r--storage/perfschema/pfs_server.h6
-rw-r--r--storage/perfschema/pfs_stat.h16
-rw-r--r--storage/perfschema/table_events_waits_summary.cc138
-rw-r--r--storage/perfschema/table_events_waits_summary.h52
-rw-r--r--storage/perfschema/table_ews_global_by_event_name.cc166
-rw-r--r--storage/perfschema/table_ews_global_by_event_name.h88
-rw-r--r--storage/perfschema/table_setup_objects.cc281
-rw-r--r--storage/perfschema/table_setup_objects.h125
-rw-r--r--storage/perfschema/table_threads.cc (renamed from storage/perfschema/table_processlist.cc)38
-rw-r--r--storage/perfschema/table_threads.h (renamed from storage/perfschema/table_processlist.h)22
-rw-r--r--strings/ctype-ucs2.c12
-rw-r--r--strings/ctype-utf8.c76
-rw-r--r--support-files/my-innodb-heavy-4G.cnf.sh20
-rw-r--r--support-files/mysql.spec.sh108
-rw-r--r--tests/mysql_client_test.c49
-rw-r--r--vio/vio.c10
-rw-r--r--vio/vio_priv.h3
-rw-r--r--vio/viosocket.c4
-rw-r--r--vio/viossl.c5
503 files changed, 25241 insertions, 6887 deletions
diff --git a/.bzrignore b/.bzrignore
index a17b1dec6cb..4c437cdd36c 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -997,6 +997,7 @@ libmysqld/.deps/sql_cursor.Po
libmysqld/.deps/sql_db.Po
libmysqld/.deps/sql_delete.Po
libmysqld/.deps/sql_truncate.Po
+libmysqld/.deps/sql_reload.Po
libmysqld/.deps/datadict.Po
libmysqld/.deps/sql_derived.Po
libmysqld/.deps/sql_do.Po
@@ -1175,6 +1176,7 @@ libmysqld/sql_cursor.h
libmysqld/sql_db.cc
libmysqld/sql_delete.cc
libmysqld/sql_truncate.cc
+libmysqld/sql_reload.cc
libmysqld/datadict.cc
libmysqld/sql_derived.cc
libmysqld/sql_do.cc
@@ -2067,6 +2069,7 @@ sql/.deps/sql_cursor.Po
sql/.deps/sql_db.Po
sql/.deps/sql_delete.Po
sql/.deps/sql_truncate.Po
+sql/.deps/sql_reload.Po
sql/.deps/datadict.Po
sql/.deps/sql_derived.Po
sql/.deps/sql_do.Po
diff --git a/Makefile.am b/Makefile.am
index ef815238998..c4b4f6d6f92 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -264,7 +264,8 @@ test-full-qa:
# Headers which need to be checked for abi/api compatibility.
#
-API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin.h \
+API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin_audit.h \
+ $(top_srcdir)/include/mysql/plugin_ftparser.h \
$(top_srcdir)/include/mysql.h \
$(top_srcdir)/include/mysql/psi/psi_abi_v1.h \
$(top_srcdir)/include/mysql/psi/psi_abi_v2.h \
diff --git a/README b/README
index e1a4a88c6f5..7fb52404b17 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-This is a release of MySQL, a dual-license SQL database server.
+This is a release of MySQL, a dual-license SQL DBMS.
MySQL is brought to you by the MySQL team at Oracle Corporation.
************************************************************
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index e36659d74bf..80c5bbd1c9f 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -64,7 +64,10 @@ MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient)
-ADD_EXECUTABLE(echo echo.c)
+# "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/".
+IF(WIN32)
+ MYSQL_ADD_EXECUTABLE(echo echo.c)
+ENDIF(WIN32)
SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap
PROPERTIES HAS_CXX TRUE)
diff --git a/client/mysql.cc b/client/mysql.cc
index a985c135361..14473ba4b51 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -93,6 +93,7 @@ extern "C" {
#else
#include <readline/readline.h>
#define HAVE_READLINE
+#define USE_POPEN
#endif
//int vidattr(long unsigned int attrs); // Was missing in sun curses
}
@@ -108,10 +109,6 @@ extern "C" {
#define cmp_database(cs,A,B) strcmp((A),(B))
#endif
-#if !defined(__WIN__) && !defined(THREAD)
-#define USE_POPEN
-#endif
-
#include "completion_hash.h"
#define PROMPT_CHAR '\\'
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 8416432ffe1..ddc8105abec 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -6244,8 +6244,10 @@ get_one_option(int optid, const struct my_option *opt, char *argument)
print_version();
exit(0);
case OPT_MYSQL_PROTOCOL:
+#ifndef EMBEDDED_LIBRARY
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
+#endif
break;
case '?':
usage();
diff --git a/client/sql_string.cc b/client/sql_string.cc
index 6b749409a64..dec6ac94eb2 100644
--- a/client/sql_string.cc
+++ b/client/sql_string.cc
@@ -31,9 +31,12 @@
** String functions
*****************************************************************************/
-bool String::real_alloc(uint32 arg_length)
+bool String::real_alloc(uint32 length)
{
- arg_length=ALIGN_SIZE(arg_length+1);
+ uint32 arg_length= ALIGN_SIZE(length + 1);
+ DBUG_ASSERT(arg_length > length);
+ if (arg_length <= length)
+ return TRUE; /* Overflow */
str_length=0;
if (Alloced_length < arg_length)
{
@@ -56,6 +59,9 @@ bool String::real_alloc(uint32 arg_length)
bool String::realloc(uint32 alloc_length)
{
uint32 len=ALIGN_SIZE(alloc_length+1);
+ DBUG_ASSERT(len > alloc_length);
+ if (len <= alloc_length)
+ return TRUE; /* Overflow */
if (Alloced_length < len)
{
char *new_ptr;
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index 7911b7848a8..b9ff9f7af73 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -15,7 +15,8 @@
#
# Headers which need to be checked for abi/api compatibility are in
-# API_PREPROCESSOR_HEADER.
+# API_PREPROCESSOR_HEADER. plugin.h is tested implicitly via
+# plugin_audit.h and plugin_ftparser.h.
#
# We use gcc specific preprocessing command and sed/diff, so it will
# only be run on Unix and only if gcc is used.
@@ -27,7 +28,8 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(COMPILER ${CMAKE_C_COMPILER})
ENDIF()
SET(API_PREPROCESSOR_HEADER
- ${CMAKE_SOURCE_DIR}/include/mysql/plugin.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h
+ ${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h
${CMAKE_SOURCE_DIR}/include/mysql.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h
@@ -38,18 +40,18 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
-DCOMPILER=${COMPILER}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DBINARY_DIR=${CMAKE_BINARY_DIR}
- "-DDMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
+ "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
VERBATIM
)
ADD_CUSTOM_TARGET(abi_check_all
COMMAND ${CMAKE_COMMAND}
- -DCMAKE_C_COMPILER=${COMPILER}
- -DCMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}
- -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
- "-DMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
- -P ${CMAKE_SOURCE_DIR}/cmake/scripts/do_abi_check.cmake
+ -DCOMPILER=${COMPILER}
+ -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
+ -DBINARY_DIR=${CMAKE_BINARY_DIR}
+ "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
+ -P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
VERBATIM
)
ENDIF()
diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake
index aa7784e7372..78006bd018c 100644
--- a/cmake/do_abi_check.cmake
+++ b/cmake/do_abi_check.cmake
@@ -56,8 +56,9 @@ FOREACH(file ${ABI_HEADERS})
SET(tmpfile ${file}.pp.tmp)
EXECUTE_PROCESS(
COMMAND ${COMPILER}
- -E -nostdinc -dI -I${SOURCE_DIR}/include -I${BINARY_DIR}/include
- -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql ${file}
+ -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include
+ -I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql
+ ${file}
ERROR_QUIET OUTPUT_FILE ${tmpfile})
EXECUTE_PROCESS(
COMMAND sed -e
diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4
index 9fcfc031281..2aed1267fe6 100644
--- a/config/ac-macros/plugins.m4
+++ b/config/ac-macros/plugins.m4
@@ -782,7 +782,7 @@ dnl Emits shell script for checking configure arguments
dnl Arguments to this macro is default value for selected plugins
AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARGS],[
- __MYSQL_CHECK_PLUGIN_ARGS(m4_default([$1], [none]))
+ __MYSQL_CHECK_PLUGIN_ARGS(m4_default([$1], [default]))
])
AC_DEFUN([__MYSQL_CHECK_PLUGIN_ARGS],[
diff --git a/configure.in b/configure.in
index 7f342f1ceda..80b88c76831 100644
--- a/configure.in
+++ b/configure.in
@@ -27,7 +27,7 @@ dnl
dnl When changing the major version number please also check the switch
dnl statement in mysqlbinlog::check_master_version(). You may also need
dnl to update version.c in ndb.
-AC_INIT([MySQL Server], [5.5.6-m3], [], [mysql])
+AC_INIT([MySQL Server], [5.5.7-rc], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM
@@ -2605,7 +2605,7 @@ MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support],
dnl -- ndbcluster requires partition to be enabled
-MYSQL_CONFIGURE_PLUGINS([none])
+MYSQL_CONFIGURE_PLUGINS([default])
# Only build client code?
AC_ARG_WITH(server,
diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp
index 7a9d50aaac9..7fc681e1a05 100644
--- a/extra/yassl/taocrypt/src/coding.cpp
+++ b/extra/yassl/taocrypt/src/coding.cpp
@@ -185,7 +185,7 @@ void Base64Decoder::Decode()
{
word32 bytes = coded_.size();
word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
- plainSz = (plainSz * 3 + 3) / 4;
+ plainSz = ((plainSz * 3) / 4) + 3;
decoded_.New(plainSz);
word32 i = 0;
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index aee7561d242..5334fc0f5ae 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -54,6 +54,7 @@ SET(HEADERS
keycache.h
m_ctype.h
my_attribute.h
+ my_compiler.h
${HEADERS_GEN_CONFIGURE}
)
diff --git a/include/Makefile.am b/include/Makefile.am
index 9dbd818d592..415e2ef8c8c 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -28,12 +28,15 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
mysql/client_plugin.h mysql/plugin_auth_common.h \
mysql/services.h \
mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
+ mysql/service_thread_scheduler.h \
+ mysql/service_thd_wait.h \
my_pthread.h my_no_pthread.h \
decimal.h errmsg.h my_global.h my_net.h \
my_getopt.h sslopt-longopts.h my_dir.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
- m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \
- $(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h
+ m_ctype.h my_attribute.h my_compiler.h \
+ $(HEADERS_GEN_CONFIGURE) $(HEADERS_GEN_MAKE) \
+ probes_mysql.h probes_mysql_nodtrace.h
noinst_HEADERS = lf.h my_bit.h \
heap.h my_bitmap.h my_uctype.h password.h \
@@ -47,7 +50,7 @@ noinst_HEADERS = lf.h my_bit.h \
my_user.h my_atomic.h atomic/nolock.h \
atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
- atomic/solaris.h mysql/innodb_priv.h my_compiler.h
+ atomic/solaris.h mysql/innodb_priv.h
pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \
mysql/psi/mysql_file.h
diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h
index 8baa84e110e..90602ef900c 100644
--- a/include/atomic/x86-gcc.h
+++ b/include/atomic/x86-gcc.h
@@ -111,9 +111,9 @@
On some platforms (e.g. Mac OS X and Solaris) the ebx register
is held as a pointer to the global offset table. Thus we're not
allowed to use the b-register on those platforms when compiling
- PIC code, to avoid this we push ebx and pop ebx and add a movl
- instruction to avoid having ebx in the interface of the assembler
- instruction.
+ PIC code, to avoid this we push ebx and pop ebx. The new value
+ is copied directly from memory to avoid problems with a implicit
+ manipulation of the stack pointer by the push.
cmpxchg8b works on both 32-bit platforms and 64-bit platforms but
the code here is only used on 32-bit platforms, on 64-bit
@@ -121,11 +121,13 @@
fine.
*/
#define make_atomic_cas_body64 \
- int32 ebx=(set & 0xFFFFFFFF), ecx=(set >> 32); \
- asm volatile ("push %%ebx; movl %3, %%ebx;" \
- LOCK_prefix "; cmpxchg8b %0; setz %2; pop %%ebx" \
- : "=m" (*a), "+A" (*cmp), "=c" (ret) \
- : "m" (ebx), "c" (ecx), "m" (*a) \
+ asm volatile ("push %%ebx;" \
+ "movl (%%ecx), %%ebx;" \
+ "movl 4(%%ecx), %%ecx;" \
+ LOCK_prefix "; cmpxchg8b %0;" \
+ "setz %2; pop %%ebx" \
+ : "=m" (*a), "+A" (*cmp), "=c" (ret) \
+ : "c" (&set), "m" (*a) \
: "memory", "esp")
#endif
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 06cbfd779c8..42e8f88cc0e 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -539,6 +539,11 @@ size_t my_strnxfrm_unicode(CHARSET_INFO *,
uchar *dst, size_t dstlen,
const uchar *src, size_t srclen);
+size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *,
+ uchar *dst, size_t dstlen,
+ const uchar *src, size_t srclen);
+size_t my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *, size_t);
+
int my_wildcmp_unicode(CHARSET_INFO *cs,
const char *str, const char *str_end,
const char *wildstr, const char *wildend,
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 0c89a2ed384..5cf181596ad 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -601,6 +601,8 @@ int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp);
#define rw_trywrlock(A) my_rw_trywrlock((A))
#define rw_unlock(A) my_rw_unlock((A))
#define rwlock_destroy(A) my_rw_destroy((A))
+#define rw_lock_assert_write_owner(A) my_rw_lock_assert_write_owner((A))
+#define rw_lock_assert_not_write_owner(A) my_rw_lock_assert_not_write_owner((A))
#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */
@@ -624,6 +626,8 @@ extern int rw_pr_init(rw_pr_lock_t *);
#define rw_pr_trywrlock(A) pthread_rwlock_trywrlock(A)
#define rw_pr_unlock(A) pthread_rwlock_unlock(A)
#define rw_pr_destroy(A) pthread_rwlock_destroy(A)
+#define rw_pr_lock_assert_write_owner(A)
+#define rw_pr_lock_assert_not_write_owner(A)
#else
/* Otherwise we have to use our own implementation of read/write locks. */
#define NEED_MY_RW_LOCK 1
@@ -636,6 +640,8 @@ extern int rw_pr_init(struct st_my_rw_lock_t *);
#define rw_pr_trywrlock(A) my_rw_trywrlock((A))
#define rw_pr_unlock(A) my_rw_unlock((A))
#define rw_pr_destroy(A) my_rw_destroy((A))
+#define rw_pr_lock_assert_write_owner(A) my_rw_lock_assert_write_owner((A))
+#define rw_pr_lock_assert_not_write_owner(A) my_rw_lock_assert_not_write_owner((A))
#endif /* defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) */
@@ -651,6 +657,9 @@ typedef struct st_my_rw_lock_t {
int state; /* -1:writer,0:free,>0:readers */
int waiters; /* number of waiting writers */
my_bool prefer_readers;
+#ifdef SAFE_MUTEX
+ pthread_t write_thread;
+#endif
} my_rw_lock_t;
extern int my_rw_init(my_rw_lock_t *, my_bool *);
@@ -660,6 +669,17 @@ extern int my_rw_wrlock(my_rw_lock_t *);
extern int my_rw_unlock(my_rw_lock_t *);
extern int my_rw_tryrdlock(my_rw_lock_t *);
extern int my_rw_trywrlock(my_rw_lock_t *);
+#ifdef SAFE_MUTEX
+#define my_rw_lock_assert_write_owner(A) \
+ DBUG_ASSERT((A)->state == -1 && pthread_equal(pthread_self(), \
+ (A)->write_thread))
+#define my_rw_lock_assert_not_write_owner(A) \
+ DBUG_ASSERT((A)->state >= 0 || ! pthread_equal(pthread_self(), \
+ (A)->write_thread))
+#else
+#define my_rw_lock_assert_write_owner(A)
+#define my_rw_lock_assert_not_write_owner(A)
+#endif
#endif /* NEED_MY_RW_LOCK */
diff --git a/include/myisam.h b/include/myisam.h
index 3efc65a900a..c4076ead403 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -249,7 +249,7 @@ typedef struct st_columndef /* column information */
extern char * myisam_log_filename; /* Name of logfile */
extern ulong myisam_block_size;
-extern uint myisam_concurrent_insert;
+extern ulong myisam_concurrent_insert;
extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user;
extern my_off_t myisam_max_temp_length;
extern ulong myisam_data_pointer_size;
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index 01ca76983a6..7ec68ff5040 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -71,7 +71,7 @@ typedef struct st_mysql_xid MYSQL_XID;
Plugin API. Common for all plugin types.
*/
-#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0101
+#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0102
/*
The allowable types of plugins
@@ -529,6 +529,7 @@ long long thd_test_options(const MYSQL_THD thd, long long test_options);
int thd_sql_command(const MYSQL_THD thd);
const char *thd_proc_info(MYSQL_THD thd, const char *info);
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
+void thd_storage_lock_wait(MYSQL_THD thd, long long value);
int thd_tx_isolation(const MYSQL_THD thd);
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
unsigned int max_query_len);
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
new file mode 100644
index 00000000000..b48cbca2e87
--- /dev/null
+++ b/include/mysql/plugin_audit.h.pp
@@ -0,0 +1,217 @@
+#include "plugin.h"
+#include <mysql/services.h>
+#include <mysql/service_my_snprintf.h>
+extern struct my_snprintf_service_st {
+ size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+ size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+#include <mysql/service_thd_alloc.h>
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+extern struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(void*, unsigned int);
+ void *(*thd_calloc_func)(void*, unsigned int);
+ char *(*thd_strdup_func)(void*, const char *);
+ char *(*thd_strmake_func)(void*, const char *, unsigned int);
+ void *(*thd_memdup_func)(void*, const void*, unsigned int);
+ MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
+ const char *, unsigned int, int);
+} *thd_alloc_service;
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+#include <mysql/service_thd_wait.h>
+typedef enum _thd_wait_type_e {
+ THD_WAIT_MUTEX= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_TABLE_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(void*, thd_wait_type);
+ void (*thd_wait_end_func)(void*);
+} *thd_wait_service;
+void thd_wait_begin(void* thd, thd_wait_type wait_type);
+void thd_wait_end(void* thd);
+#include <mysql/service_thread_scheduler.h>
+struct scheduler_functions;
+extern struct my_thread_scheduler_service {
+ int (*set)(struct scheduler_functions *scheduler);
+ int (*reset)();
+} *my_thread_scheduler_service;
+int my_thread_scheduler_set(struct scheduler_functions *scheduler);
+int my_thread_scheduler_reset();
+struct st_mysql_xid {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[128];
+};
+typedef struct st_mysql_xid MYSQL_XID;
+enum enum_mysql_show_type
+{
+ SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
+ SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
+ SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
+ SHOW_always_last
+};
+struct st_mysql_show_var {
+ const char *name;
+ char *value;
+ enum enum_mysql_show_type type;
+};
+typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *);
+struct st_mysql_sys_var;
+struct st_mysql_value;
+typedef int (*mysql_var_check_func)(void* thd,
+ struct st_mysql_sys_var *var,
+ void *save, struct st_mysql_value *value);
+typedef void (*mysql_var_update_func)(void* thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
+struct st_mysql_plugin
+{
+ int type;
+ void *info;
+ const char *name;
+ const char *author;
+ const char *descr;
+ int license;
+ int (*init)(void *);
+ int (*deinit)(void *);
+ unsigned int version;
+ struct st_mysql_show_var *status_vars;
+ struct st_mysql_sys_var **system_vars;
+ void * __reserved1;
+};
+#include "plugin_ftparser.h"
+#include "plugin.h"
+enum enum_ftparser_mode
+{
+ MYSQL_FTPARSER_SIMPLE_MODE= 0,
+ MYSQL_FTPARSER_WITH_STOPWORDS= 1,
+ MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
+};
+enum enum_ft_token_type
+{
+ FT_TOKEN_EOF= 0,
+ FT_TOKEN_WORD= 1,
+ FT_TOKEN_LEFT_PAREN= 2,
+ FT_TOKEN_RIGHT_PAREN= 3,
+ FT_TOKEN_STOPWORD= 4
+};
+typedef struct st_mysql_ftparser_boolean_info
+{
+ enum enum_ft_token_type type;
+ int yesno;
+ int weight_adjust;
+ char wasign;
+ char trunc;
+ char prev;
+ char *quot;
+} MYSQL_FTPARSER_BOOLEAN_INFO;
+typedef struct st_mysql_ftparser_param
+{
+ int (*mysql_parse)(struct st_mysql_ftparser_param *,
+ char *doc, int doc_len);
+ int (*mysql_add_word)(struct st_mysql_ftparser_param *,
+ char *word, int word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
+ void *ftparser_state;
+ void *mysql_ftparam;
+ struct charset_info_st *cs;
+ char *doc;
+ int length;
+ int flags;
+ enum enum_ftparser_mode mode;
+} MYSQL_FTPARSER_PARAM;
+struct st_mysql_ftparser
+{
+ int interface_version;
+ int (*parse)(MYSQL_FTPARSER_PARAM *param);
+ int (*init)(MYSQL_FTPARSER_PARAM *param);
+ int (*deinit)(MYSQL_FTPARSER_PARAM *param);
+};
+struct st_mysql_daemon
+{
+ int interface_version;
+};
+struct st_mysql_information_schema
+{
+ int interface_version;
+};
+struct st_mysql_storage_engine
+{
+ int interface_version;
+};
+struct handlerton;
+ struct Mysql_replication {
+ int interface_version;
+ };
+struct st_mysql_value
+{
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+ int (*is_unsigned)(struct st_mysql_value *);
+};
+int thd_in_lock_tables(const void* thd);
+int thd_tablespace_op(const void* thd);
+long long thd_test_options(const void* thd, long long test_options);
+int thd_sql_command(const void* thd);
+const char *thd_proc_info(void* thd, const char *info);
+void **thd_ha_data(const void* thd, const struct handlerton *hton);
+void thd_storage_lock_wait(void* thd, long long value);
+int thd_tx_isolation(const void* thd);
+char *thd_security_context(void* thd, char *buffer, unsigned int length,
+ unsigned int max_query_len);
+void thd_inc_row_count(void* thd);
+int mysql_tmpfile(const char *prefix);
+int thd_killed(const void* thd);
+unsigned long thd_get_thread_id(const void* thd);
+void thd_get_xid(const void* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(void* thd,
+ const char *key, unsigned int key_length,
+ int using_trx);
+void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
+void thd_set_ha_data(void* thd, const struct handlerton *hton,
+ const void *ha_data);
+struct mysql_event
+{
+ unsigned int event_class;
+};
+struct mysql_event_general
+{
+ unsigned int event_class;
+ unsigned int event_subclass;
+ int general_error_code;
+ unsigned long general_thread_id;
+ const char *general_user;
+ unsigned int general_user_length;
+ const char *general_command;
+ unsigned int general_command_length;
+ const char *general_query;
+ unsigned int general_query_length;
+ struct charset_info_st *general_charset;
+ unsigned long long general_time;
+ unsigned long long general_rows;
+};
+struct st_mysql_audit
+{
+ int interface_version;
+ void (*release_thd)(void*);
+ void (*event_notify)(void*, const struct mysql_event *);
+ unsigned long class_mask[1];
+};
diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin_ftparser.h.pp
index ce9902ee418..2c2c1adbf88 100644
--- a/include/mysql/plugin.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -1,3 +1,4 @@
+#include "plugin.h"
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
extern struct my_snprintf_service_st {
@@ -30,6 +31,27 @@ void *thd_memdup(void* thd, const void* str, unsigned int size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
+#include <mysql/service_thd_wait.h>
+typedef enum _thd_wait_type_e {
+ THD_WAIT_MUTEX= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_TABLE_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4
+} thd_wait_type;
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(void*, thd_wait_type);
+ void (*thd_wait_end_func)(void*);
+} *thd_wait_service;
+void thd_wait_begin(void* thd, thd_wait_type wait_type);
+void thd_wait_end(void* thd);
+#include <mysql/service_thread_scheduler.h>
+struct scheduler_functions;
+extern struct my_thread_scheduler_service {
+ int (*set)(struct scheduler_functions *scheduler);
+ int (*reset)();
+} *my_thread_scheduler_service;
+int my_thread_scheduler_set(struct scheduler_functions *scheduler);
+int my_thread_scheduler_reset();
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -74,7 +96,51 @@ struct st_mysql_plugin
void * __reserved1;
};
#include "plugin_ftparser.h"
-#include "plugin.h"
+struct st_mysql_daemon
+{
+ int interface_version;
+};
+struct st_mysql_information_schema
+{
+ int interface_version;
+};
+struct st_mysql_storage_engine
+{
+ int interface_version;
+};
+struct handlerton;
+ struct Mysql_replication {
+ int interface_version;
+ };
+struct st_mysql_value
+{
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+ int (*is_unsigned)(struct st_mysql_value *);
+};
+int thd_in_lock_tables(const void* thd);
+int thd_tablespace_op(const void* thd);
+long long thd_test_options(const void* thd, long long test_options);
+int thd_sql_command(const void* thd);
+const char *thd_proc_info(void* thd, const char *info);
+void **thd_ha_data(const void* thd, const struct handlerton *hton);
+void thd_storage_lock_wait(void* thd, long long value);
+int thd_tx_isolation(const void* thd);
+char *thd_security_context(void* thd, char *buffer, unsigned int length,
+ unsigned int max_query_len);
+void thd_inc_row_count(void* thd);
+int mysql_tmpfile(const char *prefix);
+int thd_killed(const void* thd);
+unsigned long thd_get_thread_id(const void* thd);
+void thd_get_xid(const void* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(void* thd,
+ const char *key, unsigned int key_length,
+ int using_trx);
+void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
+void thd_set_ha_data(void* thd, const struct handlerton *hton,
+ const void *ha_data);
enum enum_ftparser_mode
{
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -121,47 +187,3 @@ struct st_mysql_ftparser
int (*init)(MYSQL_FTPARSER_PARAM *param);
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
-struct st_mysql_daemon
-{
- int interface_version;
-};
-struct st_mysql_information_schema
-{
- int interface_version;
-};
-struct st_mysql_storage_engine
-{
- int interface_version;
-};
-struct handlerton;
- struct Mysql_replication {
- int interface_version;
- };
-struct st_mysql_value
-{
- int (*value_type)(struct st_mysql_value *);
- const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
- int (*val_real)(struct st_mysql_value *, double *realbuf);
- int (*val_int)(struct st_mysql_value *, long long *intbuf);
- int (*is_unsigned)(struct st_mysql_value *);
-};
-int thd_in_lock_tables(const void* thd);
-int thd_tablespace_op(const void* thd);
-long long thd_test_options(const void* thd, long long test_options);
-int thd_sql_command(const void* thd);
-const char *thd_proc_info(void* thd, const char *info);
-void **thd_ha_data(const void* thd, const struct handlerton *hton);
-int thd_tx_isolation(const void* thd);
-char *thd_security_context(void* thd, char *buffer, unsigned int length,
- unsigned int max_query_len);
-void thd_inc_row_count(void* thd);
-int mysql_tmpfile(const char *prefix);
-int thd_killed(const void* thd);
-unsigned long thd_get_thread_id(const void* thd);
-void thd_get_xid(const void* thd, MYSQL_XID *xid);
-void mysql_query_cache_invalidate4(void* thd,
- const char *key, unsigned int key_length,
- int using_trx);
-void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
-void thd_set_ha_data(void* thd, const struct handlerton *hton,
- const void *ha_data);
diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h
index d133f2655fb..60b4f5d6ef4 100644
--- a/include/mysql/psi/mysql_thread.h
+++ b/include/mysql/psi/mysql_thread.h
@@ -215,6 +215,14 @@ typedef struct st_mysql_cond mysql_cond_t;
#define mysql_mutex_assert_not_owner(M) \
safe_mutex_assert_not_owner(&(M)->m_mutex)
+/** Wrappers for instrumented prlock objects. */
+
+#define mysql_prlock_assert_write_owner(M) \
+ rw_pr_lock_assert_write_owner(&(M)->m_prlock)
+
+#define mysql_prlock_assert_not_write_owner(M) \
+ rw_pr_lock_assert_not_write_owner(&(M)->m_prlock)
+
/**
@def mysql_mutex_init(K, M, A)
Instrumented mutex_init.
diff --git a/include/mysql/service_thd_wait.h b/include/mysql/service_thd_wait.h
new file mode 100644
index 00000000000..2a8f5e610a3
--- /dev/null
+++ b/include/mysql/service_thd_wait.h
@@ -0,0 +1,83 @@
+/* Copyright (C) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef MYSQL_SERVICE_THD_WAIT_INCLUDED
+#define MYSQL_SERVICE_THD_WAIT_INCLUDED
+
+/**
+ @file include/mysql/service_thd_wait.h
+ This service provides functions for plugins and storage engines to report
+ when they are going to sleep/stall.
+
+ SYNOPSIS
+ thd_wait_begin() - call just before a wait begins
+ thd Thread object
+ Use NULL if the thd is NOT known.
+ wait_type Type of wait
+ 1 -- short wait (e.g. for mutex)
+ 2 -- medium wait (e.g. for disk io)
+ 3 -- large wait (e.g. for locked row/table)
+ NOTES
+ This is used by the threadpool to have better knowledge of which
+ threads that currently are actively running on CPUs. When a thread
+ reports that it's going to sleep/stall, the threadpool scheduler is
+ free to start another thread in the pool most likely. The expected wait
+ time is simply an indication of how long the wait is expected to
+ become, the real wait time could be very different.
+
+ thd_wait_end() called immediately after the wait is complete
+
+ thd_wait_end() MUST be called if thd_wait_begin() was called.
+
+ Using thd_wait_...() service is optional but recommended. Using it will
+ improve performance as the thread pool will be more active at managing the
+ thread workload.
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _thd_wait_type_e {
+ THD_WAIT_MUTEX= 1,
+ THD_WAIT_DISKIO= 2,
+ THD_WAIT_ROW_TABLE_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4
+} thd_wait_type;
+
+extern struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(MYSQL_THD, thd_wait_type);
+ void (*thd_wait_end_func)(MYSQL_THD);
+} *thd_wait_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define thd_wait_begin(_THD, _WAIT_TYPE) \
+ thd_wait_service->thd_wait_begin_func(_THD, _WAIT_TYPE)
+#define thd_wait_end(_THD) thd_wait_service->thd_wait_end_func(_THD)
+
+#else
+
+void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type);
+void thd_wait_end(MYSQL_THD thd);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/mysql/service_thread_scheduler.h b/include/mysql/service_thread_scheduler.h
new file mode 100644
index 00000000000..a4396b721bd
--- /dev/null
+++ b/include/mysql/service_thread_scheduler.h
@@ -0,0 +1,65 @@
+/*
+ Copyright (C) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef SERVICE_THREAD_SCHEDULER_INCLUDED
+#define SERVICE_THREAD_SCHEDULER_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct scheduler_functions;
+
+extern struct my_thread_scheduler_service {
+ int (*set)(struct scheduler_functions *scheduler);
+ int (*reset)();
+} *my_thread_scheduler_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_thread_scheduler_set(F) my_thread_scheduler_service->set((F))
+#define my_thread_scheduler_reset() my_thread_scheduler_service->reset()
+
+#else
+
+/**
+ Set the thread scheduler to use for the server.
+
+ @param scheduler Pointer to scheduler callbacks to use.
+ @retval 0 Scheduler installed correctly.
+ @retval 1 Invalid value (NULL) used for scheduler.
+*/
+int my_thread_scheduler_set(struct scheduler_functions *scheduler);
+
+/**
+ Restore the previous thread scheduler.
+
+ @note If no thread scheduler was installed previously with
+ thd_set_thread_scheduler, this function will report an error.
+
+ @retval 0 Scheduler installed correctly.
+ @retval 1 No scheduler installed.
+*/
+int my_thread_scheduler_reset();
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */
diff --git a/include/mysql/services.h b/include/mysql/services.h
index 19003e66b96..6c67a582fb8 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -20,6 +20,8 @@ extern "C" {
#include <mysql/service_my_snprintf.h>
#include <mysql/service_thd_alloc.h>
+#include <mysql/service_thd_wait.h>
+#include <mysql/service_thread_scheduler.h>
#ifdef __cplusplus
}
diff --git a/include/service_versions.h b/include/service_versions.h
index 114957cdd86..4fd886c8a83 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -21,4 +21,5 @@
#define VERSION_my_snprintf 0x0100
#define VERSION_thd_alloc 0x0100
-
+#define VERSION_thd_wait 0x0100
+#define VERSION_my_thread_scheduler 0x0100
diff --git a/include/thr_lock.h b/include/thr_lock.h
index 5626c067e5e..91473737be3 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -155,6 +155,8 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *data,
enum thr_lock_type new_lock_type);
my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data,
ulong lock_wait_timeout);
+void thr_set_lock_wait_callback(void (*before_wait)(void),
+ void (*after_wait)(void));
#ifdef __cplusplus
}
#endif
diff --git a/include/violite.h b/include/violite.h
index 05ceaa272c1..f4083216894 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -217,6 +217,7 @@ struct st_vio
void (*timeout)(Vio*, unsigned int which, unsigned int timeout);
my_bool (*poll_read)(Vio *vio, uint timeout);
my_bool (*is_connected)(Vio*);
+ my_bool (*has_data) (Vio*);
#ifdef HAVE_OPENSSL
void *ssl_arg;
#endif
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 893c3e494f9..545d03532c1 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -65,7 +65,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_db.cc ../sql/sql_delete.cc ../sql/sql_derived.cc
../sql/sql_do.cc ../sql/sql_error.cc ../sql/sql_handler.cc
../sql/sql_help.cc ../sql/sql_insert.cc ../sql/datadict.cc
- ../sql/sql_truncate.cc
+ ../sql/sql_admin.cc ../sql/sql_truncate.cc ../sql/sql_reload.cc
../sql/sql_lex.cc ../sql/keycaches.cc
../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc
../sql/sql_binlog.cc ../sql/sql_manager.cc
@@ -81,6 +81,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
../sql/partition_info.cc ../sql/sql_connect.cc
../sql/scheduler.cc ../sql/sql_audit.cc
+ ../sql/sql_alter.cc ../sql/sql_partition_admin.cc
../sql/event_parse_data.cc
../sql/sql_signal.cc ../sql/rpl_handler.cc
../sql/rpl_utility.cc
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index e2521bfcac7..bfbe02f9339 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -63,7 +63,8 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
protocol.cc net_serv.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \
sql_load.cc discover.cc sql_locale.cc \
- sql_profile.cc sql_truncate.cc datadict.cc \
+ sql_profile.cc sql_admin.cc sql_truncate.cc datadict.cc \
+ sql_reload.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
sql_lex.cc sql_list.cc sql_manager.cc \
@@ -78,9 +79,10 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
debug_sync.cc sql_tablespace.cc transaction.cc \
- rpl_injector.cc my_user.c partition_info.cc \
+ rpl_injector.cc my_user.c partition_info.cc sql_alter.cc \
sql_servers.cc event_parse_data.cc sql_signal.cc \
- rpl_handler.cc mdl.cc keycaches.cc sql_audit.cc
+ rpl_handler.cc mdl.cc keycaches.cc sql_audit.cc \
+ sql_partition_admin.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources)
nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index 79431ff65fe..396430fba12 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -15,7 +15,11 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-SET(MYSQLSERVICES_SOURCES my_snprintf_service.c thd_alloc_service.c)
+SET(MYSQLSERVICES_SOURCES
+ my_snprintf_service.c
+ thd_alloc_service.c
+ thd_wait_service.c
+ my_thread_scheduler_service.c)
ADD_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR})
diff --git a/libservices/Makefile.am b/libservices/Makefile.am
index 642081859c1..d25c5c9680c 100644
--- a/libservices/Makefile.am
+++ b/libservices/Makefile.am
@@ -15,5 +15,7 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
pkglib_LIBRARIES = libmysqlservices.a
-libmysqlservices_a_SOURCES = my_snprintf_service.c thd_alloc_service.c
+libmysqlservices_a_SOURCES = my_snprintf_service.c thd_alloc_service.c \
+ thd_wait_service.c \
+ my_thread_scheduler_service.c
EXTRA_DIST = CMakeLists.txt
diff --git a/libservices/my_thread_scheduler_service.c b/libservices/my_thread_scheduler_service.c
new file mode 100644
index 00000000000..dc8d40c6713
--- /dev/null
+++ b/libservices/my_thread_scheduler_service.c
@@ -0,0 +1,21 @@
+/*
+ Copyright (C) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+*/
+
+#include <service_versions.h>
+SERVICE_VERSION my_thread_scheduler_service=
+ (void*)VERSION_my_thread_scheduler;
diff --git a/libservices/thd_wait_service.c b/libservices/thd_wait_service.c
new file mode 100644
index 00000000000..3c87a2d0d1b
--- /dev/null
+++ b/libservices/thd_wait_service.c
@@ -0,0 +1,19 @@
+/*
+ Copyright (C) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <service_versions.h>
+SERVICE_VERSION *thd_wait_service= (void*)VERSION_thd_wait;
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
index 6ba53bd9c2c..b8eb11b2fea 100644
--- a/mysql-test/CMakeLists.txt
+++ b/mysql-test/CMakeLists.txt
@@ -16,6 +16,7 @@
INSTALL(
DIRECTORY .
DESTINATION ${INSTALL_MYSQLTESTDIR}
+ USE_SOURCE_PERMISSIONS
COMPONENT Test
PATTERN "var/" EXCLUDE
PATTERN "lib/My/SafeProcess" EXCLUDE
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 800044242ac..7609a4799e3 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -19,7 +19,6 @@ main.mysqlbinlog_row @solaris # Bug#52202 2010-03-22 alik mysqlbinlog
main.mysqlbinlog_row_innodb @solaris # Bug#52202 2010-03-22 alik mysqlbinlog_row* fail in daily-trunk on Sol10 x86_64 debug_max
main.mysqlbinlog_row_myisam @solaris # Bug#52202 2010-03-22 alik mysqlbinlog_row* fail in daily-trunk on Sol10 x86_64 debug_max
main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
-main.plugin* @solaris # Bug#47146 Linking problem with example plugin when dtrace enabled
main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
@@ -32,7 +31,6 @@ rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails spora
rpl.rpl_innodb_bug28430* # Bug#46029
rpl.rpl_innodb_bug30888* @solaris # Bug#47646 2009-09-25 alik rpl.rpl_innodb_bug30888 fails sporadically on Solaris
rpl.rpl_killed_ddl @windows # Bug#47638 2010-01-20 alik The rpl_killed_ddl test fails on Windows
-rpl.rpl_plugin_load* @solaris # Bug#47146
rpl.rpl_row_sp011* @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index aaadda941fb..6bf9a27afaf 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -262,7 +262,6 @@ DROP TABLE IF EXISTS t2;
CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb;
INSERT INTO t1 VALUES (4,4);
---error ER_DUP_ENTRY
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
SELECT * from t2;
TRUNCATE table t2;
@@ -277,11 +276,9 @@ CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb ;
INSERT INTO t1 values (7,7);
ROLLBACK;
INSERT INTO t1 values (8,8);
---error ER_DUP_ENTRY
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
COMMIT;
INSERT INTO t1 values (9,9);
---error ER_DUP_ENTRY
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
ROLLBACK;
SELECT * from t2;
@@ -291,11 +288,9 @@ INSERT INTO t1 values (10,10);
INSERT INTO t2 select * from t1;
SELECT * from t1;
INSERT INTO t2 values (100,100);
---error ER_DUP_ENTRY
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
COMMIT;
INSERT INTO t2 values (101,101);
---error ER_DUP_ENTRY
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
ROLLBACK;
SELECT * from t2;
@@ -377,7 +372,8 @@ reset master;
begin;
insert into ti values (1);
-insert into ti values (2) ;
+insert into ti values (2) ;
+# This is SAFE because --binlog-direct-non-transactional-updates=FALSE
insert into tt select * from ti;
rollback;
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 68aa949a7c7..7eca19bc834 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
@@ -24,6 +24,7 @@ reset master;
begin;
insert into ti values (1);
insert into ti values (2) ;
+# This is SAFE because --binlog-direct-non-transactional-updates=FALSE
insert into tt select * from ti;
rollback;
diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
index 2d480349c65..8e89cde004d 100644
--- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
@@ -725,7 +725,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--eval SET @check_temp='$available_n_temp'
--eval SET @table_temp='$table_n'
SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
- --let $available_t_temp= `SELECT @check_temp`
+ --let $available_n_temp= `SELECT @check_temp`
--enable_query_log
--eval DROP TEMPORARY TABLE $table_t, $table_n
diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test
index 32f8d16b900..67bf0f5b8ac 100644
--- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test
@@ -378,9 +378,12 @@ sync_slave_with_master;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-slave.sql
---diff_files $MYSQLD_DATADIR/test-temporary-master.sql $MYSQLD_DATADIR/test-temporary-slave.sql
+if (`select @@session.binlog_format != 'STATEMENT'`)
+{
+ --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-master.sql
+ --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-slave.sql
+ --diff_files $MYSQLD_DATADIR/test-temporary-master.sql $MYSQLD_DATADIR/test-temporary-slave.sql
+}
--echo #########################################################################
--echo # CLEAN
diff --git a/mysql-test/extra/rpl_tests/rpl_innodb.test b/mysql-test/extra/rpl_tests/rpl_innodb.test
index 4bc1c004ba7..8b9b7e7ff39 100644
--- a/mysql-test/extra/rpl_tests/rpl_innodb.test
+++ b/mysql-test/extra/rpl_tests/rpl_innodb.test
@@ -153,7 +153,7 @@ connection master;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = "RENAME TABLE t1 TO t3, t2 TO t1" and
- state = "Waiting for table";
+ state = "Waiting for table metadata lock";
--source include/wait_condition.inc
COMMIT;
diff --git a/mysql-test/include/check_no_concurrent_insert.inc b/mysql-test/include/check_no_concurrent_insert.inc
index 57772dddefc..c615ebd02cd 100644
--- a/mysql-test/include/check_no_concurrent_insert.inc
+++ b/mysql-test/include/check_no_concurrent_insert.inc
@@ -43,7 +43,8 @@ connection default;
# of our statement.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "insert into $table (i) values (0)";
+ where state = "Waiting for table level lock" and
+ info = "insert into $table (i) values (0)";
--source include/wait_condition.inc
--disable_result_log
diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc
index c0d30b56ef7..81fbdb03bca 100644
--- a/mysql-test/include/commit.inc
+++ b/mysql-test/include/commit.inc
@@ -723,7 +723,7 @@ call p_verify_status_increment(4, 4, 4, 4);
--echo # Sic: no table is created.
create table if not exists t2 (a int) select 6 union select 7;
--echo # Sic: first commits the statement, and then the transaction.
-call p_verify_status_increment(2, 0, 4, 4);
+call p_verify_status_increment(2, 0, 2, 0);
create table t3 select a from t2;
call p_verify_status_increment(2, 0, 4, 4);
alter table t3 add column (b int);
diff --git a/mysql-test/include/ctype_filesort2.inc b/mysql-test/include/ctype_filesort2.inc
new file mode 100644
index 00000000000..7b09eb482a5
--- /dev/null
+++ b/mysql-test/include/ctype_filesort2.inc
@@ -0,0 +1,16 @@
+#
+# Testing filesort for full Unicode character sets
+# with supplementary characters.
+#
+
+--echo #
+--echo # Bug#55980 Character sets: supplementary character _bin ordering is wrong
+--echo #
+CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
+INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
+SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+ALTER TABLE t1 ADD KEY(a);
+SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc
index 77913fc8c18..06a9107e963 100644
--- a/mysql-test/include/ctype_numconv.inc
+++ b/mysql-test/include/ctype_numconv.inc
@@ -1626,6 +1626,108 @@ SELECT charset(@x), collation(@x);
--echo #
+--echo # Bug#54916 GROUP_CONCAT + IFNULL truncates output
+--echo #
+SELECT @@collation_connection;
+# ENGINE=MYISAM is very important to make sure "SYSTEM" join type
+# is in use, which will create instances of Item_copy.
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+if (`SELECT @@character_set_connection != 'ucs2'`)
+{
+ # Temporarily disable for ucs2
+ # For details, see Bug#55744 GROUP_CONCAT + CASE + ucs return garbage
+ SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+}
+--enable_metadata
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+--disable_metadata
+--echo # All columns must be VARCHAR(9) with the same length:
+--disable_warnings
+CREATE TABLE t2 AS
+SELECT
+ CONCAT(a),
+ IFNULL(a,''),
+ IF(a,a,''),
+ CASE WHEN a THEN a ELSE '' END,
+ COALESCE(a,'')
+FROM t1;
+--enable_warnings
+# The above query is expected to send a warning
+# in case of ucs2 character set, until Bug#55744 is fixed.
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+--echo #
+--echo # End of Bug#54916
+--echo #
+
+
+--echo #
--echo # Bug#52159 returning time type from function and empty left join causes debug assertion
--echo #
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/include/deadlock.inc b/mysql-test/include/deadlock.inc
index 89c34abc871..84d23b80811 100644
--- a/mysql-test/include/deadlock.inc
+++ b/mysql-test/include/deadlock.inc
@@ -159,7 +159,7 @@ drop table if exists A;
create table A (c int);
insert into A (c) values (0);
---error 0,ER_LOCK_DEADLOCK,ER_UPDATE_TABLE_USED
+--error 0,ER_LOCK_DEADLOCK,ER_TABLE_EXISTS_ERROR
create table a as select * from A;
drop table A;
diff --git a/mysql-test/include/handler.inc b/mysql-test/include/handler.inc
index 98988ab55ba..65e9e61d077 100644
--- a/mysql-test/include/handler.inc
+++ b/mysql-test/include/handler.inc
@@ -523,7 +523,7 @@ connection waiter;
--echo connection: waiter
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Flushing tables";
+ where state = "Waiting for table flush";
--source include/wait_condition.inc
connection default;
--echo connection: default
@@ -557,7 +557,8 @@ connection waiter;
--echo connection: waiter
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t0";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t0";
--source include/wait_condition.inc
connection default;
--echo connection: default
@@ -743,7 +744,8 @@ send alter table t1 engine=memory;
connection con2;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 engine=memory";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 engine=memory";
--source include/wait_condition.inc
connection default;
--error ER_ILLEGAL_HA
@@ -764,7 +766,8 @@ send alter table t1 engine=memory;
connection con2;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 engine=memory";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 engine=memory";
--source include/wait_condition.inc
connection default;
--echo # Since S metadata lock was already acquired at HANDLER OPEN time
@@ -1024,7 +1027,9 @@ connection con1;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop table t1' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t1';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t1';
--source include/wait_condition.inc
--echo # --> connection default
connection default;
@@ -1055,7 +1060,9 @@ connection con1;
--echo # --> connection con2
connection con2;
--echo # Waiting for 'drop table t1' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t1';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t1';
--source include/wait_condition.inc
--echo # --> connection default
connection default;
@@ -1097,7 +1104,8 @@ send rename table t0 to t3, t1 to t0, t3 to t1;
connection con1;
--echo # Waiting for 'rename table ...' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='rename table t0 to t3, t1 to t0, t3 to t1';
+ where state='Waiting for table metadata lock' and
+ info='rename table t0 to t3, t1 to t0, t3 to t1';
--source include/wait_condition.inc
--echo # --> connection default
connection default;
@@ -1137,7 +1145,9 @@ connection con2;
--echo # --> connection con1
connection con1;
--echo # Waiting for 'drop table t2' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t2';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t2';
--source include/wait_condition.inc
--echo # --> connection default
connection default;
@@ -1146,7 +1156,9 @@ send select * from t2;
--echo # --> connection con1
connection con1;
--echo # Waiting for 'select * from t2' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='select * from t2';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='select * from t2';
unlock tables;
--echo # --> connection con2
connection con2;
@@ -1190,10 +1202,14 @@ connection default;
--echo # --> connection con3
connection con3;
--echo # Waiting for 'drop table t1' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t1';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t1';
--source include/wait_condition.inc
--echo # Waiting for 'drop table t2' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t2';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t2';
--source include/wait_condition.inc
--echo # Demonstrate that t2 lock was released and t2 was dropped
--echo # after ROLLBACK TO SAVEPOINT
@@ -1255,10 +1271,14 @@ connection default;
--echo # --> connection con3
connection con3;
--echo # Waiting for 'drop table t1' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t1';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t1';
--source include/wait_condition.inc
--echo # Waiting for 'drop table t2' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t2';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t2';
--source include/wait_condition.inc
--echo # Demonstrate that t2 lock was released and t2 was dropped
--echo # after ROLLBACK TO SAVEPOINT
@@ -1314,7 +1334,9 @@ drop table t1, t2;
--echo # --> connection con2
connection con2;
--echo # Waiting for 'drop table t3' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t3';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t3';
--source include/wait_condition.inc
--echo # Demonstrate that ROLLBACK TO SAVEPOINT didn't release the handler
--echo # lock.
@@ -1348,7 +1370,9 @@ send drop table t2;
--echo # --> connection con2
connection con2;
--echo # Waiting for 'drop table t2' to get blocked...
-let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t2';
+let $wait_condition=select count(*)=1 from information_schema.processlist
+ where state='Waiting for table metadata lock' and
+ info='drop table t2';
--source include/wait_condition.inc
--echo # --> connection con1
connection con1;
@@ -1400,7 +1424,8 @@ connection con2;
--echo # has read from the table commits.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "lock tables t1 write";
+ where state = "Waiting for table metadata lock" and
+ info = "lock tables t1 write";
--source include/wait_condition.inc
--echo # --> connection default
@@ -1427,7 +1452,8 @@ connection con1;
--echo # Waiting for 'handler t1 read a next' to get blocked...
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "handler t1 read a next";
+ where state = "Waiting for table level lock" and
+ info = "handler t1 read a next";
--source include/wait_condition.inc
--echo # The below 'drop table t1' should be able to proceed without
diff --git a/mysql-test/include/have_thread_concurrency.inc b/mysql-test/include/have_thread_concurrency.inc
deleted file mode 100644
index 730edbf4895..00000000000
--- a/mysql-test/include/have_thread_concurrency.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-disable_query_log;
-disable_result_log;
-set @have_thread_concurrency=0;
-select @have_thread_concurrency:=1 from information_schema.global_variables where variable_name='thread_concurrency';
-if (`select @have_thread_concurrency = 0`)
-{
- skip Need @@thread_concurrency;
-}
-enable_result_log;
-enable_query_log;
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index fe6abe13892..3481d572514 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -742,7 +742,6 @@ drop table if exists t2;
CREATE TABLE t2 (a int, b int, primary key (a));
BEGIN;
INSERT INTO t2 values(100,100);
---error ER_DUP_ENTRY
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
SELECT * from t2;
ROLLBACK;
@@ -756,13 +755,11 @@ drop table t2;
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
BEGIN;
INSERT INTO t2 values(100,100);
---error ER_DUP_ENTRY
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
SELECT * from t2;
COMMIT;
BEGIN;
INSERT INTO t2 values(101,101);
---error ER_DUP_ENTRY
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
SELECT * from t2;
ROLLBACK;
@@ -1583,7 +1580,7 @@ connect (con1, localhost, root,,);
--echo # Connection default
connection default;
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='TRUNCATE TABLE t1';
+ WHERE state='Waiting for table metadata lock' AND info='TRUNCATE TABLE t1';
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY a;
ROLLBACK;
diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc
index b3fd5e47179..91e0eff1e0f 100644
--- a/mysql-test/include/mysqlhotcopy.inc
+++ b/mysql-test/include/mysqlhotcopy.inc
@@ -5,7 +5,7 @@
--source include/not_windows.inc
--source include/not_embedded.inc
-if ($MYSQLHOTCOPY)
+if (!$MYSQLHOTCOPY)
{
die due to missing mysqlhotcopy tool;
}
diff --git a/mysql-test/include/not_blackhole.inc b/mysql-test/include/not_blackhole.inc
new file mode 100644
index 00000000000..078927ec4ca
--- /dev/null
+++ b/mysql-test/include/not_blackhole.inc
@@ -0,0 +1,5 @@
+if (`SELECT count(*) FROM information_schema.engines WHERE
+ (support = 'YES' OR support = 'DEFAULT') AND
+ engine = 'blackhole'`){
+ skip Blackhole engine enabled;
+}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 115ce3800ea..8ae731a9b2c 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2192,10 +2192,12 @@ sub environment_setup {
# mysqlhotcopy
# ----------------------------------------------------
my $mysqlhotcopy=
- mtr_pl_maybe_exists("$bindir/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;
+ mtr_pl_maybe_exists("$bindir/scripts/mysqlhotcopy") ||
+ mtr_pl_maybe_exists("$path_client_bindir/mysqlhotcopy");
+ if ($mysqlhotcopy)
+ {
+ $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy;
+ }
# ----------------------------------------------------
# perror
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 4a2e108f8c6..dbeedb481cd 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -469,7 +469,7 @@ drop table t1;
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1), (1);
CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
-CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
+INSERT INTO t2 SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
UPDATE t2 SET a = 2;
SELECT a FROM t2;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index fcbf5812312..40d900a0389 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -160,6 +160,8 @@ t1 CREATE TABLE `t1` (
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1 SELECT IFNULL('a' COLLATE latin1_swedish_ci, 'b' COLLATE latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'ifnull'
SELECT 'case+union+test'
UNION
SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result
index a9b04d54400..993d33d7a38 100644
--- a/mysql-test/r/commit_1innodb.result
+++ b/mysql-test/r/commit_1innodb.result
@@ -830,7 +830,7 @@ create table if not exists t2 (a int) select 6 union select 7;
Warnings:
Note 1050 Table 't2' already exists
# Sic: first commits the statement, and then the transaction.
-call p_verify_status_increment(2, 0, 4, 4);
+call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
create table t3 select a from t2;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index fce775c5952..d5f3945fb6b 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1,5 +1,6 @@
drop table if exists t1,t2,t3,t4,t5;
drop database if exists mysqltest;
+drop view if exists v1;
create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
@@ -264,15 +265,14 @@ create table if not exists t1 select 1,2;
Warnings:
Note 1050 Table 't1' already exists
create table if not exists t1 select 1,2,3,4;
-ERROR 21S01: Column count doesn't match value count at row 1
+Warnings:
+Note 1050 Table 't1' already exists
create table if not exists t1 select 1;
Warnings:
Note 1050 Table 't1' already exists
select * from t1;
1 2 3
1 2 3
-0 1 2
-0 0 1
drop table t1;
flush status;
create table t1 (a int not null, b int, primary key (a));
@@ -280,28 +280,21 @@ insert into t1 values (1,1);
create table if not exists t1 select 2;
Warnings:
Note 1050 Table 't1' already exists
-Warning 1364 Field 'a' doesn't have a default value
select * from t1;
a b
1 1
-0 2
create table if not exists t1 select 3 as 'a',4 as 'b';
Warnings:
Note 1050 Table 't1' already exists
-create table if not exists t1 select 3 as 'a',3 as 'b';
-ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
show warnings;
Level Code Message
Note 1050 Table 't1' already exists
-Error 1062 Duplicate entry '3' for key 'PRIMARY'
show status like "Opened_tables";
Variable_name Value
Opened_tables 2
select * from t1;
a b
1 1
-0 2
-3 4
drop table t1;
create table `t1 `(a int);
ERROR 42000: Incorrect table name 't1 '
@@ -611,7 +604,7 @@ b
drop table t1,t2;
create table t1 (a int);
create table t1 select * from t1;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR 42S01: Table 't1' already exists
create table t2 union = (t1) select * from t1;
ERROR HY000: 'test.t2' is not BASE TABLE
flush tables with read lock;
@@ -811,7 +804,8 @@ create table t1 (primary key(a)) select "b" as b;
ERROR 42000: Key column 'a' doesn't exist in table
create table t1 (a int);
create table if not exists t1 select 1 as a, 2 as b;
-ERROR 21S01: Column count doesn't match value count at row 1
+Warnings:
+Note 1050 Table 't1' already exists
drop table t1;
create table t1 (primary key (a)) (select 1 as a) union all (select 1 as a);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
@@ -823,25 +817,14 @@ Warnings:
Note 1050 Table 't1' already exists
select * from t1;
i
-1
create table if not exists t1 select * from t1;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+Warnings:
+Note 1050 Table 't1' already exists
select * from t1;
i
-1
+drop table t1;
create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce'
-select * from t1;
-i
-1
-alter table t1 add primary key (i);
-create table if not exists t1 (select 2 as i) union all (select 2 as i);
-ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
-select * from t1;
-i
-1
-2
-drop table t1;
create temporary table t1 (j int);
create table if not exists t1 select 1;
select * from t1;
@@ -893,8 +876,6 @@ select * from t2;
i
1
2
-1
-2
unlock tables;
drop table t1, t2;
create table t1 (upgrade int);
@@ -1561,6 +1542,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1586,11 +1568,9 @@ CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
INSERT IGNORE INTO t1 (b) VALUES (5);
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
SELECT a FROM t1;
-CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
-SELECT a FROM t1;
+INSERT INTO t2 SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
-SELECT a FROM t1;
+INSERT INTO t2 SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1, t2;
#
@@ -1620,7 +1600,7 @@ drop table if exists t2;
Warnings:
Note 1051 Unknown table 't2'
CREATE TABLE t2 (a int, b int, primary key (a));
-CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+INSERT INTO t2 select * from t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT * from t2;
a b
@@ -1633,13 +1613,7 @@ a b
1 1
drop table t2;
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
-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
-1 1
-TRUNCATE table t2;
-INSERT INTO t2 select * from t1;
+INSERT INTO t2 SELECT * FROM t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT * from t2;
a b
@@ -1964,11 +1938,7 @@ CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ;
END ; |
-CREATE TABLE IF NOT EXISTS t1 (
-`pk` INTEGER NOT NULL AUTO_INCREMENT ,
-`int` INTEGER ,
-PRIMARY KEY ( `pk` )
-) SELECT `pk` , `int_key` FROM B ;
+INSERT INTO t1 (pk, int_key) SELECT `pk` , `int_key` FROM B ;
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
@@ -2088,3 +2058,347 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
set @@sql_mode= @old_mode;
drop tables t1, t2;
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int);
+INSERT INTO t1 VALUES (1), (1);
+INSERT INTO t2 VALUES (2), (2);
+CREATE VIEW v1 AS SELECT id FROM t2;
+CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1;
+Warnings:
+Note 1050 Table 'v1' already exists
+SHOW CREATE TABLE v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t2`.`id` AS `id` from `t2` latin1 latin1_swedish_ci
+SELECT * FROM t2;
+id
+2
+2
+SELECT * FROM v1;
+id
+2
+2
+DROP VIEW v1;
+CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2;
+CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1;
+Warnings:
+Note 1050 Table 'tt1' already exists
+SELECT * FROM t2;
+id
+2
+2
+SELECT * FROM tt1;
+id
+2
+2
+DROP TEMPORARY TABLE tt1;
+DROP TABLE t1, t2;
+#
+# WL#5370 "Changing 'CREATE TABLE IF NOT EXISTS ... SELECT'
+# behaviour.
+#
+#
+# 1. Basic case: a base table.
+#
+create table if not exists t1 (a int) select 1 as a;
+select * from t1;
+a
+1
+create table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+1
+# Produces an essential warning ER_TABLE_EXISTS.
+create table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+# No new data in t1.
+select * from t1;
+a
+1
+drop table t1;
+#
+# 2. A temporary table.
+#
+create temporary table if not exists t1 (a int) select 1 as a;
+select * from t1;
+a
+1
+create temporary table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+1
+# An essential warning.
+create temporary table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+# No new data in t1.
+select * from t1;
+a
+1
+drop temporary table t1;
+#
+# 3. Creating a base table in presence of a temporary table.
+#
+create table t1 (a int);
+# Create a view for convenience of querying t1 shadowed by a temp.
+create view v1 as select a from t1;
+drop table t1;
+create temporary table t1 (a int) select 1 as a;
+create table if not exists t1 (a int) select 2 as a;
+select * from t1;
+a
+1
+select * from v1;
+a
+2
+# Note: an essential warning.
+create table if not exists t1 (a int) select 3 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+1
+select * from v1;
+a
+2
+drop temporary table t1;
+select * from t1;
+a
+2
+drop view v1;
+drop table t1;
+#
+# 4. Creating a temporary table in presence of a base table.
+#
+create table t1 (a int) select 1 as a;
+create temporary table if not exists t1 select 2 as a;
+select * from t1;
+a
+2
+# Note: an essential warning.
+create temporary table if not exists t1 select 3 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+2
+drop temporary table t1;
+select * from t1;
+a
+1
+drop table t1;
+#
+# 5. Creating a base table in presence of an updatable view.
+#
+create table t2 (a int unique);
+create view t1 as select a from t2;
+insert into t1 (a) values (1);
+create table t1 (a int);
+ERROR 42S01: Table 't1' already exists
+# Note: an essential warning.
+create table if not exists t1 (a int);
+Warnings:
+Note 1050 Table 't1' already exists
+create table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+1
+# Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+1
+select * from t2;
+a
+1
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+a
+3
+select * from t2;
+a
+1
+# Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+3
+select * from t2;
+a
+1
+drop temporary table t1;
+#
+# Repeating the test with a non-updatable view.
+#
+drop view t1;
+create view t1 as select a + 5 as a from t2;
+insert into t1 (a) values (1);
+ERROR HY000: The target table t1 of the INSERT is not insertable-into
+update t1 set a=3 where a=2;
+ERROR HY000: Column 'a' is not updatable
+create table t1 (a int);
+ERROR 42S01: Table 't1' already exists
+# Note: an essential warning.
+create table if not exists t1 (a int);
+Warnings:
+Note 1050 Table 't1' already exists
+create table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+6
+# Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+6
+select * from t2;
+a
+1
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+a
+3
+select * from t2;
+a
+1
+# Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+3
+select * from t2;
+a
+1
+drop temporary table t1;
+drop view t1;
+drop table t2;
+#
+# Repeating the test with a view select a constant number
+#
+create view t1 as select 1 as a;
+insert into t1 (a) values (1);
+ERROR HY000: The target table t1 of the INSERT is not insertable-into
+update t1 set a=3 where a=2;
+ERROR HY000: The target table t1 of the UPDATE is not updatable
+create table t1 (a int);
+ERROR 42S01: Table 't1' already exists
+# Note: an essential warning.
+create table if not exists t1 (a int);
+Warnings:
+Note 1050 Table 't1' already exists
+create table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+1
+# Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+1
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+a
+3
+# Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+3
+drop temporary table t1;
+drop view t1;
+#
+# 6. Test of unique_table().
+#
+create table t1 (a int) select 1 as a;
+create temporary table if not exists t1 (a int) select * from t1;
+create temporary table if not exists t1 (a int) select * from t1;
+ERROR HY000: Can't reopen table: 't1'
+select * from t1;
+a
+1
+drop temporary table t1;
+select * from t1;
+a
+1
+drop table t1;
+create temporary table t1 (a int) select 1 as a;
+create table if not exists t1 (a int) select * from t1;
+create table if not exists t1 (a int) select * from t1;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+1
+drop temporary table t1;
+select * from t1;
+a
+1
+drop table t1;
+create table if not exists t1 (a int) select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+#
+# 7. Test of non-matching columns, REPLACE and IGNORE.
+#
+create table t1 (a int) select 1 as b, 2 as c;
+select * from t1;
+a b c
+NULL 1 2
+drop table t1;
+create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'c' at row 1
+select * from t1;
+a b c
+NULL 0000-00-00 0000-00-00
+drop table t1;
+set @@session.sql_mode='STRICT_ALL_TABLES';
+create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
+ERROR 22007: Incorrect date value: '1' for column 'b' at row 1
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table if not exists t1 (a int, b date, c date)
+replace select 1 as b, 2 as c;
+ERROR 22007: Incorrect date value: '1' for column 'b' at row 1
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table if not exists t1 (a int, b date, c date)
+ignore select 1 as b, 2 as c;
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'c' at row 1
+select * from t1;
+a b c
+NULL 0000-00-00 0000-00-00
+set @@session.sql_mode=default;
+drop table t1;
+create table if not exists t1 (a int unique, b int)
+replace select 1 as a, 1 as b union select 1 as a, 2 as b;
+select * from t1;
+a b
+1 2
+drop table t1;
+create table if not exists t1 (a int unique, b int)
+ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
+select * from t1;
+a b
+1 1
+drop table t1;
+#
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 76a4d0f3cf3..0e8fe328589 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -2598,6 +2598,156 @@ SELECT charset(@x), collation(@x);
charset(@x) collation(@x)
binary binary
#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+binary
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 9 7 Y 128 31 63
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varbinary(9) DEFAULT NULL,
+ `IFNULL(a,'')` varbinary(9) NOT NULL DEFAULT '',
+ `IF(a,a,'')` varbinary(9) DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varbinary(9) DEFAULT NULL,
+ `COALESCE(a,'')` varbinary(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varbinary(6) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varbinary(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varbinary(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varbinary(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varbinary(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varbinary(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varbinary(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varbinary(5) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varbinary(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varbinary(64) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index f93cb5f9a12..b1e9ff38d26 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -2680,6 +2680,156 @@ SELECT charset(@x), collation(@x);
charset(@x) collation(@x)
cp1251 cp1251_general_ci
#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+cp1251_general_ci
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 9 7 Y 0 31 51
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
+ `IFNULL(a,'')` varchar(9) CHARACTER SET cp1251 NOT NULL DEFAULT '',
+ `IF(a,a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
+ `COALESCE(a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index 2794538e097..8331e18f3f4 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -47,7 +47,7 @@ master-bin.000001 # Query # # BEGIN
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 # # COMMIT
master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
-master-bin.000001 # Query # # use `test`; DROP TABLE t4
+master-bin.000001 # Query # # use `test`; DROP TABLE `t4` /* generated by server */
End of 5.0 tests
SHOW BINLOG EVENTS FROM 490;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 43ee365cd53..6216819d172 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -3008,6 +3008,156 @@ SELECT charset(@x), collation(@x);
charset(@x) collation(@x)
latin1 latin1_swedish_ci
#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+latin1_swedish_ci
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 9 7 Y 0 31 8
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varchar(9) DEFAULT NULL,
+ `IFNULL(a,'')` varchar(9) NOT NULL DEFAULT '',
+ `IF(a,a,'')` varchar(9) DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varchar(9) DEFAULT NULL,
+ `COALESCE(a,'')` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varchar(6) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varchar(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varchar(5) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varchar(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 7bb27e03acc..1215eb1db02 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -3840,6 +3840,153 @@ SELECT charset(@x), collation(@x);
charset(@x) collation(@x)
ucs2 ucs2_general_ci
#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_general_ci
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 9 7 Y 0 31 8
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
+ `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 NOT NULL DEFAULT '',
+ `IF(a,a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
+ `COALESCE(a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index c5fd7ef1439..7cee15aecef 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -611,6 +611,31 @@ utf16_bin 00610009
utf16_bin 0061
utf16_bin 00610020
drop table t1;
+#
+# Bug#55980 Character sets: supplementary character _bin ordering is wrong
+#
+CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
+INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
+SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+HEX(a) HEX(CONVERT(a USING utf8mb4))
+0385 CE85
+D800DF84 F0908E84
+DBC0DC00 F4808080
+FF9D EFBE9D
+ALTER TABLE t1 ADD KEY(a);
+SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+HEX(a) HEX(CONVERT(a USING utf8mb4))
+0385 CE85
+D800DF84 F0908E84
+DBC0DC00 F4808080
+FF9D EFBE9D
+DROP TABLE IF EXISTS t1;
select @@collation_connection;
@@collation_connection
utf16_bin
diff --git a/mysql-test/r/ctype_utf16_def.result b/mysql-test/r/ctype_utf16_def.result
new file mode 100644
index 00000000000..6514734cb38
--- /dev/null
+++ b/mysql-test/r/ctype_utf16_def.result
@@ -0,0 +1,9 @@
+SHOW VARIABLES LIKE 'collation_server';
+Variable_name Value
+collation_server utf16_general_ci
+SHOW VARIABLES LIKE 'character_set_server';
+Variable_name Value
+character_set_server utf16
+SHOW VARIABLES LIKE 'ft_stopword_file';
+Variable_name Value
+ft_stopword_file (built-in)
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 9f395f87be7..37d5aa98be3 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -610,6 +610,31 @@ utf32_bin 0000006100000009
utf32_bin 00000061
utf32_bin 0000006100000020
drop table t1;
+#
+# Bug#55980 Character sets: supplementary character _bin ordering is wrong
+#
+CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
+INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
+SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+HEX(a) HEX(CONVERT(a USING utf8mb4))
+00000385 CE85
+0000FF9D EFBE9D
+00010384 F0908E84
+00100000 F4808080
+ALTER TABLE t1 ADD KEY(a);
+SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+HEX(a) HEX(CONVERT(a USING utf8mb4))
+00000385 CE85
+0000FF9D EFBE9D
+00010384 F0908E84
+00100000 F4808080
+DROP TABLE IF EXISTS t1;
select @@collation_connection;
@@collation_connection
utf32_bin
@@ -1091,5 +1116,41 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
#
+# Bug#45263 utf32_general_ci, bad effects around CREATE TABLE AS SELECT
+#
+SET collation_connection=utf32_general_ci;
+CREATE TABLE t1 AS SELECT HEX(0x00) AS my_col;
+SELECT * FROM t1;
+my_col
+00
+DROP TABLE t1;
+#
+# Bug#55912 FORMAT with locale set fails for numbers < 1000
+#
+SET collation_connection=utf32_general_ci;
+CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `format(123,2,'no_NO')` varchar(37) CHARACTER SET utf32 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+format(123,2,'no_NO')
+123,00
+DROP TABLE t1;
+#
+# Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied
+#
+CREATE TABLE t1 (
+b char(250) CHARACTER SET utf32,
+key (b)
+) ENGINE=MYISAM;
+INSERT INTO t1 VALUES ('d'),('f');
+SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z';
+b
+d
+f
+DROP TABLE t1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index a4e7c4ef53a..e14b54b59a3 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -2087,6 +2087,2772 @@ t2 CREATE TABLE `t2` (
`CONCAT(s1)` varchar(255) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
+SET NAMES utf8;
+#
+# Start of WL#2649 Number-to-string conversions
+#
+select hex(concat(1));
+hex(concat(1))
+31
+create table t1 as select concat(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1;
+hex(c1)
+31
+drop table t1;
+select hex(concat(18446744073709551615));
+hex(concat(18446744073709551615))
+3138343436373434303733373039353531363135
+create table t1 as select concat(18446744073709551615) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1;
+hex(c1)
+3138343436373434303733373039353531363135
+drop table t1;
+select hex(concat(1.1));
+hex(concat(1.1))
+312E31
+create table t1 as select concat(1.1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1;
+hex(c1)
+312E31
+drop table t1;
+select hex(concat('a', 1+2)), charset(concat(1+2));
+hex(concat('a', 1+2)) charset(concat(1+2))
+6133 utf8
+create table t1 as select concat(1+2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1-2));
+hex(concat(1-2))
+2D31
+create table t1 as select concat(1-2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1*2));
+hex(concat(1*2))
+32
+create table t1 as select concat(1*2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1/2));
+hex(concat(1/2))
+302E35303030
+create table t1 as select concat(1/2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 div 2));
+hex(concat(1 div 2))
+30
+create table t1 as select concat(1 div 2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 % 2));
+hex(concat(1 % 2))
+31
+create table t1 as select concat(1 % 2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-1));
+hex(concat(-1))
+2D31
+create table t1 as select concat(-1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-(1+2)));
+hex(concat(-(1+2)))
+2D33
+create table t1 as select concat(-(1+2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1|2));
+hex(concat(1|2))
+33
+create table t1 as select concat(1|2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1&2));
+hex(concat(1&2))
+30
+create table t1 as select concat(1&2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_count(12)));
+hex(concat(bit_count(12)))
+32
+create table t1 as select concat(bit_count(12)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2<<1));
+hex(concat(2<<1))
+34
+create table t1 as select concat(2<<1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2>>1));
+hex(concat(2>>1))
+31
+create table t1 as select concat(2>>1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(~0));
+hex(concat(~0))
+3138343436373434303733373039353531363135
+create table t1 as select concat(~0) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(3^2));
+hex(concat(3^2))
+31
+create table t1 as select concat(3^2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(abs(-2)));
+hex(concat(abs(-2)))
+32
+create table t1 as select concat(abs(-2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(exp(2)),1));
+hex(left(concat(exp(2)),1))
+37
+create table t1 as select concat(exp(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log(2)),1));
+hex(left(concat(log(2)),1))
+30
+create table t1 as select concat(log(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log2(2)),1));
+hex(left(concat(log2(2)),1))
+31
+create table t1 as select concat(log2(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log10(2)),1));
+hex(left(concat(log10(2)),1))
+30
+create table t1 as select concat(log10(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sqrt(2)),1));
+hex(left(concat(sqrt(2)),1))
+31
+create table t1 as select concat(sqrt(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(pow(2,2)),1));
+hex(left(concat(pow(2,2)),1))
+34
+create table t1 as select concat(pow(2,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(acos(0.5)),1));
+hex(left(concat(acos(0.5)),1))
+31
+create table t1 as select concat(acos(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(asin(0.5)),1));
+hex(left(concat(asin(0.5)),1))
+30
+create table t1 as select concat(asin(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(atan(0.5)),1));
+hex(left(concat(atan(0.5)),1))
+30
+create table t1 as select concat(atan(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(cos(0.5)),1));
+hex(left(concat(cos(0.5)),1))
+30
+create table t1 as select concat(cos(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sin(0.5)),1));
+hex(left(concat(sin(0.5)),1))
+30
+create table t1 as select concat(sin(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(tan(0.5)),1));
+hex(left(concat(tan(0.5)),1))
+30
+create table t1 as select concat(tan(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(degrees(0)));
+hex(concat(degrees(0)))
+30
+create table t1 as select concat(degrees(0)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(radians(0)));
+hex(concat(radians(0)))
+30
+create table t1 as select concat(radians(0)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ceiling(0.5)));
+hex(concat(ceiling(0.5)))
+31
+create table t1 as select concat(ceiling(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(floor(0.5)));
+hex(concat(floor(0.5)))
+30
+create table t1 as select concat(floor(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(round(0.5)));
+hex(concat(round(0.5)))
+31
+create table t1 as select concat(round(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sign(0.5)));
+hex(concat(sign(0.5)))
+31
+create table t1 as select concat(sign(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(rand()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(length('a')));
+hex(concat(length('a')))
+31
+create table t1 as select concat(length('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(char_length('a')));
+hex(concat(char_length('a')))
+31
+create table t1 as select concat(char_length('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_length('a')));
+hex(concat(bit_length('a')))
+38
+create table t1 as select concat(bit_length('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coercibility('a')));
+hex(concat(coercibility('a')))
+34
+create table t1 as select concat(coercibility('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(locate('a','a')));
+hex(concat(locate('a','a')))
+31
+create table t1 as select concat(locate('a','a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(11) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(field('c','a','b','c')));
+hex(concat(field('c','a','b','c')))
+33
+create table t1 as select concat(field('c','a','b','c')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ascii(61)));
+hex(concat(ascii(61)))
+3534
+create table t1 as select concat(ascii(61)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ord(61)));
+hex(concat(ord(61)))
+3534
+create table t1 as select concat(ord(61)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(find_in_set('b','a,b,c,d')));
+hex(concat(find_in_set('b','a,b,c,d')))
+32
+create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select md5('a'), hex(md5('a'));
+md5('a') hex(md5('a'))
+0cc175b9c0f1b6a831c399e269772661 3063633137356239633066316236613833316333393965323639373732363631
+create table t1 as select md5('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select old_password('a'), hex(old_password('a'));
+old_password('a') hex(old_password('a'))
+60671c896665c3fa 36303637316338393636363563336661
+create table t1 as select old_password('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(16) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select password('a'), hex(password('a'));
+password('a') hex(password('a'))
+*667F407DE7C6AD07358FA38DAED7828A72014B4E 2A36363746343037444537433641443037333538464133384441454437383238413732303134423445
+create table t1 as select password('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(41) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha('a'), hex(sha('a'));
+sha('a') hex(sha('a'))
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 38366637653433376661613561376663653135643164646362396561656165613337373636376238
+create table t1 as select sha('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(40) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha1('a'), hex(sha1('a'));
+sha1('a') hex(sha1('a'))
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 38366637653433376661613561376663653135643164646362396561656165613337373636376238
+create table t1 as select sha1('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(40) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('-1' as signed)));
+hex(concat(cast('-1' as signed)))
+2D31
+create table t1 as select concat(cast('-1' as signed)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('1' as unsigned)));
+hex(concat(cast('1' as unsigned)))
+31
+create table t1 as select concat(cast('1' as unsigned)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast(1/2 as decimal(5,5))));
+hex(concat(cast(1/2 as decimal(5,5))))
+302E3530303030
+create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as date)));
+hex(concat(cast('2001-01-02 03:04:05' as date)))
+323030312D30312D3032
+create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as time)));
+hex(concat(cast('2001-01-02 03:04:05' as time)))
+30333A30343A3035
+create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+03:04:05
+drop table t1;
+select hex(concat(cast('2001-01-02' as datetime)));
+hex(concat(cast('2001-01-02' as datetime)))
+323030312D30312D30322030303A30303A3030
+create table t1 as select concat(cast('2001-01-02' as datetime)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(29) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02 00:00:00
+drop table t1;
+select hex(concat(least(1,2)));
+hex(concat(least(1,2)))
+31
+create table t1 as select concat(least(1,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(greatest(1,2)));
+hex(concat(greatest(1,2)))
+32
+create table t1 as select concat(greatest(1,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(case when 11 then 22 else 33 end));
+hex(concat(case when 11 then 22 else 33 end))
+3232
+create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coalesce(1,2)));
+hex(concat(coalesce(1,2)))
+31
+create table t1 as select concat(coalesce(1,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat_ws(1,2,3));
+hex(concat_ws(1,2,3))
+323133
+create table t1 as select concat_ws(1,2,3) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(group_concat(1,2,3));
+hex(group_concat(1,2,3))
+313233
+create table t1 as select group_concat(1,2,3) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(342) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select 1 as c1 union select 'a';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1 order by c1;
+hex(c1)
+31
+61
+drop table t1;
+create table t1 as select concat(last_insert_id()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(benchmark(0,0)));
+hex(concat(benchmark(0,0)))
+30
+create table t1 as select concat(benchmark(0,0)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sleep(0)));
+hex(concat(sleep(0)))
+30
+create table t1 as select concat(sleep(0)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(is_free_lock('xxxx')));
+hex(concat(is_free_lock('xxxx')))
+31
+create table t1 as select concat(is_free_lock('xxxx')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(is_used_lock('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(release_lock('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(crc32('')));
+hex(concat(crc32('')))
+30
+create table t1 as select concat(crc32('')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(uncompressed_length('')));
+hex(concat(uncompressed_length('')))
+30
+create table t1 as select concat(uncompressed_length('')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(connection_id()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_aton('127.1.1.1')));
+hex(concat(inet_aton('127.1.1.1')))
+32313330373732323235
+create table t1 as select concat(inet_aton('127.1.1.1')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_ntoa(2130772225)));
+hex(concat(inet_ntoa(2130772225)))
+3132372E312E312E31
+create table t1 as select concat(inet_ntoa(2130772225)) as c1;
+select * from t1;
+c1
+127.1.1.1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(31) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select 1;
+1
+1
+select hex(concat(row_count()));
+hex(concat(row_count()))
+2D31
+create table t1 as select concat(row_count()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(found_rows()));
+hex(concat(found_rows()))
+30
+create table t1 as select concat(found_rows()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid_short()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
+coercibility(uuid()) coercibility(cast('a' as char character set latin1))
+4 2
+select charset(concat(uuid(), cast('a' as char character set latin1)));
+charset(concat(uuid(), cast('a' as char character set latin1)))
+latin1
+create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(37) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1));
+hex(concat(@a1:=1))
+31
+create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2;
+select hex(c1) from t1;
+hex(c1)
+32
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c2` int(1) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1;
+select hex(concat(@a2));
+hex(concat(@a2))
+31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=sqrt(1)));
+hex(concat(@a1:=sqrt(1)))
+31
+create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=sqrt(1);
+select hex(concat(@a2));
+hex(concat(@a2))
+31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1.1));
+hex(concat(@a1:=1.1))
+312E31
+create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2;
+select hex(c1) from t1;
+hex(c1)
+312E31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1.1;
+select hex(concat(@a2));
+hex(concat(@a2))
+312E31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+312E31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(83) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` decimal(65,30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@@ft_max_word_len));
+hex(concat(@@ft_max_word_len))
+3834
+create table t1 as select concat(@@ft_max_word_len) as c1;
+select hex(c1) from t1;
+hex(c1)
+3834
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS TRUE));
+hex(concat('a'='a' IS TRUE))
+31
+create table t1 as select concat('a'='a' IS TRUE) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS NOT TRUE));
+hex(concat('a'='a' IS NOT TRUE))
+30
+create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NOT 'a'='a'));
+hex(concat(NOT 'a'='a'))
+30
+create table t1 as select concat(NOT 'a'='a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NULL));
+hex(concat('a' IS NULL))
+30
+create table t1 as select concat('a' IS NULL) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NOT NULL));
+hex(concat('a' IS NOT NULL))
+31
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' rlike 'a'));
+hex(concat('a' rlike 'a'))
+31
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(strcmp('a','b')));
+hex(concat(strcmp('a','b')))
+2D31
+create table t1 as select concat(strcmp('a','b')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' like 'a'));
+hex(concat('a' like 'a'))
+31
+create table t1 as select concat('a' like 'b') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' between 'b' and 'c'));
+hex(concat('a' between 'b' and 'c'))
+30
+create table t1 as select concat('a' between 'b' and 'c') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' in ('a','b')));
+hex(concat('a' in ('a','b')))
+31
+create table t1 as select concat('a' in ('a','b')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
+hex(concat(interval(23, 1, 15, 17, 30, 44, 200)))
+33
+create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a varchar(10), fulltext key(a));
+insert into t1 values ('a');
+select hex(concat(match (a) against ('a'))) from t1;
+hex(concat(match (a) against ('a')))
+30
+create table t2 as select concat(match (a) against ('a')) as a from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+select hex(ifnull(1,'a'));
+hex(ifnull(1,'a'))
+31
+create table t1 as select ifnull(1,'a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1,1)));
+hex(concat(ifnull(1,1)))
+31
+create table t1 as select concat(ifnull(1,1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1.1,1.1)));
+hex(concat(ifnull(1.1,1.1)))
+312E31
+create table t1 as select concat(ifnull(1.1,1.1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,'b',1));
+hex(if(1,'b',1))
+62
+create table t1 as select if(1,'b',1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,1,'b'));
+hex(if(1,1,'b'))
+31
+create table t1 as select if(1,1,'b') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(if(1,1,1)));
+hex(concat(if(1,1,1)))
+31
+create table t1 as select concat(if(1,1,1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(nullif(1,2)));
+hex(concat(nullif(1,2)))
+31
+create table t1 as select concat(nullif(1,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))))
+31
+create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+32
+create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))))
+32
+create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+30
+create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))));
+hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))))
+31
+create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))));
+hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))))
+30
+create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
+hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
+30
+create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
+hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))))
+30
+create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
+hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))))
+31
+create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1;
+drop table t1;
+select hex(concat(x(GeomFromText('Point(1 2)'))));
+hex(concat(x(GeomFromText('Point(1 2)'))))
+31
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(y(GeomFromText('Point(1 2)'))));
+hex(concat(y(GeomFromText('Point(1 2)'))))
+32
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))));
+hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))))
+31
+create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))));
+hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))))
+31
+create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GeometryType(GeomFromText('Point(1 2)'))));
+hex(concat(GeometryType(GeomFromText('Point(1 2)'))))
+504F494E54
+create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(AsText(GeomFromText('Point(1 2)'))));
+hex(concat(AsText(GeomFromText('Point(1 2)'))))
+504F494E542831203229
+create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` longtext CHARACTER SET utf8
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_add(200902, 2)));
+hex(concat(period_add(200902, 2)))
+323030393034
+create table t1 as select concat(period_add(200902, 2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_diff(200902, 200802)));
+hex(concat(period_diff(200902, 200802)))
+3132
+create table t1 as select concat(period_add(200902, 200802)) as c1;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(to_days(20090224)));
+hex(concat(to_days(20090224)))
+373333383237
+create table t1 as select concat(to_days(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofmonth(20090224)));
+hex(concat(dayofmonth(20090224)))
+3234
+create table t1 as select concat(dayofmonth(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofyear(20090224)));
+hex(concat(dayofyear(20090224)))
+3535
+create table t1 as select concat(dayofyear(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(hour('10:11:12')));
+hex(concat(hour('10:11:12')))
+3130
+create table t1 as select concat(hour('10:11:12')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(minute('10:11:12')));
+hex(concat(minute('10:11:12')))
+3131
+create table t1 as select concat(minute('10:11:12')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(second('10:11:12')));
+hex(concat(second('10:11:12')))
+3132
+create table t1 as select concat(second('10:11:12')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(quarter(20090224)));
+hex(concat(quarter(20090224)))
+31
+create table t1 as select concat(quarter(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(week(20090224)));
+hex(concat(week(20090224)))
+38
+create table t1 as select concat(week(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(yearweek(20090224)));
+hex(concat(yearweek(20090224)))
+323030393038
+create table t1 as select concat(yearweek(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(year(20090224)));
+hex(concat(year(20090224)))
+32303039
+create table t1 as select concat(year(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(weekday(20090224)));
+hex(concat(weekday(20090224)))
+31
+create table t1 as select concat(weekday(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofweek(20090224)));
+hex(concat(dayofweek(20090224)))
+33
+create table t1 as select concat(dayofweek(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(unix_timestamp(20090224)));
+hex(concat(unix_timestamp(20090224)))
+31323335343232383030
+create table t1 as select concat(unix_timestamp(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(time_to_sec('10:11:12')));
+hex(concat(time_to_sec('10:11:12')))
+3336363732
+create table t1 as select concat(time_to_sec('10:11:12')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(extract(year from 20090702)));
+hex(concat(extract(year from 20090702)))
+32303039
+create table t1 as select concat(extract(year from 20090702)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(microsecond('12:00:00.123456')));
+hex(concat(microsecond('12:00:00.123456')))
+313233343536
+create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(month(20090224)));
+hex(concat(month(20090224)))
+32
+create table t1 as select concat(month(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(last_day('2003-02-05')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1 hex(c1)
+2003-02-28 323030332D30322D3238
+drop table t1;
+create table t1 as select concat(from_days(730669)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1 hex(c1)
+2000-07-03 323030302D30372D3033
+drop table t1;
+create table t1 as select concat(curdate()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_date()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(curtime()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(8) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat('a',20) as c1 limit 0;
+set timestamp=1216359724;
+insert into t1 values (current_date);
+insert into t1 values (current_time);
+select c1, hex(c1) from t1;
+c1 hex(c1)
+2008-07-18 323030382D30372D3138
+08:42:04 30383A34323A3034
+drop table t1;
+create table t1 as select concat(utc_time()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(8) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sec_to_time(2378)));
+hex(concat(sec_to_time(2378)))
+30303A33393A3338
+create table t1 as select concat(sec_to_time(2378)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')));
+hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')))
+32343A30303A3030
+create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(maketime(10,11,12)));
+hex(concat(maketime(10,11,12)))
+31303A31313A3132
+create table t1 as select concat(maketime(10,11,12)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(get_format(DATE,'USA'));
+hex(get_format(DATE,'USA'))
+256D2E25642E2559
+create table t1 as select get_format(DATE,'USA') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(17) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(from_unixtime(1111885200)),4));
+hex(left(concat(from_unixtime(1111885200)),4))
+32303035
+create table t1 as select concat(from_unixtime(1111885200)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')));
+hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')))
+323030332D31322D33312032303A30303A3030
+create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)));
+hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)))
+323030342D30312D30322031323A30303A3030
+create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(29) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2004-01-02 12:00:00
+drop table t1;
+select hex(concat(makedate(2009,1)));
+hex(concat(makedate(2009,1)))
+323030392D30312D3031
+create table t1 as select concat(makedate(2009,1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2009-01-01
+drop table t1;
+create table t1 as select concat(now()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_timestamp()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(sysdate()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(addtime('00:00:00','11:22:33')));
+hex(concat(addtime('00:00:00','11:22:33')))
+31313A32323A3333
+create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(29) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(subtime('23:59:59','11:22:33')));
+hex(concat(subtime('23:59:59','11:22:33')))
+31323A33373A3236
+create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(29) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(elt(1,2,3));
+hex(elt(1,2,3))
+32
+create table t1 as select elt(1,2,3) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(export_set(1,2,3,4,2));
+hex(export_set(1,2,3,4,2))
+323433
+create table t1 as select export_set(1,2,3,4,2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(127) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(insert(1133,3,0,22));
+hex(insert(1133,3,0,22))
+313132323333
+create table t1 as select insert(1133,3,0,22) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lcase(123));
+hex(lcase(123))
+313233
+create table t1 as select lcase(123) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(123,1));
+hex(left(123,1))
+31
+create table t1 as select left(123,1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lower(123));
+hex(lower(123))
+313233
+create table t1 as select lower(123) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lpad(1,2,0));
+hex(lpad(1,2,0))
+3031
+create table t1 as select lpad(1,2,0) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ltrim(1));
+hex(ltrim(1))
+31
+create table t1 as select ltrim(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(mid(1,1,1));
+hex(mid(1,1,1))
+31
+create table t1 as select mid(1,1,1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(repeat(1,2));
+hex(repeat(1,2))
+3131
+create table t1 as select repeat(1,2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(replace(1,1,2));
+hex(replace(1,1,2))
+32
+create table t1 as select replace(1,1,2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(reverse(12));
+hex(reverse(12))
+3231
+create table t1 as select reverse(12) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(right(123,1));
+hex(right(123,1))
+33
+create table t1 as select right(123,1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rpad(1,2,0));
+hex(rpad(1,2,0))
+3130
+create table t1 as select rpad(1,2,0) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rtrim(1));
+hex(rtrim(1))
+31
+create table t1 as select rtrim(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(soundex(1));
+hex(soundex(1))
+
+create table t1 as select soundex(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(substring(1,1,1));
+hex(substring(1,1,1))
+31
+create table t1 as select substring(1,1,1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(trim(1));
+hex(trim(1))
+31
+create table t1 as select trim(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ucase(1));
+hex(ucase(1))
+31
+create table t1 as select ucase(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(upper(1));
+hex(upper(1))
+31
+create table t1 as select upper(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat(' ', 64) as a limit 0;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ("1.1"), ("2.1");
+select a, hex(a) from t1;
+a hex(a)
+1.1 312E31
+2.1 322E31
+update t1 set a= a + 0.1;
+select a, hex(a) from t1;
+a hex(a)
+1.2000000000000002 312E32303030303030303030303030303032
+2.2 322E32
+drop table t1;
+create table t1 (a tinyint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a tinyint zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+303031 001
+303130 010
+313030 100
+drop table t1;
+create table t1 (a tinyint(4) zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+30303031 0001
+30303130 0010
+30313030 0100
+drop table t1;
+create table t1 (a decimal(10,2));
+insert into t1 values (123.45);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E3435
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(12) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(6) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+3030303031 00001
+3030303130 00010
+3030313030 00100
+3031303030 01000
+3130303030 10000
+drop table t1;
+create table t1 (a mediumint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a mediumint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+3030303030303031 00000001
+3030303030303130 00000010
+3030303030313030 00000100
+3030303031303030 00001000
+3030303130303030 00010000
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(11) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a int zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+30303030303030303031 0000000001
+30303030303030303130 0000000010
+30303030303030313030 0000000100
+30303030303031303030 0000001000
+30303030303130303030 0000010000
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(20) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bigint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+3030303030303030303030303030303030303031 00000000000000000001
+3030303030303030303030303030303030303130 00000000000000000010
+3030303030303030303030303030303030313030 00000000000000000100
+3030303030303030303030303030303031303030 00000000000000001000
+3030303030303030303030303030303130303030 00000000000000010000
+drop table t1;
+create table t1 (a float);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E343536
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(12) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a float zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+303030303030303030312E31 0000000001.1
+303030303030303031302E31 0000000010.1
+303030303030303130302E31 0000000100.1
+303030303030313030302E31 0000001000.1
+303030303031303030302E31 0000010000.1
+drop table t1;
+create table t1 (a double);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E343536
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(22) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a double zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+30303030303030303030303030303030303030312E31 00000000000000000001.1
+30303030303030303030303030303030303031302E31 00000000000000000010.1
+30303030303030303030303030303030303130302E31 00000000000000000100.1
+30303030303030303030303030303030313030302E31 00000000000000001000.1
+30303030303030303030303030303031303030302E31 00000000000000010000.1
+drop table t1;
+create table t1 (a year(2));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a year);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+32303031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bit(64));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0000000000000001
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varbinary(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a timestamp);
+insert into t1 values (0);
+insert into t1 values (20010203040506);
+insert into t1 values (19800203040506);
+insert into t1 values ('2001-02-03 04:05:06');
+select hex(concat(a)) from t1;
+hex(concat(a))
+303030302D30302D30302030303A30303A3030
+323030312D30322D30332030343A30353A3036
+313938302D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+select concat(a) from t1;
+concat(a)
+0000-00-00 00:00:00
+2001-02-03 04:05:06
+1980-02-03 04:05:06
+2001-02-03 04:05:06
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a date);
+insert into t1 values ('2001-02-03');
+insert into t1 values (20010203);
+select hex(concat(a)) from t1;
+hex(concat(a))
+323030312D30322D3033
+323030312D30322D3033
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a time);
+insert into t1 values (1);
+insert into t1 values ('01:02:03');
+select hex(concat(a)) from t1;
+hex(concat(a))
+30303A30303A3031
+30313A30323A3033
+select concat(a) from t1;
+concat(a)
+00:00:01
+01:02:03
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(8) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a datetime);
+insert into t1 values ('2001-02-03 04:05:06');
+insert into t1 values (20010203040506);
+select hex(concat(a)) from t1;
+hex(concat(a))
+323030312D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(19) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a tinyint);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(4) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a tinyint zerofill);
+insert into t1 values (1), (10), (100);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(3) YES NULL
+select hex(a) from v1;
+hex(a)
+303031
+303130
+313030
+drop table t1;
+drop view v1;
+create table t1 (a tinyint(30) zerofill);
+insert into t1 values (1), (10), (100);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(30) YES NULL
+select hex(a) from v1;
+hex(a)
+303030303030303030303030303030303030303030303030303030303031
+303030303030303030303030303030303030303030303030303030303130
+303030303030303030303030303030303030303030303030303030313030
+drop table t1;
+drop view v1;
+create table t1 (a decimal(10,2));
+insert into t1 values (123.45);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(12) YES NULL
+select hex(a) from v1;
+hex(a)
+3132332E3435
+drop table t1;
+drop view v1;
+create table t1 (a smallint);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(6) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a smallint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(5) YES NULL
+select hex(a) from v1;
+hex(a)
+3030303031
+3030303130
+3030313030
+3031303030
+3130303030
+drop table t1;
+drop view v1;
+create table t1 (a mediumint);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(9) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a mediumint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(8) YES NULL
+select hex(a) from v1;
+hex(a)
+3030303030303031
+3030303030303130
+3030303030313030
+3030303031303030
+3030303130303030
+drop table t1;
+drop view v1;
+create table t1 (a int);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(11) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a int zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(10) YES NULL
+select hex(a) from v1;
+hex(a)
+30303030303030303031
+30303030303030303130
+30303030303030313030
+30303030303031303030
+30303030303130303030
+drop table t1;
+drop view v1;
+create table t1 (a bigint);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(20) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a bigint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(20) YES NULL
+select hex(a) from v1;
+hex(a)
+3030303030303030303030303030303030303031
+3030303030303030303030303030303030303130
+3030303030303030303030303030303030313030
+3030303030303030303030303030303031303030
+3030303030303030303030303030303130303030
+drop table t1;
+drop view v1;
+create table t1 (a float);
+insert into t1 values (123.456);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(12) YES NULL
+select hex(a) from v1;
+hex(a)
+3132332E343536
+drop table t1;
+drop view v1;
+create table t1 (a float zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(12) YES NULL
+select hex(a) from v1;
+hex(a)
+303030303030303030312E31
+303030303030303031302E31
+303030303030303130302E31
+303030303030313030302E31
+303030303031303030302E31
+drop table t1;
+drop view v1;
+create table t1 (a double);
+insert into t1 values (123.456);
+select concat(a) from t1;
+concat(a)
+123.456
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(22) YES NULL
+select hex(a) from v1;
+hex(a)
+3132332E343536
+drop table t1;
+drop view v1;
+create table t1 (a double zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(22) YES NULL
+select hex(a) from v1;
+hex(a)
+30303030303030303030303030303030303030312E31
+30303030303030303030303030303030303031302E31
+30303030303030303030303030303030303130302E31
+30303030303030303030303030303030313030302E31
+30303030303030303030303030303031303030302E31
+drop table t1;
+drop view v1;
+create table t1 (a year(2));
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(2) YES NULL
+select hex(a) from v1;
+hex(a)
+3031
+drop table t1;
+drop view v1;
+create table t1 (a year);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(4) YES NULL
+select hex(a) from v1;
+hex(a)
+32303031
+drop table t1;
+drop view v1;
+create table t1 (a bit(64));
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varbinary(64) YES NULL
+select hex(a) from v1;
+hex(a)
+0000000000000001
+drop table t1;
+drop view v1;
+create table t1 (a timestamp);
+insert into t1 values (0);
+insert into t1 values (20010203040506);
+insert into t1 values (19800203040506);
+insert into t1 values ('2001-02-03 04:05:06');
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(19) NO
+select hex(a) from v1;
+hex(a)
+303030302D30302D30302030303A30303A3030
+323030312D30322D30332030343A30353A3036
+313938302D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+drop table t1;
+drop view v1;
+create table t1 (a date);
+insert into t1 values ('2001-02-03');
+insert into t1 values (20010203);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(10) YES NULL
+select hex(a) from v1;
+hex(a)
+323030312D30322D3033
+323030312D30322D3033
+drop table t1;
+drop view v1;
+create table t1 (a time);
+insert into t1 values (1);
+insert into t1 values ('01:02:03');
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(8) YES NULL
+select hex(a) from v1;
+hex(a)
+30303A30303A3031
+30313A30323A3033
+drop table t1;
+drop view v1;
+create table t1 (a datetime);
+insert into t1 values ('2001-02-03 04:05:06');
+insert into t1 values (20010203040506);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(19) YES NULL
+select hex(a) from v1;
+hex(a)
+323030312D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+drop table t1;
+drop view v1;
+create function f1 (par1 int) returns int
+begin
+return concat(par1);
+end|
+set @a= f1(1);
+select hex(@a);
+hex(@a)
+1
+select hex(concat(f1(1)));
+hex(concat(f1(1)))
+31
+create table t1 as select f1(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(f1(1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create view v1 as select concat(f1(1)) as c1;
+show columns from v1;
+Field Type Null Key Default Extra
+c1 varchar(11) YES NULL
+drop table t1;
+drop view v1;
+drop function f1;
+create function f1 (par1 decimal(18,2)) returns decimal(18,2)
+begin
+return concat(par1);
+end|
+set @a= f1(123.45);
+select hex(@a);
+hex(@a)
+7B
+select hex(concat(f1(123.45)));
+hex(concat(f1(123.45)))
+3132332E3435
+create table t1 as select f1(123.45) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` decimal(18,2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(f1(123.45)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create view v1 as select concat(f1(123.45)) as c1;
+show columns from v1;
+Field Type Null Key Default Extra
+c1 varchar(20) YES NULL
+drop table t1;
+drop view v1;
+drop function f1;
+create function f1 (par1 float) returns float
+begin
+return concat(par1);
+end|
+set @a= f1(123.45);
+select hex(@a);
+hex(@a)
+7B
+select hex(concat(f1(123.45)));
+hex(concat(f1(123.45)))
+3132332E3435
+create table t1 as select f1(123.45) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` float DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(f1(123.45)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(12) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create view v1 as select concat(f1(123.45)) as c1;
+show columns from v1;
+Field Type Null Key Default Extra
+c1 varchar(12) YES NULL
+drop table t1;
+drop view v1;
+drop function f1;
+create function f1 (par1 date) returns date
+begin
+return concat(par1);
+end|
+set @a= f1(cast('2001-01-02' as date));
+select hex(@a);
+hex(@a)
+323030312D30312D3032
+select hex(concat(f1(cast('2001-01-02' as date))));
+hex(concat(f1(cast('2001-01-02' as date))))
+323030312D30312D3032
+create table t1 as select f1(cast('2001-01-02' as date)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1;
+show columns from v1;
+Field Type Null Key Default Extra
+c1 varchar(10) YES NULL
+drop table t1;
+drop view v1;
+drop function f1;
+#
+# End of WL#2649 Number-to-string conversions
+#
+#
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+utf8_general_ci
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 27 7 Y 0 31 33
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
+ `IFNULL(a,'')` varchar(9) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `IF(a,a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
+ `COALESCE(a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varchar(3) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result
index 454c9d4bfbb..3b9abbc5412 100644
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@ -987,6 +987,31 @@ utf8mb4_bin 6109
utf8mb4_bin 61
utf8mb4_bin 6120
drop table t1;
+#
+# Bug#55980 Character sets: supplementary character _bin ordering is wrong
+#
+CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
+INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
+SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+HEX(a) HEX(CONVERT(a USING utf8mb4))
+CE85 CE85
+EFBE9D EFBE9D
+F0908E84 F0908E84
+F4808080 F4808080
+ALTER TABLE t1 ADD KEY(a);
+SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+HEX(a) HEX(CONVERT(a USING utf8mb4))
+CE85 CE85
+EFBE9D EFBE9D
+F0908E84 F0908E84
+F4808080 F4808080
+DROP TABLE IF EXISTS t1;
select @@collation_connection;
@@collation_connection
utf8mb4_bin
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 2bc77c52bec..4cb97719ff2 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -345,3 +345,80 @@ CREATE TABLE t1 LIKE t2;
ERROR 42S01: Table 't1' already exists
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
+#
+# This test is not supposed to work under --ps-protocol since
+# INSERT DELAYED doesn't work under LOCK TABLES with this protocol.
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+CREATE TABLE t3 (a INT);
+# Test 1: Using LOCK TABLE
+# Connection con1
+LOCK TABLE t1 WRITE;
+# Connection default
+LOCK TABLE t2 WRITE;
+# Sending:
+INSERT DELAYED INTO t1 VALUES (1);
+# Connection con1
+# Wait until INSERT DELAYED is blocked on table 't1'.
+INSERT DELAYED INTO t2 VALUES (1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+UNLOCK TABLES;
+# Connection default
+# Reaping: INSERT DELAYED INTO t1 VALUES (1)
+UNLOCK TABLES;
+# Test 2: Using ALTER TABLE
+START TRANSACTION;
+SELECT * FROM t1 WHERE a=0;
+a
+# Connection con1
+# Sending:
+ALTER TABLE t1 COMMENT 'test';
+# Connection default
+# Wait until ALTER TABLE is blocked on table 't1'.
+INSERT DELAYED INTO t1 VALUES (3);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+# Connection con1
+# Reaping: ALTER TABLE t1 COMMENT 'test'
+# Test 3: Using RENAME TABLE
+# Connection default
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+# Connection con1
+# Sending:
+RENAME TABLE t1 to t5, t2 to t4;
+# Connection default
+# Wait until RENAME TABLE is blocked on table 't1'.
+INSERT DELAYED INTO t1 VALUES (4);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+# Connection con1
+# Reaping: RENAME TABLE t1 to t5, t2 to t4
+# Connection default
+# Reverting the renames
+RENAME TABLE t5 to t1, t4 to t2;
+# Test 4: Two INSERT DELAYED on the same table
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+# Connection con2
+LOCK TABLE t1 WRITE, t2 WRITE;
+# Connection con1
+# Wait until LOCK TABLE is blocked on table 't2'.
+INSERT DELAYED INTO t1 VALUES (5);
+# Connection default
+# Wait until INSERT DELAYED is blocked on table 't1'.
+INSERT DELAYED INTO t1 VALUES (6);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+# Connection con2
+# Reaping: LOCK TABLE t1 WRITE, t2 WRITE
+UNLOCK TABLES;
+# Connection con1
+# Reaping: INSERT DELAYED INTO t1 VALUES (5)
+# Connection con2
+# Connection con1
+# Connection default
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 0c9b0d7d2e5..702b9348b7d 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -499,4 +499,13 @@ 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;
+#
+# Bug #53034: Multiple-table DELETE statements not accepting
+# "Access compatibility" syntax
+#
+CREATE TABLE t1 (id INT);
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a;
+DROP TABLE t1, t2, t3;
End of 5.1 tests
diff --git a/mysql-test/r/endspace.result b/mysql-test/r/endspace.result
index 9c8d12362c4..4eca88774b4 100644
--- a/mysql-test/r/endspace.result
+++ b/mysql-test/r/endspace.result
@@ -54,8 +54,8 @@ text1 like 'teststring_%' ORDER BY text1;
text1
teststring
teststring
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
-concat('|', text1, '|')
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
+c
|teststring |
|teststring|
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
@@ -105,11 +105,11 @@ select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
concat('|', text1, '|')
|teststring |
|teststring |
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
-concat('|', text1, '|')
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
+c
|teststring |
-|teststring|
|teststring |
+|teststring|
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
concat('|', text1, '|')
|teststring|
@@ -123,8 +123,8 @@ concat('|', text1, '|')
drop table t1;
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
-concat('|', text1, '|')
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
+c
|teststring |
|teststring|
select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t';
@@ -203,13 +203,13 @@ teststring
teststring
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
text1 length(text1)
-teststring 11
teststring 10
+teststring 11
teststring 11
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
text1 length(text1)
-teststring 11
teststring 10
+teststring 11
teststring 11
select concat('|', text1, '|') from t1 order by text1;
concat('|', text1, '|')
diff --git a/mysql-test/r/events_trans.result b/mysql-test/r/events_trans.result
index 16ec64b4c50..37951c30787 100644
--- a/mysql-test/r/events_trans.result
+++ b/mysql-test/r/events_trans.result
@@ -116,3 +116,22 @@ OK: create event: database does not exist
delete from t1;
commit work;
drop database events_test;
+#
+# Bug#54105 assert in MDL_context::release_locks_stored_before
+#
+USE test;
+DROP TABLE IF EXISTS t1, t2;
+DROP EVENT IF EXISTS e1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT);
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT A;
+SHOW CREATE EVENT e1;
+Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
+e1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 DAY STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT * FROM t2;
+a
+ROLLBACK WORK TO SAVEPOINT A;
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index 3702443d04a..aee18d91edf 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -205,6 +205,51 @@ a
insert into t2 (a) values (3);
# --> connection default;
unlock tables;
+#
+# Check that "FLUSH TABLES <list> WITH READ LOCK" is
+# compatible with active "FLUSH TABLES WITH READ LOCK".
+# Vice versa it is not true, since tables read-locked by
+# "FLUSH TABLES <list> WITH READ LOCK" can't be flushed.
+flush tables with read lock;
+# --> connection con1;
+flush table t1 with read lock;
+select * from t1;
+a
+1
+unlock tables;
+# --> connection default;
+unlock tables;
+#
+# Check that FLUSH TABLES t1 WITH READ LOCK
+# does not conflict with an existing FLUSH TABLES t2
+# WITH READ LOCK.
+#
+flush table t1 with read lock;
+# --> connection con1
+flush table t2 with read lock;
+unlock tables;
+# --> connection default
+unlock tables;
+#
+# Check that FLUSH TABLES t1 WITH READ LOCK
+# does not conflict with SET GLOBAL read_only=1.
+#
+set global read_only=1;
+# connection con1
+flush table t1 with read lock;
+unlock tables;
+# connection default
+set global read_only=0;
+#
+# Check that it's possible to read-lock
+# tables locked with FLUSH TABLE <list> WITH READ LOCK.
+#
+flush tables t1, t2 with read lock;
+# connection con1
+lock table t1 read, t2 read;
+unlock tables;
+# connection default
+unlock tables;
# --> connection con1
drop table t1, t2, t3;
#
@@ -234,3 +279,97 @@ drop temporary table v1;
unlock tables;
drop view v2, v3;
drop table t1, v1;
+#
+# FLUSH TABLES <list> WITH READ LOCK and HANDLER
+#
+drop table if exists t1;
+create table t1 (a int, key a (a));
+insert into t1 (a) values (1), (2), (3);
+handler t1 open;
+handler t1 read a next;
+a
+1
+handler t1 read a next;
+a
+2
+flush tables t1 with read lock;
+handler t1 read a next;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+unlock tables;
+#
+# Sic: lost handler position.
+#
+handler t1 read a next;
+a
+1
+handler t1 close;
+drop table t1;
+#
+# Bug#52117 Pending FLUSH TALBES <list> aborts
+# transactions unnecessarily.
+#
+drop table if exists t1;
+# --> conection default
+create table t1 (a int);
+begin;
+select * from t1;
+a
+# --> connection con1
+#
+# Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN
+# or a long-running select -- anything that
+# prevents FLUSH TABLE t1 from immediate completion would do.
+#
+lock table t1 read;
+# --> connection con2
+#
+# FLUSH TABLE expels the table definition from the cache.
+# Sending 'flush table t1'...
+flush table t1;
+# --> connection default
+# Let flush table sync in.
+select * from t1;
+# --> connection con1
+select * from t1;
+a
+unlock tables;
+# --> connection con2
+# Reaping 'flush table t1'...
+# --> connection default
+# Reaping 'select * from t1'...
+a
+commit;
+#
+# Repeat the same test but with FLUSH TABLES
+#
+begin;
+select * from t1;
+a
+# --> connection con1
+#
+# Issue a LOCK TABLE t1 READ.
+#
+lock table t1 read;
+# --> connection con2
+#
+# FLUSH TABLES expels the table definition from the cache.
+# Sending 'flush tables'...
+flush tables;
+# --> connection default
+# Let flush table sync in.
+select * from t1;
+# --> connection con1
+select * from t1;
+a
+unlock tables;
+# --> connection con2
+# Reaping 'flush tables'...
+# --> connection default
+# Reaping 'select * from t1'...
+a
+commit;
+# Cleanup
+# --> connection con1
+# --> connection con2
+# --> connection default
+drop table t1;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 1a393b3cdd5..302de9de9f7 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1003,6 +1003,7 @@ SELECT 1 FROM
1
1
DROP TABLE t1;
+End of 5.0 tests
#
# Bug #52397: another crash with explain extended and group_concat
#
@@ -1019,6 +1020,25 @@ Warnings:
Note 1003 select 1 AS `1` from dual
DROP TABLE t1;
End of 5.0 tests
+#
+# Bug #54476: crash when group_concat and 'with rollup' in prepared statements
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
+EXECUTE stmt;
+GROUP_CONCAT(t1.a ORDER BY t1.a)
+1,1
+2,2
+1,1,2,2
+EXECUTE stmt;
+GROUP_CONCAT(t1.a ORDER BY t1.a)
+1,1
+2,2
+1,1,2,2
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+End of 5.1 tests
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a VARCHAR(6), b INT);
CREATE TABLE t2 (a VARCHAR(6), b INT);
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 45c93971852..5f874f4665d 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1713,9 +1713,20 @@ f1 f2 f3 f4 f1 = f2
NULL NULL NULL NULL NULL
drop table t1;
#
+# Bug #54465: assert: field_types == 0 || field_types[field_pos] ==
+# MYSQL_TYPE_LONGLONG
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1
+ORDER BY t1.a;
+m
+1
+DROP TABLE t1;
+#
End of 5.1 tests
#
-# Bug#55648: Server crash on MIX/MAX on maximum time value
+# Bug#55648: Server crash on MIN/MAX on maximum time value
#
CREATE TABLE t1(c1 TIME NOT NULL);
INSERT INTO t1 VALUES('837:59:59');
@@ -1725,3 +1736,13 @@ MAX(c1)
838:59:59
DROP TABLE t1;
# End of the bug#55648
+#
+# Bug#56120: Failed assertion on MIN/MAX on negative time value
+#
+CREATE TABLE t1(c1 TIME NOT NULL);
+INSERT INTO t1 VALUES('-00:00:01');
+SELECT MAX(c1),MIN(c1) FROM t1;
+MAX(c1) MIN(c1)
+-00:00:01 -00:00:01
+DROP TABLE t1;
+# End of the bug#56120
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index 955a784f04c..c70589a27b7 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -186,3 +186,13 @@ MAX(IFNULL(CAST(c AS UNSIGNED), 0))
12345678901234567890
DROP TABLE t1;
End of 5.0 tests
+#
+# Bug#55077: Assertion failed: width > 0 && to != ((void *)0), file .\dtoa.c
+#
+CREATE TABLE t1 (a LONGBLOB, b DOUBLE);
+INSERT INTO t1 VALUES (NULL, 0), (NULL, 1);
+SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c;
+c
+NULL
+0
+DROP TABLE t1;
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index e21e7903459..1eb4153eb8b 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -337,6 +337,21 @@ select connection_id() > 0;
connection_id() > 0
1
#
+# Bug #54461: crash with longblob and union or update with subquery
+#
+CREATE TABLE t1 (a INT, b LONGBLOB);
+INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
+SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+LEAST(a, (SELECT b FROM t1 LIMIT 1))
+1
+2
+SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+GREATEST(a, (SELECT b FROM t1 LIMIT 1))
+2
+3
+1
+DROP TABLE t1;
+#
# Bug #52165: Assertion failed: file .\dtoa.c, line 465
#
CREATE TABLE t1 (a SET('a'), b INT);
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 7539cf43dd9..f01d46a9f41 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2734,3 +2734,28 @@ format(123, 1, 'Non-existent-locale')
Warnings:
Warning 1649 Unknown locale: 'Non-existent-locale'
End of 5.4 tests
+#
+# Start of 5.5 tests
+#
+#
+# Bug#55912 FORMAT with locale set fails for numbers < 1000
+#
+SELECT FORMAT(123.33, 2, 'no_NO'), FORMAT(1123.33, 2, 'no_NO');
+FORMAT(123.33, 2, 'no_NO') FORMAT(1123.33, 2, 'no_NO')
+123,33 1.123,33
+SELECT FORMAT(12333e-2, 2, 'no_NO'), FORMAT(112333e-2, 2, 'no_NO');
+FORMAT(12333e-2, 2, 'no_NO') FORMAT(112333e-2, 2, 'no_NO')
+123,33 1.123,33
+CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `format(123,2,'no_NO')` varchar(37) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+format(123,2,'no_NO')
+123,00
+DROP TABLE t1;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index c3f210edee5..9ba1ae489ca 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1305,4 +1305,12 @@ date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND)
select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
0168-12-31 23:59:59
+CREATE TABLE t1(a DOUBLE NOT NULL);
+INSERT INTO t1 VALUES (0),(9.216e-096);
+# should not crash
+SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
+1
+1
+1
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 3416e368dff..2621f69da06 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1811,6 +1811,41 @@ MAX(t2.a)
2
DROP TABLE t1, t2;
#
+# Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results
+#
+CREATE TABLE t1 (a text, b varchar(10));
+INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two');
+EXPLAIN
+SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
+id 1
+select_type SIMPLE
+table t1
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows 2
+Extra Using filesort
+SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
+SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b)
+1111111111 1300 one,two
+EXPLAIN
+SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
+id 1
+select_type SIMPLE
+table t1
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows 2
+Extra Using temporary; Using filesort
+SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
+SUBSTRING(a,1,10) LENGTH(a)
+1111111111 1300
+DROP TABLE t1;
# End of 5.1 tests
#
# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
diff --git a/mysql-test/r/handler_read_last.result b/mysql-test/r/handler_read_last.result
new file mode 100644
index 00000000000..a21e9ed9564
--- /dev/null
+++ b/mysql-test/r/handler_read_last.result
@@ -0,0 +1,60 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, INDEX (a));
+INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 1;
+a
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 1;
+a
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 1
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 3;
+a
+NULL
+NULL
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 2
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 3;
+a
+NULL
+NULL
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 1
+Handler_read_next 0
+Handler_read_prev 2
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+DROP TABLE t1;
diff --git a/mysql-test/r/information_schema_inno.result b/mysql-test/r/information_schema_inno.result
index fbb7e7e8397..838a7ad5162 100644
--- a/mysql-test/r/information_schema_inno.result
+++ b/mysql-test/r/information_schema_inno.result
@@ -89,3 +89,15 @@ UNIQUE_CONSTRAINT_NAME
NULL
drop table t2;
set foreign_key_checks = 1;
+#
+# Bug#55973 Assertion `thd->transaction.stmt.is_empty()'
+# on CREATE TABLE .. SELECT I_S.PART
+#
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+CREATE VIEW v1 AS SELECT 1;
+CREATE TABLE t1 engine = InnoDB AS
+SELECT * FROM information_schema.partitions
+WHERE table_schema= 'test' AND table_name= 'v1';
+DROP TABLE t1;
+DROP VIEW v1;
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index b322c5da73a..655303be7f4 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -671,3 +671,18 @@ drop table t1;
#
# End of 5.4 tests
#
+#
+# Bug#54106 assert in Protocol::end_statement,
+# INSERT IGNORE ... SELECT ... UNION SELECT ...
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 (a, a) VALUES (1, 1);
+ERROR 42000: Column 'a' specified twice
+INSERT IGNORE t1 (a, a) VALUES (1, 1);
+ERROR 42000: Column 'a' specified twice
+INSERT IGNORE t1 (a, a) SELECT 1,1;
+ERROR 42000: Column 'a' specified twice
+INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2;
+ERROR 42000: Column 'a' specified twice
+DROP TABLE t1;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index f12c9a0a61a..b0858894b71 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -694,6 +694,7 @@ show status like 'Handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 9f87ea082db..260f7170fc5 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -854,6 +854,7 @@ show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 847a00cad94..0af32d8f749 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1238,6 +1238,7 @@ show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 5
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result
index b52ed8070f9..aa61d8cd86f 100644
--- a/mysql-test/r/locale.result
+++ b/mysql-test/r/locale.result
@@ -44,7 +44,7 @@ a abmon mon
2006-12-01 Δεκ Δεκέμβριος
SELECT format(123456.789, 3, 'el_GR');
format(123456.789, 3, 'el_GR')
-123456.789
+123456,789
DROP TABLE t1;
#
# Bug#46633 Obsolete Serbian locale name
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index 0fd408b0208..d484ab77701 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -2034,6 +2034,155 @@ set debug_sync='now SIGNAL go2';
# Switching to connection 'default'.
# Reaping ALTER. It should succeed and not produce ER_LOCK_DEADLOCK.
drop table t1;
+#
+# Now, test for a situation in which deadlock involves waiting not
+# only in MDL subsystem but also for TDC. Such deadlocks should be
+# successfully detected. If possible, they should be resolved without
+# resorting to ER_LOCK_DEADLOCK error.
+#
+create table t1(i int);
+create table t2(j int);
+#
+# First, let us check how we handle a simple scenario involving
+# waits in MDL and TDC.
+#
+set debug_sync= 'RESET';
+# Switching to connection 'deadlock_con1'.
+# Start a statement, which will acquire SR metadata lock on t1, open it
+# and then stop, before trying to acquire SW lock on t2 and opening it.
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+# Sending:
+select * from t1 where i in (select j from t2 for update);
+# Switching to connection 'deadlock_con2'.
+# Wait till the above SELECT stops.
+set debug_sync='now WAIT_FOR parked';
+# The below FLUSH TABLES WITH READ LOCK should acquire
+# SNW locks on t1 and t2 and wait till SELECT closes t1.
+# Sending:
+flush tables t1, t2 with read lock;
+# Switching to connection 'deadlock_con3'.
+# Wait until FLUSH TABLES WITH t1, t2 READ LOCK starts waiting
+# for SELECT to close t1.
+# Resume SELECT, so it tries to acquire SW lock on t1 and blocks,
+# creating a deadlock. This deadlock should be detected and resolved
+# by backing-off SELECT. As a result FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'deadlock_con2'.
+# Reap FLUSH TABLES WITH READ LOCK.
+unlock tables;
+# Switching to connection 'deadlock_con1'.
+# Reap SELECT.
+i
+#
+# The same scenario with a slightly different order of events
+# which emphasizes that setting correct deadlock detector weights
+# for flush waits is important.
+#
+set debug_sync= 'RESET';
+# Switching to connection 'deadlock_con2'.
+set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go';
+# The below FLUSH TABLES WITH READ LOCK should acquire
+# SNW locks on t1 and t2 and wait on debug sync point.
+# Sending:
+flush tables t1, t2 with read lock;
+# Switching to connection 'deadlock_con1'.
+# Wait till FLUSH TABLE WITH READ LOCK stops.
+set debug_sync='now WAIT_FOR parked';
+# Start statement which will acquire SR metadata lock on t1, open
+# it and then will block while trying to acquire SW lock on t2.
+# Sending:
+select * from t1 where i in (select j from t2 for update);
+# Switching to connection 'deadlock_con3'.
+# Wait till the above SELECT blocks.
+# Resume FLUSH TABLES, so it tries to flush t1, thus creating
+# a deadlock. This deadlock should be detected and resolved by
+# backing-off SELECT. As a result FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'deadlock_con2'.
+# Reap FLUSH TABLES WITH READ LOCK.
+unlock tables;
+# Switching to connection 'deadlock_con1'.
+# Reap SELECT.
+i
+#
+# Now a more complex scenario involving two connections
+# waiting for MDL and one for TDC.
+#
+set debug_sync= 'RESET';
+# Switching to connection 'deadlock_con1'.
+# Start a statement which will acquire SR metadata lock on t2, open it
+# and then stop, before trying to acquire SR on t1 and opening it.
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+# Sending:
+select * from t2, t1;
+# Switching to connection 'deadlock_con2'.
+# Wait till the above SELECT stops.
+set debug_sync='now WAIT_FOR parked';
+# The below FLUSH TABLES WITH READ LOCK should acquire
+# SNW locks on t2 and wait till SELECT closes t2.
+# Sending:
+flush tables t2 with read lock;
+# Switching to connection 'deadlock_con3'.
+# Wait until FLUSH TABLES WITH READ LOCK starts waiting
+# for SELECT to close t2.
+# The below DROP TABLES should acquire X lock on t1 and start
+# waiting for X lock on t2.
+# Sending:
+drop tables t1, t2;
+# Switching to connection 'default'.
+# Wait until DROP TABLES starts waiting for X lock on t2.
+# Resume SELECT, so it tries to acquire SR lock on t1 and blocks,
+# creating a deadlock. This deadlock should be detected and resolved
+# by backing-off SELECT. As a result, FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'deadlock_con2'.
+# Reap FLUSH TABLES WITH READ LOCK.
+# Unblock DROP TABLES.
+unlock tables;
+# Switching to connection 'deadlock_con3'.
+# Reap DROP TABLES.
+# Switching to connection 'deadlock_con1'.
+# Reap SELECT. It should emit error about missing table.
+ERROR 42S02: Table 'test.t2' doesn't exist
+# Switching to connection 'default'.
+set debug_sync= 'RESET';
+#
+# Test for a scenario in which FLUSH TABLES <list> WITH READ LOCK
+# used to erroneously release metadata locks.
+#
+drop tables if exists t1, t2;
+set debug_sync= 'RESET';
+create table t1(i int);
+create table t2(j int);
+# Switching to connection 'con2'.
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+# The below FLUSH TABLES <list> WITH READ LOCK should acquire
+# SNW locks on t1 and t2, open table t1 and block on the debug
+# sync point.
+# Sending:
+flush tables t1, t2 with read lock;
+# Switching to connection 'con1'.
+# Wait till FLUSH TABLES <list> WITH READ LOCK stops.
+set debug_sync='now WAIT_FOR parked';
+# Start a statement which will flush all tables and thus
+# invalidate table t1 open by FLUSH TABLES <list> WITH READ LOCK.
+# Sending:
+flush tables;
+# Switching to connection 'default'.
+# Wait till the above FLUSH TABLES blocks.
+# Resume FLUSH TABLES <list> WITH READ LOCK, so it tries to open t2
+# discovers that its t1 is obsolete and tries to reopen all tables.
+# Such reopen should not cause releasing of SNW metadata locks
+# which would result in assertion failures.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'con2'.
+# Reap FLUSH TABLES <list> WITH READ LOCK.
+unlock tables;
+# Switching to connection 'con1'.
+# Reap FLUSH TABLES.
+# Clean-up.
+# Switching to connection 'default'.
+drop tables t1, t2;
set debug_sync= 'RESET';
#
# Test for bug #46748 "Assertion in MDL_context::wait_for_locks()
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index f7f0cea3b19..c7e54288f8b 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -933,7 +933,8 @@ DROP TABLE tm1, t1, t2;
CREATE TABLE t1(c1 INT);
CREATE TABLE t2 (c1 INT) ENGINE=MERGE UNION=(t1) INSERT_METHOD=FIRST;
CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+Warnings:
+Note 1050 Table 't1' already exists
DROP TABLE t1, t2;
CREATE TABLE t1 (id INT NOT NULL, ref INT NOT NULL, INDEX (id)) ENGINE=MyISAM;
CREATE TABLE t2 LIKE t1;
diff --git a/mysql-test/r/mysql_client_test.result b/mysql-test/r/mysql_client_test.result
index f30c64f6bef..7875464ebe2 100644
--- a/mysql-test/r/mysql_client_test.result
+++ b/mysql-test/r/mysql_client_test.result
@@ -1,4 +1,5 @@
SET @old_general_log= @@global.general_log;
+SET @old_slow_query_log= @@global.slow_query_log;
ok
# cat MYSQL_TMP_DIR/test_wl4435.out.log
@@ -120,3 +121,4 @@ mysql_stmt_next_result(): 0; field_count: 0
# ------------------------------------
SET @@global.general_log= @old_general_log;
+SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/r/mysql_not_windows.result b/mysql-test/r/mysql_not_windows.result
new file mode 100644
index 00000000000..d5670a1a9ca
--- /dev/null
+++ b/mysql-test/r/mysql_not_windows.result
@@ -0,0 +1,5 @@
+Bug #54466 client 5.5 built from source lacks "pager" support
+a
+1
+
+End of tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index e728eb8244d..51fad679909 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -28,7 +28,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-drop table if exists t1,t2,t3,t4,t5,t03,t04
+DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
create table t1 (word varchar(20))
@@ -229,7 +229,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-drop table if exists t1,t2,t3,t4,t5,t03,t04
+DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
create table t1 (word varchar(20))
@@ -628,7 +628,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-drop table t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
DELIMITER ;
# End of log file
diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/r/mysqlbinlog_row.result
index 85416138c6d..7ae1ea36899 100644
--- a/mysql-test/r/mysqlbinlog_row.result
+++ b/mysql-test/r/mysqlbinlog_row.result
@@ -385,7 +385,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -567,7 +567,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -595,7 +595,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -673,7 +673,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -759,7 +759,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -806,7 +806,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -850,7 +850,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -894,7 +894,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -960,7 +960,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1004,7 +1004,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1070,7 +1070,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1114,7 +1114,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1180,7 +1180,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1224,7 +1224,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1290,7 +1290,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1334,7 +1334,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1378,7 +1378,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1439,7 +1439,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1483,7 +1483,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1527,7 +1527,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1572,7 +1572,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1616,7 +1616,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1660,7 +1660,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1704,7 +1704,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1748,7 +1748,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1792,7 +1792,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1836,7 +1836,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1880,7 +1880,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1924,7 +1924,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1968,7 +1968,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2032,7 +2032,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2076,7 +2076,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2120,7 +2120,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2164,7 +2164,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2230,7 +2230,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2274,7 +2274,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2318,7 +2318,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2362,7 +2362,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2406,7 +2406,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2450,7 +2450,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2494,7 +2494,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2558,7 +2558,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2622,7 +2622,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2666,7 +2666,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2710,7 +2710,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2754,7 +2754,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2798,7 +2798,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2876,7 +2876,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2920,7 +2920,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2998,7 +2998,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3076,7 +3076,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3120,7 +3120,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3198,7 +3198,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3276,7 +3276,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3320,7 +3320,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3364,7 +3364,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3408,7 +3408,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3452,7 +3452,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3496,7 +3496,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3540,7 +3540,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3584,7 +3584,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3628,7 +3628,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3672,7 +3672,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3716,7 +3716,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3760,7 +3760,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3804,7 +3804,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3848,7 +3848,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3994,7 +3994,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -4127,7 +4127,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1,t2
+DROP TABLE `t1`,`t2` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
index 533f35c1113..025f67082ec 100644
--- a/mysql-test/r/mysqld--help-notwin.result
+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -688,7 +688,7 @@ The following options may be given as the first argument:
How many threads we should keep in a cache for reuse
--thread-handling=name
Define threads usage for handling queries, one of
- one-thread-per-connection, no-threads
+ one-thread-per-connection, no-threads, loaded-dynamically
--thread-stack=# The stack size for each thread
--time-format=name The TIME format (ignored)
--timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
@@ -860,9 +860,9 @@ performance-schema-max-file-classes 50
performance-schema-max-file-handles 32768
performance-schema-max-file-instances 10000
performance-schema-max-mutex-classes 200
-performance-schema-max-mutex-instances 1000
-performance-schema-max-rwlock-classes 20
-performance-schema-max-rwlock-instances 1000
+performance-schema-max-mutex-instances 1000000
+performance-schema-max-rwlock-classes 30
+performance-schema-max-rwlock-instances 1000000
performance-schema-max-table-handles 100000
performance-schema-max-table-instances 50000
performance-schema-max-thread-classes 50
diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result
index 9b6b0f53b01..e1098b71e25 100644
--- a/mysql-test/r/mysqld--help-win.result
+++ b/mysql-test/r/mysqld--help-win.result
@@ -692,7 +692,7 @@ The following options may be given as the first argument:
How many threads we should keep in a cache for reuse
--thread-handling=name
Define threads usage for handling queries, one of
- one-thread-per-connection, no-threads
+ one-thread-per-connection, no-threads, loaded-dynamically
--thread-stack=# The stack size for each thread
--time-format=name The TIME format (ignored)
--timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
@@ -864,9 +864,9 @@ performance-schema-max-file-classes 50
performance-schema-max-file-handles 32768
performance-schema-max-file-instances 10000
performance-schema-max-mutex-classes 200
-performance-schema-max-mutex-instances 1000
-performance-schema-max-rwlock-classes 20
-performance-schema-max-rwlock-instances 1000
+performance-schema-max-mutex-instances 1000000
+performance-schema-max-rwlock-classes 30
+performance-schema-max-rwlock-instances 1000000
performance-schema-max-table-handles 100000
performance-schema-max-table-instances 50000
performance-schema-max-thread-classes 50
diff --git a/mysql-test/r/not_partition.result b/mysql-test/r/not_partition.result
index fc3e0d64b5e..2c48f56d578 100644
--- a/mysql-test/r/not_partition.result
+++ b/mysql-test/r/not_partition.result
@@ -21,23 +21,17 @@ Table Op Msg_type Msg_text
test.t1 repair Error Unknown storage engine 'partition'
test.t1 repair error Corrupt
ALTER TABLE t1 REPAIR PARTITION ALL;
-Table Op Msg_type Msg_text
-test.t1 repair Error Unknown storage engine 'partition'
-test.t1 repair error Corrupt
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 CHECK PARTITION ALL;
-Table Op Msg_type Msg_text
-test.t1 check Error Unknown storage engine 'partition'
-test.t1 check error Corrupt
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
-Table Op Msg_type Msg_text
-test.t1 optimize Error Unknown storage engine 'partition'
-test.t1 optimize error Corrupt
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 ANALYZE PARTITION ALL;
-Table Op Msg_type Msg_text
-test.t1 analyze Error Unknown storage engine 'partition'
-test.t1 analyze error Corrupt
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 REBUILD PARTITION ALL;
ERROR 42000: Unknown storage engine 'partition'
+ALTER TABLE t1 TRUNCATE PARTITION ALL;
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 ENGINE Memory;
ERROR 42000: Unknown storage engine 'partition'
ALTER TABLE t1 ADD (new INT);
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index 58c587fe588..fd523168e7c 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -424,6 +424,7 @@ SHOW STATUS LIKE "handler_read%";
Variable_name Value
Handler_read_first 0
Handler_read_key 6
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 55366bd2e07..dfcd9dde73d 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -359,6 +359,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -377,6 +378,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -407,6 +409,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -423,6 +426,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -439,6 +443,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -455,6 +460,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/partition_disabled.result b/mysql-test/r/partition_disabled.result
index df36f56a328..507c6ebe9e9 100644
--- a/mysql-test/r/partition_disabled.result
+++ b/mysql-test/r/partition_disabled.result
@@ -3,7 +3,7 @@ FLUSH TABLES;
SELECT * FROM t1;
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
TRUNCATE TABLE t1;
-ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
+ERROR 42S02: Table 'test.t1' doesn't exist
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 58d014938bf..93cb1617d2f 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,5 +1,103 @@
drop table if exists t1, t2;
#
+# Bug#54747: Deadlock between REORGANIZE PARTITION and
+# SELECT is not detected
+#
+SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency;
+SET GLOBAL innodb_thread_concurrency = 1;
+CREATE TABLE t1
+(user_num BIGINT,
+hours SMALLINT,
+KEY user_num (user_num))
+ENGINE = InnoDB
+PARTITION BY RANGE COLUMNS (hours)
+(PARTITION hour_003 VALUES LESS THAN (3),
+PARTITION hour_004 VALUES LESS THAN (4),
+PARTITION hour_005 VALUES LESS THAN (5),
+PARTITION hour_last VALUES LESS THAN (MAXVALUE));
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+BEGIN;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+# con1
+# SEND a ALTER PARTITION which waits on the ongoing transaction.
+ALTER TABLE t1
+REORGANIZE PARTITION hour_003, hour_004 INTO
+(PARTITION oldest VALUES LESS THAN (4));
+# Connection default wait until the ALTER is in 'waiting for table...'
+# state and then continue the transaction by trying a SELECT
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+COMMIT;
+# con1, reaping ALTER.
+# Disconnecting con1 and switching to default. Cleaning up.
+SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
+DROP TABLE t1;
+#
+# Bug#50418: DROP PARTITION does not interact with transactions
+#
+CREATE TABLE t1 (
+id INT AUTO_INCREMENT NOT NULL,
+name CHAR(50) NOT NULL,
+myDate DATE NOT NULL,
+PRIMARY KEY (id, myDate),
+INDEX idx_date (myDate)
+) ENGINE=InnoDB
+PARTITION BY RANGE ( TO_DAYS(myDate) ) (
+PARTITION p0 VALUES LESS THAN (734028),
+PARTITION p1 VALUES LESS THAN (734029),
+PARTITION p2 VALUES LESS THAN (734030),
+PARTITION p3 VALUES LESS THAN MAXVALUE
+) ;
+INSERT INTO t1 VALUES
+(NULL, 'Lachlan', '2009-09-13'),
+(NULL, 'Clint', '2009-09-13'),
+(NULL, 'John', '2009-09-14'),
+(NULL, 'Dave', '2009-09-14'),
+(NULL, 'Jeremy', '2009-09-15'),
+(NULL, 'Scott', '2009-09-15'),
+(NULL, 'Jeff', '2009-09-16'),
+(NULL, 'Joe', '2009-09-16');
+SET AUTOCOMMIT=0;
+SELECT * FROM t1 FOR UPDATE;
+id name myDate
+1 Lachlan 2009-09-13
+2 Clint 2009-09-13
+3 John 2009-09-14
+4 Dave 2009-09-14
+5 Jeremy 2009-09-15
+6 Scott 2009-09-15
+7 Jeff 2009-09-16
+8 Joe 2009-09-16
+UPDATE t1 SET name = 'Mattias' WHERE id = 7;
+SELECT * FROM t1 WHERE id = 7;
+id name myDate
+7 Mattias 2009-09-16
+# Connection con1
+SET lock_wait_timeout = 1;
+# After the patch it will wait and fail on timeout.
+ALTER TABLE t1 DROP PARTITION p3;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SHOW WARNINGS;
+Level Code Message
+Error 1205 Lock wait timeout exceeded; try restarting transaction
+# Connection default
+SELECT * FROM t1;
+id name myDate
+1 Lachlan 2009-09-13
+2 Clint 2009-09-13
+3 John 2009-09-14
+4 Dave 2009-09-14
+5 Jeremy 2009-09-15
+6 Scott 2009-09-15
+7 Mattias 2009-09-16
+8 Joe 2009-09-16
+# No changes.
+COMMIT;
+DROP TABLE t1;
+#
# Bug#51830: Incorrect partition pruning on range partition (regression)
#
CREATE TABLE t1 (a INT NOT NULL)
diff --git a/mysql-test/r/partition_not_blackhole.result b/mysql-test/r/partition_not_blackhole.result
new file mode 100644
index 00000000000..dc0339f8c48
--- /dev/null
+++ b/mysql-test/r/partition_not_blackhole.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+#
+# Bug#46086: crash when dropping a partitioned table and
+# the original engine is disabled
+# Copy a .frm and .par file which was created with:
+# create table `t1` (`id` int primary key) engine=blackhole
+# partition by key () partitions 1;
+SHOW TABLES;
+Tables_in_test
+t1
+SHOW CREATE TABLE t1;
+ERROR HY000: Incorrect information in file: './test/t1.frm'
+DROP TABLE t1;
+ERROR 42S02: Unknown table 't1'
+t1.frm
+t1.par
diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result
index a080f7ff9f7..d37281d9638 100644
--- a/mysql-test/r/partition_range.result
+++ b/mysql-test/r/partition_range.result
@@ -938,3 +938,47 @@ select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 200703
sum(count)
579
drop table 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/r/partition_truncate.result b/mysql-test/r/partition_truncate.result
index 8f594a319df..66c0cd3d9da 100644
--- a/mysql-test/r/partition_truncate.result
+++ b/mysql-test/r/partition_truncate.result
@@ -16,3 +16,11 @@ subpartitions 1
alter table t1 truncate partition sp1;
ERROR HY000: Incorrect partition name
drop table t1;
+create table t1 (a int);
+insert into t1 values (1), (3), (8);
+alter table t1 truncate partition p0;
+ERROR HY000: Partition management on a not partitioned table is not possible
+select count(*) from t1;
+count(*)
+3
+drop table t1;
diff --git a/mysql-test/r/ps_ddl.result b/mysql-test/r/ps_ddl.result
index 9752c5160a6..76d6c735f43 100644
--- a/mysql-test/r/ps_ddl.result
+++ b/mysql-test/r/ps_ddl.result
@@ -1833,7 +1833,6 @@ SUCCESS
select * from t2;
a
1
-1
execute stmt;
Warnings:
Note 1050 Table 't2' already exists
@@ -1843,8 +1842,6 @@ SUCCESS
select * from t2;
a
1
-1
-1
drop table t2;
create temporary table t2 (a varchar(10));
execute stmt;
@@ -1852,7 +1849,6 @@ Warnings:
Note 1050 Table 't2' already exists
select * from t2;
a
-1
call p_verify_reprepare_count(1);
SUCCESS
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 112a86e0c88..f209e401764 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -701,6 +701,7 @@ drop table t1,t2,t3,t4;
set query_cache_wlock_invalidate=1;
create table t1 (a int not null);
create table t2 (a int not null);
+create view v1 as select * from t1;
select * from t1;
a
select * from t2;
@@ -713,6 +714,17 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
unlock table;
+select * from t1;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+lock table v1 write;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+unlock table;
+drop view v1;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
CREATE TABLE t1 (id INT PRIMARY KEY);
@@ -853,7 +865,7 @@ Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
-Qcache_inserts 18
+Qcache_inserts 19
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 6
@@ -866,7 +878,7 @@ Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
-Qcache_inserts 19
+Qcache_inserts 20
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 7
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 4587a60ca0d..62acb2a7710 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1654,47 +1654,16 @@ a b
1 1
DROP TABLE t1;
#
-# Bug#50939: Loose Index Scan unduly relies on engine to remember range
-# endpoints
+# Bug #54802: 'NOT BETWEEN' evaluation is incorrect
#
-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;
+CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key));
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
+EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL c_key NULL NULL NULL 3 Using where
+SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
+c_key c_notkey
+1 1
+3 3
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/rowid_order_innodb.result b/mysql-test/r/rowid_order_innodb.result
index e0796cd7ab5..dc339304041 100644
--- a/mysql-test/r/rowid_order_innodb.result
+++ b/mysql-test/r/rowid_order_innodb.result
@@ -15,7 +15,7 @@ insert into t1 values (-5, 1, 1),
(10, 1, 1);
explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 4 Using sort_union(key1,key2); Using where
+1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 5 Using sort_union(key1,key2); Using where
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
pk1 key1 key2
-100 1 1
diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result
index 853c3bcf575..809d652053e 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -16,21 +16,19 @@ drop schema foo;
# Bug #48940 MDL deadlocks against mysql_rm_db
#
DROP SCHEMA IF EXISTS schema1;
-DROP SCHEMA IF EXISTS schema2;
# Connection default
CREATE SCHEMA schema1;
-CREATE SCHEMA schema2;
CREATE TABLE schema1.t1 (a INT);
SET autocommit= FALSE;
INSERT INTO schema1.t1 VALUES (1);
# Connection 2
DROP SCHEMA schema1;
# Connection default
-ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
+ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
+Got one of the listed errors
SET autocommit= TRUE;
# Connection 2
# Connection default
-DROP SCHEMA schema2;
#
# Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
#
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index b193a269288..e8628d72a46 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4338,6 +4338,7 @@ SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result
index 921d308097c..72419c6ec9d 100644
--- a/mysql-test/r/single_delete_update.result
+++ b/mysql-test/r/single_delete_update.result
@@ -25,6 +25,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -41,6 +42,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -74,6 +76,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -90,6 +93,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 5
@@ -120,6 +124,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -136,6 +141,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -170,6 +176,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -186,6 +193,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -214,6 +222,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -230,6 +239,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -256,6 +266,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -272,6 +283,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -301,6 +313,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 4
@@ -322,6 +335,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 8
@@ -357,6 +371,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -373,6 +388,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -406,6 +422,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -422,6 +439,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 5
@@ -464,6 +482,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -486,6 +505,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -502,6 +522,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -536,6 +557,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -552,6 +574,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 5
@@ -590,6 +613,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -606,6 +630,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 5
@@ -641,6 +666,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -657,6 +683,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -691,6 +718,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -707,6 +735,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 5
@@ -735,6 +764,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -751,6 +781,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -778,6 +809,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -794,6 +826,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -824,6 +857,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 4
@@ -845,6 +879,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 8
@@ -884,6 +919,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -900,6 +936,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 5
@@ -938,6 +975,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -954,6 +992,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 5
@@ -990,6 +1029,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -1012,6 +1052,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -1028,6 +1069,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 5
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result
index a4933ee9800..32d0e39c5af 100644
--- a/mysql-test/r/sp-destruct.result
+++ b/mysql-test/r/sp-destruct.result
@@ -134,3 +134,19 @@ Warning 1405 Failed to revoke all privileges to dropped routine
# Restore the procs_priv table
RENAME TABLE procs_priv_backup TO mysql.procs_priv;
FLUSH TABLE mysql.procs_priv;
+#
+# Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from
+# 5.1.50 to 5.5.6".
+#
+drop database if exists mysqltest;
+# Backup mysql.proc.
+flush table mysql.proc;
+create database mysqltest;
+# Corrupt mysql.proc to make it unusable by current version of server.
+alter table mysql.proc drop column type;
+# The below statement should not cause assertion failure.
+drop database mysqltest;
+Warnings:
+Error 1547 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
+# Restore mysql.proc.
+drop table mysql.proc;
diff --git a/mysql-test/r/sp-lock.result b/mysql-test/r/sp-lock.result
index a7823175b3c..0d3e87f17e2 100644
--- a/mysql-test/r/sp-lock.result
+++ b/mysql-test/r/sp-lock.result
@@ -148,12 +148,12 @@ f1()
# Sending 'drop procedure p1'...
drop procedure p1;
# --> connection con2
-# Waitng for 'drop procedure t1' to get blocked on MDL lock...
+# Waiting for 'drop procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -174,12 +174,12 @@ f1()
# Sending 'create procedure p1'...
create procedure p1() begin end;
# --> connection con2
-# Waitng for 'create procedure t1' to get blocked on MDL lock...
+# Waiting for 'create procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -200,12 +200,12 @@ f1()
# Sending 'alter procedure p1'...
alter procedure p1 contains sql;
# --> connection con2
-# Waitng for 'alter procedure t1' to get blocked on MDL lock...
+# Waiting for 'alter procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -226,12 +226,12 @@ f1()
# Sending 'drop function f1'...
drop function f1;
# --> connection con2
-# Waitng for 'drop function f1' to get blocked on MDL lock...
+# Waiting for 'drop function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -252,12 +252,12 @@ f1()
# Sending 'create function f1'...
create function f1() returns int return 2;
# --> connection con2
-# Waitng for 'create function f1' to get blocked on MDL lock...
+# Waiting for 'create function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -279,12 +279,12 @@ f1()
# Sending 'alter function f1'...
alter function f1 contains sql;
# --> connection con2
-# Waitng for 'alter function f1' to get blocked on MDL lock...
+# Waiting for 'alter function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -360,7 +360,7 @@ insert into t1 (a) values (1);
# Sending 'drop function f1'
drop function f1;
# --> connection con2
-# Waitng for 'drop function f1' to get blocked on MDL lock...
+# Waiting for 'drop function f1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
@@ -379,7 +379,7 @@ a
# Sending 'drop function f1'
drop function f1;
# --> connection con2
-# Waitng for 'drop function f1' to get blocked on MDL lock...
+# Waiting for 'drop function f1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
@@ -403,7 +403,7 @@ a
# Sending 'drop procedure p1'
drop procedure p1;
# --> connection con2
-# Waitng for 'drop procedure p1' to get blocked on MDL lock...
+# Waiting for 'drop procedure p1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
@@ -424,7 +424,7 @@ insert into t1 (a) values (3);
# Sending 'drop function f2'
drop function f2;
# --> connection con2
-# Waitng for 'drop function f2' to get blocked on MDL lock...
+# Waiting for 'drop function f2' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
@@ -479,11 +479,11 @@ f2()
# Sending 'drop function f1'...
drop function f1;
# --> connection con2
-# Waitng for 'drop function f1' to get blocked on MDL lock...
+# Waiting for 'drop function f1' to get blocked on MDL lock...
# Sending 'drop function f2'...
drop function f2;
# --> connection default
-# Waitng for 'drop function f2' to get blocked on MDL lock...
+# Waiting for 'drop function f2' to get blocked on MDL lock...
rollback to savepoint sv;
# --> connection con2
# Reaping 'drop function f2'...
@@ -537,10 +537,10 @@ f1()
# Sending 'alter function f1 ...'...
alter function f1 comment "comment";
# --> connection con2
-# Waitng for 'alter function f1 ...' to get blocked on MDL lock...
+# Waiting for 'alter function f1 ...' to get blocked on MDL lock...
# Sending 'call p1()'...
call p1();
-# Waitng for 'call p1()' to get blocked on MDL lock on f1...
+# Waiting for 'call p1()' to get blocked on MDL lock on f1...
# Let 'alter function f1 ...' go through...
commit;
# --> connection con1
@@ -573,7 +573,7 @@ f1()
# Sending 'alter function f1 ...'...
alter function f1 comment "comment";
# --> connection con2
-# Waitng for 'alter function f1 ...' to get blocked on MDL lock...
+# Waiting for 'alter function f1 ...' to get blocked on MDL lock...
#
# We just mention p1() in the body of f2() to make
# sure that p1() is prelocked for f2().
@@ -595,7 +595,7 @@ select f2() into @var;
end|
# Sending 'call p1()'...
call p1();
-# Waitng for 'call p1()' to get blocked on MDL lock on f1...
+# Waiting for 'call p1()' to get blocked on MDL lock on f1...
# Let 'alter function f1 ...' go through...
commit;
# --> connection con1
@@ -634,7 +634,7 @@ get_lock("30977", 0)
# Sending 'select f3()'...
select f3();
# --> connection con1
-# Waitng for 'select f3()' to get blocked on the user level lock...
+# Waiting for 'select f3()' to get blocked on the user level lock...
# Do something to change the cache version.
create function f4() returns int return 4;
drop function f4;
diff --git a/mysql-test/r/sp-threads.result b/mysql-test/r/sp-threads.result
index a14d099c673..9b458e25615 100644
--- a/mysql-test/r/sp-threads.result
+++ b/mysql-test/r/sp-threads.result
@@ -35,7 +35,7 @@ call bug9486();
show processlist;
Id User Host db Command Time State Info
# root localhost test Sleep # NULL
-# root localhost test Query # Waiting for table update t1, t2 set val= 1 where id1=id2
+# root localhost test Query # Waiting for table metadata lock update t1, t2 set val= 1 where id1=id2
# root localhost test Query # NULL show processlist
# root localhost test Sleep # NULL
unlock tables;
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 586e2e7822b..2962a12d9a2 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -113,6 +113,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index dd4bf599ad0..2e638ddb9ab 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -60,6 +60,27 @@ FROM t3 WHERE 1 = 0 GROUP BY 1;
DROP TABLE t1,t2,t3;
End of 5.0 tests.
#
+# Bug#54568: create view cause Assertion failed: 0,
+# file .\item_subselect.cc, line 836
+#
+EXPLAIN SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+DESCRIBE SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+# None of the below should crash
+CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
+CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
+DROP VIEW v1, v2;
+#
+# End of 5.1 tests.
+#
+#
# Bug#53236 Segfault in DTCollation::set(DTCollation&)
#
CREATE TABLE t1 (
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 36d82e4045f..b9b1c94ce1a 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -1420,9 +1420,7 @@ create trigger t1_ai after insert on t1 for each row set @a := 7;
create table t2 (j int);
insert into t2 values (1), (2);
set @a:="";
-create table if not exists t1 select * from t2;
-Warnings:
-Note 1050 Table 't1' already exists
+insert into t1 select * from t2;
select * from t1;
i
7
@@ -1434,9 +1432,7 @@ drop trigger t1_bi;
drop trigger t1_ai;
create table t3 (isave int);
create trigger t1_bi before insert on t1 for each row insert into t3 values (new.i);
-create table if not exists t1 select * from t2;
-Warnings:
-Note 1050 Table 't1' already exists
+insert into t1 select * from t2;
select * from t1;
i
7
@@ -1622,10 +1618,8 @@ After DELETE, old=REPLACE, inserting a new key
After INSERT, new=REPLACE, deleting the duplicate
truncate t1;
truncate t1_op_log;
-create table if not exists t1
+insert into t1
select NULL, "CREATE TABLE ... SELECT, inserting a new key";
-Warnings:
-Note 1050 Table 't1' already exists
set @id=last_insert_id();
select * from t1;
id operation
@@ -1635,10 +1629,8 @@ operation
Before INSERT, new=CREATE TABLE ... SELECT, inserting a new key
After INSERT, new=CREATE TABLE ... SELECT, inserting a new key
truncate t1_op_log;
-create table if not exists t1 replace
+replace into t1
select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
-Warnings:
-Note 1050 Table 't1' already exists
select * from t1;
id operation
1 CREATE TABLE ... REPLACE SELECT, deleting a duplicate key
@@ -1817,10 +1809,8 @@ After DELETE, old=REPLACE, inserting a new key
After INSERT, new=REPLACE, deleting the duplicate
truncate t1;
truncate t1_op_log;
-create table if not exists v1
+insert into v1
select NULL, "CREATE TABLE ... SELECT, inserting a new key";
-Warnings:
-Note 1050 Table 'v1' already exists
set @id=last_insert_id();
select * from t1;
id operation
@@ -1830,10 +1820,8 @@ operation
Before INSERT, new=CREATE TABLE ... SELECT, inserting a new key
After INSERT, new=CREATE TABLE ... SELECT, inserting a new key
truncate t1_op_log;
-create table if not exists v1 replace
+replace into v1
select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
-Warnings:
-Note 1050 Table 'v1' already exists
select * from t1;
id operation
1 CREATE TABLE ... REPLACE SELECT, deleting a duplicate key
@@ -2083,7 +2071,8 @@ BEGIN
UPDATE a_nonextisting_table SET a = 1;
END//
CREATE TABLE IF NOT EXISTS t2 ( a INT, b INT ) SELECT a, b FROM t1;
-ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist
+Warnings:
+Note 1050 Table 't2' already exists
SELECT * FROM t2;
a b
DROP TABLE t1, t2;
diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result
index a9c3cae1770..909db576b27 100644
--- a/mysql-test/r/type_bit_innodb.result
+++ b/mysql-test/r/type_bit_innodb.result
@@ -233,7 +233,7 @@ a+0 b+0
127 403
explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 2 NULL 19 Using where; Using index; Using filesort
+1 SIMPLE t1 range a a 2 NULL 27 Using where; Using index; Using filesort
select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
a+0 b+0
44 307
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 2080f4e8b61..33fc4333d1c 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -428,7 +428,7 @@ ERROR 42000: Incorrect usage/placement of 'SQL_CALC_FOUND_ROWS'
create temporary table t1 select a from t1 union select a from t2;
drop temporary table t1;
create table t1 select a from t1 union select a from t2;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR 42S01: Table 't1' already exists
select a from t1 union select a from t2 order by t2.a;
ERROR 42S22: Unknown column 't2.a' in 'order clause'
drop table t1,t2;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 05ab1b71018..54170ae3dad 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -273,6 +273,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -284,6 +285,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 2
@@ -294,6 +296,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -304,6 +307,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 1
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -315,6 +319,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
@@ -368,6 +373,7 @@ show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 1
@@ -405,6 +411,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -415,6 +422,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -424,6 +432,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 3
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -433,6 +442,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 3
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/std_data/parts/t1_blackhole.frm b/mysql-test/std_data/parts/t1_blackhole.frm
new file mode 100644
index 00000000000..be77b7a041a
--- /dev/null
+++ b/mysql-test/std_data/parts/t1_blackhole.frm
Binary files differ
diff --git a/mysql-test/std_data/parts/t1_blackhole.par b/mysql-test/std_data/parts/t1_blackhole.par
new file mode 100644
index 00000000000..6528edf190c
--- /dev/null
+++ b/mysql-test/std_data/parts/t1_blackhole.par
Binary files differ
diff --git a/mysql-test/std_data/server8k-cert.pem b/mysql-test/std_data/server8k-cert.pem
index 06e118cf034..e71ba5722b9 100644
--- a/mysql-test/std_data/server8k-cert.pem
+++ b/mysql-test/std_data/server8k-cert.pem
@@ -1,125 +1,51 @@
-Certificate:
- Data:
- Version: 1 (0x0)
- Serial Number: 1048579 (0x100003)
- Signature Algorithm: md5WithRSAEncryption
- Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
- Validity
- Not Before: Jan 29 12:01:53 2010 GMT
- Not After : Jan 28 12:01:53 2015 GMT
- Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=server
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- Public-Key: (8192 bit)
- Modulus:
- 00:ca:aa:1d:c4:11:ec:91:f0:c7:ff:5f:90:92:fc:
- 40:0c:5e:b7:3d:00:c5:20:d5:0f:89:31:07:d7:41:
- 4c:8b:60:80:aa:38:14:de:93:6b:9c:74:88:41:68:
- b5:02:41:01:2d:86:a2:7a:95:53:5e:7b:67:2f:6c:
- 1e:29:51:f9:44:fd:4a:80:be:b2:23:a1:3e:1b:38:
- cf:88:c4:71:ee:f8:6b:41:c5:2d:c0:c3:52:ac:59:
- 7d:81:34:19:95:32:b8:9a:51:b6:41:36:d4:c4:a1:
- ae:84:e6:38:b9:e8:bf:96:be:19:7a:6b:77:4d:e0:
- de:e6:b3:b6:6b:bc:3d:dd:68:bc:4b:c4:eb:f5:36:
- 93:ed:56:a2:15:50:8a:10:e8:d6:22:ed:6c:b1:cd:
- c3:18:c9:f6:0a:e1:de:61:65:62:d6:14:41:8c:b5:
- fb:14:68:c1:cf:12:5d:41:21:9d:57:11:43:7d:bb:
- 43:2c:21:bb:c3:44:7d:a8:cf:1f:c3:71:75:b5:47:
- c2:7d:ce:38:3c:73:64:9e:15:d8:a7:27:cf:bd:40:
- c8:45:08:e3:c8:39:a8:0b:8e:c2:5b:7b:f1:47:91:
- 12:91:cc:e1:00:e0:94:5b:bd:32:e4:0c:8d:c3:be:
- cc:76:32:52:12:69:b0:18:e0:b0:c2:76:34:5a:5f:
- 79:d9:f6:81:9d:02:0a:61:69:1c:33:ce:49:fa:76:
- 03:1e:07:5b:27:0b:bf:34:9e:34:96:b8:03:9b:50:
- 3a:6a:2f:17:7a:14:cf:65:63:00:37:52:a8:73:ce:
- 4b:14:40:f4:d2:9a:56:54:33:b8:77:2e:42:5b:8f:
- ec:1f:18:f4:ad:ab:8a:4a:8d:6d:70:25:f3:58:e7:
- cb:66:51:14:7d:16:f4:eb:6d:56:76:76:51:6e:d6:
- 1d:da:d3:8d:c0:64:5a:67:4e:af:e2:bf:33:d1:b8:
- f6:2a:fc:57:87:a7:35:5e:80:c9:ac:fc:87:c9:71:
- 17:91:bf:b7:4d:a3:ed:3c:1b:27:f4:66:a0:f9:46:
- 03:27:cc:ea:80:f6:4b:40:f6:41:94:cd:bd:0a:b3:
- ef:26:be:de:6f:69:ae:0f:3f:1c:55:63:33:90:9b:
- ed:ca:5a:12:4d:de:4b:06:c2:a2:92:b0:42:3d:31:
- af:a4:15:12:15:f8:8a:e9:88:8d:cf:fd:85:66:50:
- 6f:11:f1:9f:48:f3:b5:ba:9d:86:68:24:a2:5d:a8:
- 7c:54:42:fa:d8:b5:c5:f2:dd:0e:0f:d0:68:e4:54:
- 7e:c5:b9:a0:9b:65:2d:77:f4:8f:b9:30:0a:d5:86:
- 5c:ed:c9:7c:d1:da:9d:0d:63:50:ee:e5:1e:92:63:
- cc:a2:0c:e8:4a:96:02:4d:dc:8f:df:7c:8f:08:18:
- a8:30:88:d7:af:89:ad:fc:57:4b:10:f9:f1:cb:48:
- e8:b6:3b:c8:3f:fc:c2:d3:d1:4a:10:3c:1b:6b:64:
- dc:e5:65:1e:5b:b2:da:b1:e2:24:97:8f:ee:c0:4b:
- 8e:18:83:7c:17:a6:3c:45:b3:60:06:23:f2:2f:18:
- 13:9e:17:8a:c6:72:79:8c:4d:04:f3:9d:ea:e0:25:
- d3:33:8c:1e:11:47:63:1f:a5:45:3f:bd:85:b3:fe:
- a5:68:ee:48:b7:0c:a4:c9:7f:72:d0:75:66:9b:6a:
- f9:a0:50:f3:a8:59:6d:a3:dd:38:4f:70:2b:bb:ff:
- 92:2e:71:ab:ef:e9:00:ed:0d:d1:b4:6f:f0:8e:b2:
- 09:fb:4d:61:0d:d9:10:d5:54:11:cd:03:94:84:fd:
- a8:68:e4:45:6e:1e:6a:1e:2f:85:a1:6d:f5:b6:c0:
- f1:ee:f7:36:e9:fe:c2:f7:ad:cc:13:46:5b:88:42:
- f0:2d:1f:b5:0e:7e:b5:2b:e4:8d:ab:b9:87:30:6a:
- 3d:12:f4:ad:f3:1c:ac:cc:1a:48:29:2a:96:7b:80:
- 00:0b:6e:59:87:bf:a3:ca:70:99:1b:1c:fd:72:3d:
- b2:d3:94:4a:cf:55:75:be:1f:40:ec:55:35:48:2d:
- 55:f0:00:da:3c:b0:60:ba:11:32:66:54:0b:be:06:
- a4:5e:b7:c9:59:bb:4d:f4:92:06:26:48:6e:c2:12:
- d4:7c:f0:20:b8:a2:e1:bc:6a:b6:19:0e:37:47:55:
- c9:f2:49:0d:96:75:a2:84:64:bf:34:fc:be:b2:41:
- e4:f5:88:eb:e1:b7:26:a5:e5:41:c2:20:0c:f6:e2:
- a8:a5:e7:76:54:a5:fb:4b:80:05:7d:18:85:7a:ba:
- bc:b7:ad:c0:2f:60:85:cc:15:12:1c:2f:0a:9e:f3:
- 7c:40:cf:f4:3e:23:d2:95:ca:d0:06:58:52:f0:84:
- d8:0f:3d:eb:ff:12:68:94:79:8f:be:40:29:5f:98:
- c8:90:6c:05:2f:99:8c:2a:63:78:1f:23:b1:29:c5:
- e7:49:c9:b2:92:0f:53:0b:d5:71:28:17:c2:19:bf:
- 60:bf:7c:87:a8:ab:c1:f4:0a:c1:b8:d2:68:ee:c1:
- ce:a7:13:13:17:6d:24:5d:a2:37:a6:d7:7d:48:8b:
- 2b:74:2d:40:2e:ca:19:d5:b6:3e:6c:42:71:fa:cf:
- 85:87:f9:de:80:73:8b:89:f4:70:f0:d8:d7:ff:40:
- 41:9c:c7:15:6d:9b:6e:4c:b5:52:02:99:79:32:73:
- ca:26:a0:ac:31:6f:c4:b0:f5:da:bb:c2:1f:e0:9f:
- 44:ba:25:f7:9f
- Exponent: 65537 (0x10001)
- Signature Algorithm: md5WithRSAEncryption
- 08:75:dc:b9:3f:aa:b6:7e:81:7a:39:d1:ee:ed:44:b6:ce:1b:
- 37:c4:4c:19:d0:66:e6:eb:b5:4f:2a:ef:95:58:64:21:55:01:
- 12:30:ac:8a:95:d1:06:de:29:46:a4:f1:7d:7f:b0:1e:d2:4e:
- fb:f6:fa:9a:74:be:85:62:db:0b:82:90:58:62:c5:5f:f1:80:
- 02:9f:c5:fb:f3:6b:b0:b4:3b:04:b1:e5:53:c2:d0:00:a1:1a:
- 9d:65:60:6f:73:98:67:e0:9c:c8:12:94:79:59:bf:43:7b:f5:
- 77:c8:8f:df:b1:cd:11:1c:01:19:99:c2:22:42:f7:41:ae:b4:
- b8:1a
-----BEGIN CERTIFICATE-----
-MIIFfDCCBOUCAxAAAzANBgkqhkiG9w0BAQQFADBEMQswCQYDVQQGEwJTRTEQMA4G
-A1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwg
-QUIwHhcNMTAwMTI5MTIwMTUzWhcNMTUwMTI4MTIwMTUzWjBDMQswCQYDVQQGEwJT
-RTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxDzANBgNVBAMT
-BnNlcnZlcjCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBAMqqHcQR7JHw
-x/9fkJL8QAxetz0AxSDVD4kxB9dBTItggKo4FN6Ta5x0iEFotQJBAS2GonqVU157
-Zy9sHilR+UT9SoC+siOhPhs4z4jEce74a0HFLcDDUqxZfYE0GZUyuJpRtkE21MSh
-roTmOLnov5a+GXprd03g3uaztmu8Pd1ovEvE6/U2k+1WohVQihDo1iLtbLHNwxjJ
-9grh3mFlYtYUQYy1+xRowc8SXUEhnVcRQ327Qywhu8NEfajPH8NxdbVHwn3OODxz
-ZJ4V2Kcnz71AyEUI48g5qAuOwlt78UeREpHM4QDglFu9MuQMjcO+zHYyUhJpsBjg
-sMJ2NFpfedn2gZ0CCmFpHDPOSfp2Ax4HWycLvzSeNJa4A5tQOmovF3oUz2VjADdS
-qHPOSxRA9NKaVlQzuHcuQluP7B8Y9K2rikqNbXAl81jny2ZRFH0W9OttVnZ2UW7W
-HdrTjcBkWmdOr+K/M9G49ir8V4enNV6Ayaz8h8lxF5G/t02j7TwbJ/RmoPlGAyfM
-6oD2S0D2QZTNvQqz7ya+3m9prg8/HFVjM5Cb7cpaEk3eSwbCopKwQj0xr6QVEhX4
-iumIjc/9hWZQbxHxn0jztbqdhmgkol2ofFRC+ti1xfLdDg/QaORUfsW5oJtlLXf0
-j7kwCtWGXO3JfNHanQ1jUO7lHpJjzKIM6EqWAk3cj998jwgYqDCI16+JrfxXSxD5
-8ctI6LY7yD/8wtPRShA8G2tk3OVlHluy2rHiJJeP7sBLjhiDfBemPEWzYAYj8i8Y
-E54XisZyeYxNBPOd6uAl0zOMHhFHYx+lRT+9hbP+pWjuSLcMpMl/ctB1Zptq+aBQ
-86hZbaPdOE9wK7v/ki5xq+/pAO0N0bRv8I6yCftNYQ3ZENVUEc0DlIT9qGjkRW4e
-ah4vhaFt9bbA8e73Nun+wvetzBNGW4hC8C0ftQ5+tSvkjau5hzBqPRL0rfMcrMwa
-SCkqlnuAAAtuWYe/o8pwmRsc/XI9stOUSs9Vdb4fQOxVNUgtVfAA2jywYLoRMmZU
-C74GpF63yVm7TfSSBiZIbsIS1HzwILii4bxqthkON0dVyfJJDZZ1ooRkvzT8vrJB
-5PWI6+G3JqXlQcIgDPbiqKXndlSl+0uABX0YhXq6vLetwC9ghcwVEhwvCp7zfEDP
-9D4j0pXK0AZYUvCE2A896/8SaJR5j75AKV+YyJBsBS+ZjCpjeB8jsSnF50nJspIP
-UwvVcSgXwhm/YL98h6irwfQKwbjSaO7BzqcTExdtJF2iN6bXfUiLK3QtQC7KGdW2
-PmxCcfrPhYf53oBzi4n0cPDY1/9AQZzHFW2bbky1UgKZeTJzyiagrDFvxLD12rvC
-H+CfRLol958CAwEAATANBgkqhkiG9w0BAQQFAAOBgQAIddy5P6q2foF6OdHu7US2
-zhs3xEwZ0Gbm67VPKu+VWGQhVQESMKyKldEG3ilGpPF9f7Ae0k779vqadL6FYtsL
-gpBYYsVf8YACn8X782uwtDsEseVTwtAAoRqdZWBvc5hn4JzIEpR5Wb9De/V3yI/f
-sc0RHAEZmcIiQvdBrrS4Gg==
+MIIJFDCCBPwCAQEwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCU0UxEDAOBgNV
+BAgTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMQ0wCwYDVQQLEwRUZXN0MQsw
+CQYDVQQDEwJDQTAeFw0xMDA3MjgxNDA3MjhaFw0xODEwMTQxNDA3MjhaMFIxCzAJ
+BgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQjEN
+MAsGA1UECxMEVGVzdDEPMA0GA1UEAxMGc2VydmVyMIIEIjANBgkqhkiG9w0BAQEF
+AAOCBA8AMIIECgKCBAEA6h3v1OWb9I9U/Z8diBu/xYGS8NCTD3ZESboHxVI2qSEC
+PgxNNcG8Lh0ktQdgYcOe64MnDTZX0Bibm47hoDldrAlTSffFxQhylqBBoXxDF+Lr
+hXIqCz7K0PsK+bYusL9ezJ7PETDnCT7oy95q4GXbKsutbNsm9if4ZE41gs2KnoU2
+DA7kvMmkKojrMIL4+BqTXA20LLo0iSbgvUTvpSJw4u96BeyzMNnxK2wP5vvTtUo5
+hACbfU87YjaSKs+q2VXCzfyYGZk1L1xk5GUI0bP+jutf1dDzNttW2/q2Nf5rxx09
+Gh/GwmOnEk1O7cOZ8VQCsOHirIM39NuSARsY6Y3G5XM4k2W4nxyR/RtdG9bvs/33
+aGsZ5V5yp7WSs8s9HHwaCPSsUiLKckQ7uA0TTRgbeweMrrLKovG57jsbBBB8pQD4
+PRd31qgxCdstWXHiWwRyI8vOLWENPXPFqA/rJwwqNdWTogy38aqVXxGYR8PIwjA2
+OaIwFjwGZcsPNLqw6bgAN8O2UBqZHWiMF8mi7brvioDvAIufZuqa2SqT/At45H83
+psQ6R4FsxZt6SAK7EsdPo8OYTrY1i4iPZd/eKhnEu2srEZgsKRwY5H1mvDH5fWCc
+HSFu07sWmlmK6Or65Fsa0IaKLJiQDVVETd6xrI0wkM4AOcbKDrS7aywJ426dopbs
++LFdt4N0cdII4gBgJAfLuuA2yrDXRq4P6cgpVMy0R+0dEYE8zzm8zf1a+Ud273LS
+9+LB+LJKwqbW8nOPBoiekimIKfJYoOA4+C/mAjsYl1sVjjEhXJAs9S9L2UvnUk1P
+sZi4UKHI6eAIEl7VM1sQ4GbdZ0px2dF2Ax7pGkhD+DLpYyYkCprharKZdmuUNLUd
+NhXxi/HSEiE+Uy+o8RIzmH7LuROl/ZgnfHjJEiBLt2qPvwrwYd4c3XuXWs4YsWfV
+JTt8Mx2ihgVcdGy9//shCSmgJwR1oWrhgC10AEL2fKeRnYUal1i+IxFPp7nb8uwx
+UADgR0cY4A3qR/JP489QFIcxBTVs65De+Bq3ecnujk6yeGpD9iptonq4Y8uNZMc1
+kOE7GiFGwR4EufT5SEMh+tUkjth2r+842vmZZuxrVQaohDiATmIJA07W51zKH+nQ
+uw4qVKnAhPaDLCLc7YMIH9JcmkeQX0nf8/S2O2WYDH8glVDi5hfW08tCmV647vRY
+nTIywUTO0lFpz7M+VyMNaJ6yXU6biBV5hLAI8C5ldr/SWI789W2+ebBaJ9gfK+PT
+trohFSK37GcoSH4V6qSLJHCBASEsiddqHIHMLJZRYD+B6J3tLhjVUM43u+MEGbFT
+d33ZDke/WzLTExWkaOv36e67gDBmgDuj9yroq3wGfwIDAQABMA0GCSqGSIb3DQEB
+BAUAA4IEAQCc9RBhRbuWlmRZPZkqIdi5/+enyjoMmOa6ryJPxFSP8D2jrlHgQsk1
++GsJmPFT3rwWfoGAQu/aeSX4sp8OhKVJtqNA6MJrGYnZIMolgYa1wZPbkjJsdEfi
+UsZdIB0n2+KA0xwEdGPdkGCfNPBtOg557DkcyEvsIZ9ELp4Pp2XzWRhyFGasJZc4
+YwgD/3K2rpOPZoMkBKeKqV19j41OfLKGBVyuaqzitbu9+KT4RU1ibr2a+UuFCwdT
+oqyN7bfWXjcjXOMkxCsOmLfKmqQxs7TEOVrYPTdYjamDxLy/e5g5FgoCxGY8iil0
++YFLZyH6eEx/Os9DlG/M3O1MeRD9U97CdsphbDVZIDyWw5xeX8qQHJe0KSprAgiG
+TLhTZHeyrKujQCQS1oFFmNy4gSqXt0j1/6/9T80j6HeyjiiYEaEQK9YLTAjRoA7W
+VN8wtHI5F3RlNOVQEJks/bjdlpLL3VhaWtfewGh/mXRGcow84cgcsejMexmhreHm
+JfTUl9+X1IFFxGq2/606A9ROQ7kN/s4rXu7/TiMODXI/kZijoWd2SCc7Z0YWoNo7
+IRKkmZtrsflJbObEuK2Jk59uqzSxyQOBId8qtbPo8qJJyHGV5GCp34g4x67BxJBo
+h1iyVMamBAS5Ip1ejghuROrB8Hit8NhAZApXju62btJeXLX+mQayXb/wC/IXNJJD
+83tXiLfZgs6GzLAq7+KW/64sZSvj87CPiNtxkvjchAvyr+fhbBXCrf4rlOjJE6SH
+Je2/Jon7uqijncARGLBeYUT0Aa6k1slpXuSKxDNt7EIkP21kDZ5/OJ0Y1u587KVB
+dEhuDgNf2/8ij7gAQBwBoZMe1DrwddrxgLLBlyHpAZetNYFZNT+Cs/OlpqI0Jm59
+kK9pX0BY4AGOd23XM3K/uLawdmf67kkftim7aVaqXFHPiWsJVtlzmidKvNSmbmZe
+dOmMXp6PBoqcdusFVUS7vjd3KAes5wUX/CaTyOOPRu0LMSnpwEnaL76IC9x4Jd6d
+7QqY/OFTjpPH8nP57LwouiT6MgSUCWGaOkPuBJ9w9sENSbbINpgJJ42iAe2kE+R7
+qEIvf/2ETCTseeQUqm2nWiSPLkNagEh6kojmEoKrGyrv3YjrSXSOY1a70tDVy43+
+ueQDQzNZm3Q7inpke2ZKvWyY0LQmLzP2te+tnNBcdLyKJx7emPRTuMUlEdK7cLbt
+V3Sy9IKtyAXqqd66fPFj4NhJygyncj8M6CSqhG5L0GhDbkA8UJ8yK/gfKm3h5xe2
+utULK5VMtAhQt6cVahO59A9t/OI17y45bmlIgdlEQISzVFe9ZbIUJW44zBfPx74k
+/w8pMRr8gEuRqpL2WdJiKGG6lhMHLVFo
-----END CERTIFICATE-----
diff --git a/mysql-test/std_data/server8k-key.pem b/mysql-test/std_data/server8k-key.pem
index faf4b43fa56..99e7417733e 100644
--- a/mysql-test/std_data/server8k-key.pem
+++ b/mysql-test/std_data/server8k-key.pem
@@ -1,99 +1,99 @@
-----BEGIN RSA PRIVATE KEY-----
-MIISKgIBAAKCBAEAyqodxBHskfDH/1+QkvxADF63PQDFINUPiTEH10FMi2CAqjgU
-3pNrnHSIQWi1AkEBLYaiepVTXntnL2weKVH5RP1KgL6yI6E+GzjPiMRx7vhrQcUt
-wMNSrFl9gTQZlTK4mlG2QTbUxKGuhOY4uei/lr4Zemt3TeDe5rO2a7w93Wi8S8Tr
-9TaT7VaiFVCKEOjWIu1ssc3DGMn2CuHeYWVi1hRBjLX7FGjBzxJdQSGdVxFDfbtD
-LCG7w0R9qM8fw3F1tUfCfc44PHNknhXYpyfPvUDIRQjjyDmoC47CW3vxR5ESkczh
-AOCUW70y5AyNw77MdjJSEmmwGOCwwnY0Wl952faBnQIKYWkcM85J+nYDHgdbJwu/
-NJ40lrgDm1A6ai8XehTPZWMAN1Koc85LFED00ppWVDO4dy5CW4/sHxj0rauKSo1t
-cCXzWOfLZlEUfRb0621WdnZRbtYd2tONwGRaZ06v4r8z0bj2KvxXh6c1XoDJrPyH
-yXEXkb+3TaPtPBsn9Gag+UYDJ8zqgPZLQPZBlM29CrPvJr7eb2muDz8cVWMzkJvt
-yloSTd5LBsKikrBCPTGvpBUSFfiK6YiNz/2FZlBvEfGfSPO1up2GaCSiXah8VEL6
-2LXF8t0OD9Bo5FR+xbmgm2Utd/SPuTAK1YZc7cl80dqdDWNQ7uUekmPMogzoSpYC
-TdyP33yPCBioMIjXr4mt/FdLEPnxy0jotjvIP/zC09FKEDwba2Tc5WUeW7LaseIk
-l4/uwEuOGIN8F6Y8RbNgBiPyLxgTnheKxnJ5jE0E853q4CXTM4weEUdjH6VFP72F
-s/6laO5ItwykyX9y0HVmm2r5oFDzqFlto904T3Aru/+SLnGr7+kA7Q3RtG/wjrIJ
-+01hDdkQ1VQRzQOUhP2oaORFbh5qHi+FoW31tsDx7vc26f7C963ME0ZbiELwLR+1
-Dn61K+SNq7mHMGo9EvSt8xyszBpIKSqWe4AAC25Zh7+jynCZGxz9cj2y05RKz1V1
-vh9A7FU1SC1V8ADaPLBguhEyZlQLvgakXrfJWbtN9JIGJkhuwhLUfPAguKLhvGq2
-GQ43R1XJ8kkNlnWihGS/NPy+skHk9Yjr4bcmpeVBwiAM9uKoped2VKX7S4AFfRiF
-erq8t63AL2CFzBUSHC8KnvN8QM/0PiPSlcrQBlhS8ITYDz3r/xJolHmPvkApX5jI
-kGwFL5mMKmN4HyOxKcXnScmykg9TC9VxKBfCGb9gv3yHqKvB9ArBuNJo7sHOpxMT
-F20kXaI3ptd9SIsrdC1ALsoZ1bY+bEJx+s+Fh/negHOLifRw8NjX/0BBnMcVbZtu
-TLVSApl5MnPKJqCsMW/EsPXau8If4J9EuiX3nwIDAQABAoIEAElnTjqq502AsV+c
-hGfId4ZDdAjjU4LtyJ+/I4DihM/ilxeQEnb/XDWhu4w9WXpEgyGzJvxRQ43wElKJ
-zW7X4voK58Yzy5++EhmX/QsjY8TTMz3yJf0wgawtCZkXfsCcS2KRf/qk2nGRwf0e
-yaMEWwhFOEMv01lgvjs/Ei55Usrz2Wd0HqaFKxUGkNQ5hJhVTOH/rqPDzAsZc0VD
-w+Dw8NhrI8bMTvF4c+IFW8NwYmWbuh87CTxdx30VPJI82ttWJ/UN1bLtU08J2IKt
-lPgOIl8ArMjcTGxD/cqZ3Wl3Pc/XCqvGUiSYMwP7Rgh1R4+DdtjEpxdGMmMAVuVI
-HPQyqpa4gv+UMqBPish0yjSuM7jXnztINOvg9Vk1sxC5AT9eaRltmiS1s+lVxe+T
-43ulf0ccYXJD/WclWSGCwloNFuokPIV+Lgo1pKsp4XDgoxQfkXwH8Q4dEqebY9rT
-Tv9FGb1bMbdl22X1oSu2lBltBZaB/QnruV7L2GaQ0tqLKizgBRuvZFSE+DWdMb6d
-9mnEB8LWtca/nzogXb5qv4GEMUX4FUAmSf1FnGWZwwDi1DFfJ860RVKf0xokGGQ3
-cm3H/F4veds88Z1hsAu0bG8h/bEAim+Whvag995cFHDD4on41KXW8wX1on9VFA1W
-CkaGUPhLRytXDBVCSJkOYYFSJlb2wqONiWe4Tn5hsantCfliTj/GVkgDq2h7dAGR
-WyoqTntJAv/xJsUOV9WmGXnWNeZX8BSO3P5dnXnMzhCWQGoprXmWFyJ3TYCJ2+CO
-rzkZbtuKvTvGc3sDJgrSVmmg0BrOkH+GyYVlJdTDBmfzoORludDCFHECa8oK7NwY
-t3o0eNlG6IqTxl2HIoPneW9nXFQtCXv6tpJjljwjlz5WpJG+kBW6bDedcxZu7olZ
-fqtnyZTB2SjzzbGdQ4JvFup8MxNyPvYiqumQXJgkyXFVDl/UFhjWuGe04i8NBJgJ
-xORcjfgLrKH1XKVBWPJdh/2YeUKIIvQ9RB4WVqXgGmD/21tgv1bVEMYabh23e/HE
-Fe1U2XQPJKxGCEtG6b4zhFP+PeZACS+Vk5IVJYK9n4SepPBPgX/wbJLOcKGpsKjp
-yx5WjopMO6T+VUV8HIduuZ+E8+uAILHDmo2Bq+LHblaxd4SkM0+hL2H36imK5CUO
-5fLuvHW88LvFtQw6xhP20s+BnmgzE5ZvNG4Iedkjvwe9HmdNDew0UYT5vNJN0ehh
-OlraBC++JYwEclrBD9SRvprT63XKDG735pPvzLQi7WKDCBn1/JEgxDIO8nkMewOZ
-FU48Mdmkn9wqPeIigQciwl62fuAQCGRG+RXMQqra4A1apqMZQEauTK50VhHDGdbc
-ye9LHaECggIBAO9lAzoYS/Lu0ticMt24P8BSbGdxSNIpEyIlTTs+7A0UjpfXsoK9
-4EJWZ7lhgbQh+SCTS662SeC+s8M6bT+3mELxUC5S/N3aCPyfjcM3JaoACkI9+VMn
-9otJZjAEwH7cNpMN0Xa8fHCEma3l3XKiVxEJbuJC86S5mpkjeXVnDajAidBtevBd
-LWJ9n2yXk+ZKUyI0mjpqItwUxOgQ/MOIvqAu66xyjg08/I1QQTuIrReAA+oaVKhp
-c42Ufn26hUhNrQCBAtMAO3VC/chciet6vEMNEM13GqLp4+PcPhRX90gO4+bNrScD
-WgiW/jc24CGan8gAenBWC/3l/C6JUsMp+ZYmPozsa0zo6edgiO/f2KXe5nP87wZT
-MxaYJgnyXJxMefI79kUHPrhpXZxuiSCEWLhCBN34Lhpr2L491i2g/FJj9i6N3EzE
-N3ic5Q63o4QFusjqIm3taQQFoGP2Cgg9owz5WJ0uRz/gtOE3XQiQA7+ozoAXOlTw
-pJK5MMtVrEoOLIbVJIpxfDcKDp3yorR8QCQLHgDBmFeNCDmk+7YP33dRIc/AVNLF
-q7cecqEc7D8AkXX8Q53GfCEg+uqbdeMQXK4BUE9iwRK9RiFhas/RJe73+Iio3S0L
-ekLpnnOfvk744ws+JWsLpsfC/ZE7OxBLPtq2xvGl/RT2G7tCjmpX3CbPAoICAQDY
-uOEJks2T105EcMPJjzNHCCqjK6S7qZaWkF3KT1Z0Mu5oUZwwHamsMg4BQJ2mjMrL
-fRBKfXQLA6vgE7zysw3F300RDxE1RVow5+JLDQ4bqupp27/M0a8fuwksyOdKHqCV
-YHzuTCxbVIFZawTjfOxJVXDHKCFCilfY1LsA+V+oFe3Ej8YYxWXkXA9ZLigpmt3s
-Wu6eFcZgF3utzIGjI6eP6lL5bWp6Bh9Avp2xrOvpFwE2m02Y7/Zom6MT4DXvByY2
-KHHQLsasEMpeLuxQXjLeTocwcxBwBFKhX95yFuv31k00VydT+NExtaZeUYi9l19J
-WmM4GjFjAqa3uUwMNVv5JfWtKMyk4FOox2XftLvMiIhV95B8hAGxtYr3hPkGg80O
-AWPq6OKUD332COXRaHkmL5aQdN3gP5zh9+rH6icLrrZbrQidVRyDw03doRoGrH7i
-ixXLyYoW80PHgqUDPohd5bFkZpi2vwXMl1YQ2TfN9TvYFSGme9YCm9ZuypnqauW/
-aAf0FI1MNwS+XDREtzPdFi0me6WxpKL4a2Z3GGNxIFuBjQ/uydWpjxkny9qI3KAp
-SgjI3kBUDGq3gf0R+Xo/d4d/4asK9Nv2Fi0X+RfGqioFaTbQl/1zhNdvhP9IcwEJ
-DLVQ3UhMdfg285RarC2Sihui0M8Smi9od9Dj6rdWMQKCAgEAiQVRFoRnnDGz/wVQ
-W/Wkj6jdoUuG+btG10lwbhOyuj3k6+Yqp4iUfoPENKgpu/eiB1InhGWT3Y5ph7m+
-ZDTqco56bTlUwIqWkDmmw3CiHy6MsKOWPFFoXQry8VMW9sWGex7yoDp8I07SQ2WJ
-HZ7rpLW4gMr/d25AnZxfXaJRgCBMAT9YmZFLc88hW99aaPproO1oxTyQnVVJ6uYm
-NqjjKv4QKJEc21jn2N5xp+iv4f6Evw65G/fXitbOm5oRxXOoLNyqyCie35wrc+37
-hwumC97DmkasuUiUBoy9/5jl0ZmsOiPJEsZpVvdNpD7FhJZjE++qJPgrPvTPJbe1
-5jz1PUrAjJqZQ9kgYC2x01JVR4NQdlz0VrNyT2FgjFrrRQ7E0bAeYh4meRjd2rat
-yC3YNgabkI0HnlnSIfl0yIMXSPUsKDNMP6gjc+aheI4FioBZC7xvXmn/rKynw+9E
-iLj2xWtGnBir8VTlUu8EUe1UJ/Qv1cL1wT5HhC95TTjJN03rkHUYyCDyjvIzsZX6
-KMHhWIAAeUBVuO7hIVVcOTXWmw2WA7o7ErTPdy13QN40Hk9t8pEkBn9f9vpQg83d
-aMypr3LTC80jY11wcZS3tSEpzCCkYVv91FV4cioTZmytWbg9A+dbNWzi1f22ctTr
-FoVrAXaSYie2trOy5bjPmPCW8qMCggIBALQUKymBSkDmTqqf6I+65ajIKGWdBizJ
-Jc/F9aj9c6DqER+tcFKq0ym6DdkMj/KsWnXrXXYH+DyOuGpg/EfOcEtS2P6rvmi9
-T8wDYg1qs6ZZxp5fcmgGc7Wx/FWyOj1kZZq5qhV4RgM9nJ1oR4+fZdcpn6RcvAZG
-XehWG20byVgpoIAL11cN7zRpKne32rd3b5/NjyjcfxGpcaNgovej0L/MvVV0jV0H
-aUCrIu1X+k6cRu3Q7hF+kwkpCcCiNS6AikfGI4wQ0hR3fy/zXXkKTMpcBglEEwyB
-Cwf8WSID2d79uvka0hr8TRc5ERyeMzkWZp7U9EzRtufGdDGFTqN2Uw4bdKCFnkYC
-AIHl7ciMrN+vM1n7c5uDNMUtTGOPojy/l8tjbFrtWBgfJ1Mg4ZW3cbNBJ6Kw+Qw0
-z28USYoEDp2uduiGRvo0lpUF29Wk37Nb8bLcTygeNxgK2u8Up3iipT0gdt4uQgbX
-g0IVHfayB6SjeS57oJJto85XHz7AKlSWroD1OGagDSifLtneU7AlanryymGHrI6H
-dsNkuqeLJFYDxQVI6UxJebiCpyxiPxwp9wtX8SS3SEyOZL5GzLn6ypGiCH1CTpW0
-EHHSy3V4DUGOc4w7eMirAnbSkxCfOmBA70NNw/uFY2XlQHKow0T0fImfKIeJagbT
-B0GPDYvUpLKBAoICAQCzYnq8xupXK7lvTLaj936qGSe54OC2sj9+UpsFiPxglNY2
-sO5zKWKyY7+rjK6zG2ciGfPEDsZNIqKw1W/KBfR2kRLqkt4bC3fSCvUztx0vtGUe
-veXlqiwETdE7RJXoaGJrgJArYJvpOd8PtWGeM+sSJNNrUlGlJnSiZ0CcypqUZgZL
-WzGFfLOQYAXCykdB1iZkBqU2C5wktvCb9sVz6G3TmAwSKTENOWWZWmh+W0J4pZFV
-ZEyvsxViJRQbwxa0kC0F5J/UtWZknO79/ZFj1H4jiAR45EjWHE+UZAkFwG8BSl54
-EKOx7GDanuRILr0dtbyi4d31nCYXdjs3x2+1N3exw4oKQIvNuF54WoowbNPu0kEb
-G+7/kLwcJqRnSV4AiLuMz5aOte7JJSw5tzgZZlAQwJO7IDfrLqodivcXF5yirwiF
-dyBpzSDmupy/aTHnCpT+l0H96jRU2awxaeRHZUqZog8gMHsslNVZEFvUFDJ7AUN/
-yyfUzJYjH18pZt0hS7jNb1O7KxZCkWGMiEcxHkgF/UINab5qruNBVKOkJ5vqGhYi
-uNkgeGsQtXJcpqMRRiVXJE0kE+26gk+iaYnBJN9jnwy8OEAlYFUHsbCPObe/vPMQ
-3RLl+ZoKdFkN/gTiy70wUTRVw+tWk+iAZc7GPX1CqDFOqGZ2t+xdF8hpsMtEww==
+MIISKQIBAAKCBAEA6h3v1OWb9I9U/Z8diBu/xYGS8NCTD3ZESboHxVI2qSECPgxN
+NcG8Lh0ktQdgYcOe64MnDTZX0Bibm47hoDldrAlTSffFxQhylqBBoXxDF+LrhXIq
+Cz7K0PsK+bYusL9ezJ7PETDnCT7oy95q4GXbKsutbNsm9if4ZE41gs2KnoU2DA7k
+vMmkKojrMIL4+BqTXA20LLo0iSbgvUTvpSJw4u96BeyzMNnxK2wP5vvTtUo5hACb
+fU87YjaSKs+q2VXCzfyYGZk1L1xk5GUI0bP+jutf1dDzNttW2/q2Nf5rxx09Gh/G
+wmOnEk1O7cOZ8VQCsOHirIM39NuSARsY6Y3G5XM4k2W4nxyR/RtdG9bvs/33aGsZ
+5V5yp7WSs8s9HHwaCPSsUiLKckQ7uA0TTRgbeweMrrLKovG57jsbBBB8pQD4PRd3
+1qgxCdstWXHiWwRyI8vOLWENPXPFqA/rJwwqNdWTogy38aqVXxGYR8PIwjA2OaIw
+FjwGZcsPNLqw6bgAN8O2UBqZHWiMF8mi7brvioDvAIufZuqa2SqT/At45H83psQ6
+R4FsxZt6SAK7EsdPo8OYTrY1i4iPZd/eKhnEu2srEZgsKRwY5H1mvDH5fWCcHSFu
+07sWmlmK6Or65Fsa0IaKLJiQDVVETd6xrI0wkM4AOcbKDrS7aywJ426dopbs+LFd
+t4N0cdII4gBgJAfLuuA2yrDXRq4P6cgpVMy0R+0dEYE8zzm8zf1a+Ud273LS9+LB
++LJKwqbW8nOPBoiekimIKfJYoOA4+C/mAjsYl1sVjjEhXJAs9S9L2UvnUk1PsZi4
+UKHI6eAIEl7VM1sQ4GbdZ0px2dF2Ax7pGkhD+DLpYyYkCprharKZdmuUNLUdNhXx
+i/HSEiE+Uy+o8RIzmH7LuROl/ZgnfHjJEiBLt2qPvwrwYd4c3XuXWs4YsWfVJTt8
+Mx2ihgVcdGy9//shCSmgJwR1oWrhgC10AEL2fKeRnYUal1i+IxFPp7nb8uwxUADg
+R0cY4A3qR/JP489QFIcxBTVs65De+Bq3ecnujk6yeGpD9iptonq4Y8uNZMc1kOE7
+GiFGwR4EufT5SEMh+tUkjth2r+842vmZZuxrVQaohDiATmIJA07W51zKH+nQuw4q
+VKnAhPaDLCLc7YMIH9JcmkeQX0nf8/S2O2WYDH8glVDi5hfW08tCmV647vRYnTIy
+wUTO0lFpz7M+VyMNaJ6yXU6biBV5hLAI8C5ldr/SWI789W2+ebBaJ9gfK+PTtroh
+FSK37GcoSH4V6qSLJHCBASEsiddqHIHMLJZRYD+B6J3tLhjVUM43u+MEGbFTd33Z
+Dke/WzLTExWkaOv36e67gDBmgDuj9yroq3wGfwIDAQABAoIEAQCSt6YoZqigz/50
+XvYT6Uf6T6S1lBDFXNmY1qOuDkLBJTWRiwYMDViQEaWCaZgGTKDYeT3M8uR/Phyu
+lRFi5vCEMufmcAeZ3hxptw7KU+R8ILJ207/zgit6YglTys9h5txTIack39+6FJmx
+wbZ64HpETJZnpMO6+fuZaMXyLjuT8mmXjvHcOgXOvjWeFkZOveDhjJkAesUXuqyX
+EI+ajoXuQiPXeKonkD2qd7NTjzfy4gw/ZF4NXs0ZVJeviqtIPo2xp33udOw2vRFh
+bMvlF4cNLAbIKYVyOG0ruOfd2I7Unsc/CvD1u5vlRVuUd8OO0JZLIZR7hlRX+A58
+8O1g2H/wJZAsF1BnLnFzDGYCX2WjCCK3Zn85FkKGRa0lTdYDduad/C/N3Y2/pHFE
+e7U/2D7IkEei59tD2HcsDBB3MJnckkn/hyiL9qWcxqWZ61vurE+XjU6tc6fnfhk9
+pJQ6yU3epPU7Vfsk0UGA7bbgKpsyzyH8Zl76YC2mN2ZVJjZekfhY+ibT9odEPdOl
+yLB5iXA6/WhKkDWaOqZGOH+7MblWgT9wHINlcn+nKzOr00JHl26ac6aMlXXi9vbe
+4jgJbFK1HYlFIndyX/BdqRTsFemDoDrVqrEYsaONoVYDd9c5qrqYOeh34DhOksQW
+hNwWBfmMlfzgOGtCYhMeK+AajqTtUbMYQA6qp47KJd/Oa5Dvi3ZCpvZh3Ll5iIau
+rqCtmojsWCqmpWSu7P+Wu4+O3XkUMPdQUuQ5rJFESEBB3yEJcxqk/RItTcKNElNC
+PASrPrMD9cli7S/pJ+frbhu1Gna1ArXzXQE9pMozPaBpjCig7+15R0lL3pmOKO6e
+WK3dgSwrnW6TQdLPlSD4lbRoiIdTHVBczztDeUqVvFiV3/cuaEi1nvaVdAYLqjuL
+ogK4HwE/FQ54S0ijAsP52n25usoH6OTU3bSd/7NTp0vZCy3yf10x7HUdsh2DvhRO
+3+TSK5t0yz0Nt7hNwcI6pLmWUIYcZgpFc/WsiiGscTfhy8rh3kRHI8ylGq53KNF+
+yCVmjqnBRWs91ArxmeF1ctX2t3w5p7gf65hJWqoX/2DiSi5FBsr6HLxa5sUi4wRZ
+136aCNt5Wu7w+AzPDbQW6qKUGSyfHJAw4JZasZcaZLise5IWb1ks0DtFbWWdT3ux
+8r2AM7IO1WopnekrYCnx/aBvBAv4NjWozVA517ztVttPERt3AGb4nm387nYt5R2U
+NO2GBWcDyT8JQLKmffE1AkWolCR1GsvcNLQfLCbnNppgsnsLE/viTG4mq1wjnd8O
+2Q8nH1SVTuyGFREMp/zsiAEaGfdd0hI2r1J7OdNPBBCtmhITsy9ZYHqm5vrGvy3s
+vi2GuB2RAoICAQD/oWUsg4eTJxHifTJLz/tVSTXnw7DhfbFVa1K1rUV63/MRQAFW
+pabN4T6Yfp3CpdRkljCA8KPJZj7euwhm4OEg1ulpOouA+cfWlE9RFE8wyOK5SYwM
+k+nk31P9MUC866pZg/ghzBGDub91OW1+ZGEtqnLI/n/LhiAIWt0hJvgZclTc1cAL
+xffHVlFwoSyNl/nc3ueZCC95nOLst2XcuxZLLbOFtZCmDYsp49q/Jn6EFjn4Ge2o
+qp38z6eZgDMP1F4lb9nDqXPHfUSt2jxKlmpfXS+IPKdba67+EjhbtmUYzaR4EoPI
+zh+o6SrVWT6Yve7KGiYv06fuRz1m/lLQO/Arbd9ntSjgn+ZEXGOkbhnHUX3DJ4ny
+/6XEGB9NLQjern4uNTn0AaV+uvhncapFMaIBnVfq0Cw8eog0136PBYRaVX7T44j5
+HwIyGXWtYGA/SzDEQoksD0Y/T61BEGnLZaKeavNd82WwFvcYHZtE0J4aQGjCEE7N
++nijzCy+j5ETmme9KJvQHpEyXP3N4RBko1eWvyTwFZDdIXtoa6TTEI51lm+FXJ/b
+Y+BzMr6KRo29FB+7//1ptUoMvn5hzL0PwOv2ZSTQuoG5hLDEbxWXLNhd1VHcfznF
+3EZHwfD2F8aGQ3kz+fkMTNfK955KorDrmLgvmV9eZZ5yQxGZrs5H5YfKpwKCAgEA
+6nSUbzfSdVFUH89NM5FmEJgkD06vqCgHl2mpyF+VmDGcay4K06eA4QbRO5kns13+
+n6PcBl/YVW/rNE8iFi+WxfqUpAjdR1HlShvTuTRVqtFTfuN8XhbYU6VMjKyuE0kd
+LKe3KRdwubjVNhXRZLBknU+3Y/4hnIR7mcE3/M5Zv5hjb7XnwWg/SzxV9WojCKiu
+vQ7cXhH5/o7EuKcl1d6vueGhWsRylCG9RimwgViR2H7zD9kpkOc0nNym9cSpb0Gv
+Lui4cf/fVwIt2HfNEGBjbM/83e2MH6b8Xp1fFAy0aXCdRtOo4LVOzJVAxn5dERMX
+4JJ4d5cSFbssDN1bITOKzuytfBqRIQGNkOfizgQNWUiaFI0MhEN/icymjm1ybOIh
+Gc9tzqKI4wP2X9g+u3+Oof1QaBcZ4UbZEU9ITN87Pa6XVJmpNx7A81BafWoEPFeE
+ahoO4XDwlHZazDuSlOseEShxXcVwaIiqySy7OBEPBVuYdEd2Qw/z3JTx9Kw8MKnf
+hu+ar5tz5dPnJIsvLeYCcJDe/K6loiZuHTtPbWEy9p6It7qubQNPBvTSBN5eVDKc
+Q2bTQNCx8SAAA9C5gJiwWoQKsXJzbRFRY77P9JjuGpua3YJ2nYBHEJmF+fp1R33c
+uHIyMphPMkKC4GC3/43kkMr6tck8kZbXGSYsLsBr2GkCggIBAJvvrjILQianzKcm
+zAmnI6AQ+ssYesvyyrxaraeZvSqJdlLtgmOCxVANuQt5IW9djUSWwZvGL4Np1aw0
+15k6UNqhftzsE7FnrVneOsww4WXXBUcV8FKz4Bf3i9qFswILmGzmrfSf8YczRfGS
+SJKzVPxwX3jwlrBmbx/pnb7dcLbFIbNcyLvl1ZJJu4BDMVRmgssTRp/5eExtQZg4
+//A4SA8wH7TO3yAMXvn8vrGgH8kfbdlEp88d1SYk3g4rP/rGB3A63NIYikIEzmJn
+ICQ3wUfPJnGq3kRMWgEuyCZaCy2oNE3yrWVPJ8z3/2MJ/79ZDVNHxEeki2o1FuW+
++nGAPq+fZIp03iy4HdVRro7dgugtc9QaSHJtNId8V4vSjviX5Oz3FxUb9AJst58S
+nVV8Q2FMxBa/SlzSOkhRtCg2q1gXkzhaMnIVUleRZFGQ2uWBToxKMjcoUifIyN1J
+z999bkfI4hBLq5pRSAXz+YVu5SMKa10GaawIwJLat+i+1zboF6QyI2o/Wz8nrsNq
+KX/ajFGu5C94WFgsVoWKNI90KBLe48Ssje9c68waBlV/WHMg1YLvU3yqVDOV+K5c
+IHB9tPMnG+AgBYZPxSzuvnLrrkj/GeKx0WI7TrvzOLRGKJo6irMEJ8IzFegASRUq
+TVZKYQDYRG7m+lKlSxU+pyMAh2c9AoICAE4kavCip1eIssQjYLTGSkFPo/0iGbOv
+G9CgXAE3snFWX67tWphupKrbjdMSWcQTmPD2OTg6q6zWL4twsIi6dcMooHAHsFC7
+//LyUV/SDJdxSyXohiQJ8zH1zwy35RDydnHSuF5OvLh53T44iWDI1dAEqLgAFI3J
+LjTxzEpLMGiGTuYFt+ejai0WQAQayvBw4ESM9m+4CB2K0hBFTXv5y5HlnNTW0uWC
+VUZUUMrbjUieDz8B/zOXi9aYSGFzmZFGUDAPSqJcSMEELemPDF7f8WNr8vi42tIV
+4tlaFD1nep4F9bWMiCXU6B2RxVQi+7vcJEIqL1KUnGd3ydfD00K+ng4Xnj7Vz/cz
+QE7CqrpFaXmPlCMzW6+dm51/AyhHXDLkL2od05hiXcNkJ7KMLWRqwExHVIxM3shR
+x7lYNl3ArUsCrNd6m4aOjnrKFk7kjeLavHxskPccoGKrC9o0JMfTkWLgmuBJFQ0S
+N/HzIbcvIFWF0Ms4ojb50yp6ziXhXfJOO/0KUQEki71XIhvw89mVZszDzD5lqzjf
+HCZMBU4MbmL6NdEevFIDH0zPPkx3HPNtJt3kIJbit9wI8VhUMe+ldGnGxpWb8tKw
+SfM3vrHkYr+lizk26XfXMFhdAuVtT7dzQKSNEyP/1a2Hs307Xzgiv8JulJ8QIkrX
+/nsYWPOAGLG5AoICABmdW9Ppkvuhb1AEcjTWb+XCyopoBc6vit/uQWD9uO+CeX7a
+cfzq+iH01CAjyVMc4E1JDc5Lpi106U+GRGcAAaPJB2Sp5NznoxaOVrb71blu4Q4x
+bNjtKM/P/DXpO+yJYoOPdKtaSDhtnfNDM7H/jztJ3XIrOltKA7CcRDohbBWIx8Q0
+0uEpvfFpZZBco3yVmjP0RLgIVYn/ZDj9wGhSvFWIJ5vv6GXmtDrcHGMLxcfv7t76
+UVcMW/Yy4mYJRCzGOrWagyVijJ6MTVNciqadWcH1KcbB3EGoMFYMn61or2qJABPM
+xz89IlhnROU1Re3X/QRx5t86cw6oa+FqrWMOhSs31I0dNWSuS/xDympG27YIYSDd
+mv5seT78GjFmMJC5pPOLoXsbTPB0HpsX2/UL/w/eRAfilTOef/Cf9VE5MP/C2YR7
+NBxUU7/+21D6WvdtBTcZbrXWGroAo8zPP+PwX0+c6WoAvqDJvCPndp8xZhSgEJN/
+0kScptezi8n3ZHI95EA9U5mAHxHz0IhDDVzWw/z1f1SBPxKVX3+By3zaa3lrD2ch
+cHq7nBkX72veEevnHUY8Z2rHE2G2jdmRfOtwm4sjL0VBV9fRRoxzJWRduKyeOtDL
+EhhBhUoTrT48UnfW9hxnbNLB9P/hh+UJu9HrS2uAwHoGE1+8gcyundupGDBn
-----END RSA PRIVATE KEY-----
diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result
index 33ae6c05ed2..b6299f9a940 100644
--- a/mysql-test/suite/binlog/r/binlog_database.result
+++ b/mysql-test/suite/binlog/r/binlog_database.result
@@ -36,7 +36,8 @@ master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table tt1, t1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS;
set binlog_format=mixed;
reset master;
@@ -76,7 +77,8 @@ master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table tt1, t1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS;
set binlog_format=row;
reset master;
@@ -117,8 +119,8 @@ 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` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
FLUSH STATUS;
show databases;
Database
diff --git a/mysql-test/suite/binlog/r/binlog_innodb_row.result b/mysql-test/suite/binlog/r/binlog_innodb_row.result
index ab9a3c8cdec..093628c29cc 100644
--- a/mysql-test/suite/binlog/r/binlog_innodb_row.result
+++ b/mysql-test/suite/binlog/r/binlog_innodb_row.result
@@ -45,7 +45,7 @@ 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`; DROP TABLE `t1` /* generated by server */
###############################################
RESET MASTER;
CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
diff --git a/mysql-test/suite/binlog/r/binlog_mixed_load_data.result b/mysql-test/suite/binlog/r/binlog_mixed_load_data.result
new file mode 100644
index 00000000000..840257f11ff
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_mixed_load_data.result
@@ -0,0 +1,10 @@
+RESET MASTER;
+CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=MYISAM;
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result
index 8ba70fb8311..3c4668b72bb 100644
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result
@@ -234,7 +234,7 @@ 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 # # use `test`; drop table t1
+master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
set @ac = @@autocommit;
set autocommit= 0;
reset master;
@@ -256,7 +256,7 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_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
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
set @bcs = @@binlog_cache_size;
set global binlog_cache_size=4096;
reset master;
@@ -1086,7 +1086,7 @@ 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`; DROP TABLE `t1` /* generated by server */
reset master;
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE bug39182;
@@ -1194,7 +1194,7 @@ 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`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
@@ -1229,7 +1229,7 @@ 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`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
@@ -1251,8 +1251,8 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (mysql.user)
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`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
diff --git a/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result b/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result
index 8b32e9e5a45..15e6679fa25 100644
--- a/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result
+++ b/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result
@@ -13,4 +13,4 @@ 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`; DROP TABLE `t1` /* generated by server */
diff --git a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
index 24e779eee8e..d5986809a7c 100644
--- a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
+++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
@@ -28,11 +28,13 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # CREATE DATABASE `drop-temp+table-test`
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TABLE t(c1 int)
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp3` /* generated by server */
-master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
-master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
DROP DATABASE `drop-temp+table-test`;
RESET MASTER;
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 52065ef1a3d..dbedb21c33d 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
@@ -286,7 +286,7 @@ 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 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1,t2
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t0 (n int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
@@ -321,7 +321,8 @@ Note 1051 Unknown table 't2'
CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb;
INSERT INTO t1 VALUES (4,4);
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
SELECT * from t2;
a b
TRUNCATE table t2;
@@ -339,11 +340,13 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
INSERT INTO t1 values (8,8);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
COMMIT;
INSERT INTO t1 values (9,9);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@@ -367,11 +370,13 @@ a b
10 10
INSERT INTO t2 values (100,100);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
COMMIT;
INSERT INTO t2 values (101,101);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
ROLLBACK;
SELECT * from t2;
a b
@@ -383,12 +388,12 @@ 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 if exists t2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
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 IF EXISTS t2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
@@ -399,7 +404,7 @@ 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 t2
+master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
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
@@ -413,43 +418,15 @@ 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 TEMPORARY TABLE IF NOT EXISTS `t2` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS `t2` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB
-master-bin.000001 # Query # # ROLLBACK
-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 TEMPORARY TABLE IF NOT EXISTS `t2` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS `t2` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB
-master-bin.000001 # Query # # ROLLBACK
-master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
reset master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
index fd036643b4b..b96707f994c 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
@@ -143,7 +143,7 @@ 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 # # use `test`; drop table t1
+master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
set @ac = @@autocommit;
set autocommit= 0;
reset master;
@@ -162,7 +162,7 @@ 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
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
set @bcs = @@binlog_cache_size;
set global binlog_cache_size=4096;
reset master;
@@ -591,7 +591,7 @@ master-bin.000001 # Query # # use `test`; create table t1 (a bigint unsigned, b
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (9999999999999999,14632475938453979136)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
reset master;
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE bug39182;
@@ -637,7 +637,7 @@ DROP TEMPORARY TABLE tmp1;
END
master-bin.000001 # Query # # use `bug39182`; CREATE TEMPORARY TABLE tmp1
SELECT * FROM t1 WHERE a LIKE CONCAT("%", NAME_CONST('s1',_utf8'test' COLLATE 'utf8_unicode_ci'), "%")
-master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE tmp1
+master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE `tmp1` /* generated by server */
DROP PROCEDURE p1;
DROP TABLE t1;
DROP DATABASE bug39182;
@@ -701,7 +701,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=127
master-bin.000001 # Query # # use `test`; insert into t1 values(null)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # 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 if not exists t2 select * from t1
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
@@ -728,7 +728,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=127
master-bin.000001 # Query # # use `test`; insert into t1 values(null)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # 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 if not exists t2 select * from t1
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
@@ -742,7 +742,8 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1,t2,t3,tt1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
index 21798ea2456..7e79186e7bc 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
@@ -107,7 +107,7 @@ select * from t3;
a
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; drop table t1,t2
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; delete from t1 where a=10
diff --git a/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result b/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result
index 260092e5561..3355396aa49 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result
@@ -12,4 +12,4 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(1)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
diff --git a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
index 79f09b2d1ee..9c5575840d0 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
@@ -34,12 +34,14 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp2(c1 int)
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp3(c1 int)
master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TABLE t(c1 int)
-master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp
-master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp
-master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp, tmp1
-master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE tmp3
-master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
-master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE `tmp3` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
DROP DATABASE `drop-temp+table-test`;
RESET MASTER;
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 7c83c1c13a5..958643c3314 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
@@ -270,7 +270,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t2 values (20)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1,t2
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb
master-bin.000001 # Query # # ROLLBACK
@@ -315,7 +315,8 @@ Note 1051 Unknown table 't2'
CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb;
INSERT INTO t1 VALUES (4,4);
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
SELECT * from t2;
a b
TRUNCATE table t2;
@@ -335,11 +336,13 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
INSERT INTO t1 values (8,8);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
COMMIT;
INSERT INTO t1 values (9,9);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@@ -363,11 +366,13 @@ a b
10 10
INSERT INTO t2 values (100,100);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
COMMIT;
INSERT INTO t2 values (101,101);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Warnings:
+Note 1050 Table 't2' already exists
ROLLBACK;
SELECT * from t2;
a b
@@ -378,11 +383,11 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (1,1),(1,2)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (3,3)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,4)
@@ -391,7 +396,7 @@ master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5,5)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE t2
+master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (6,6)
master-bin.000001 # Query # # COMMIT
@@ -412,10 +417,8 @@ master-bin.000001 # Query # # COMMIT
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
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `t2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
reset master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_row.result b/mysql-test/suite/binlog/r/binlog_stm_row.result
index ff3293b9315..58911374e6d 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_row.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_row.result
@@ -59,8 +59,8 @@ RELEASE_LOCK('Bug#34306')
# Show binlog events
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 LIKE t1
master-bin.000001 # Query # # BEGIN
diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
index f271c34d29d..2bccc2ccb30 100644
--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
@@ -1,5 +1,5 @@
-- source include/have_debug.inc
--- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/have_binlog_format_statement.inc
#
# bug#27571 asynchronous setting mysql_$query()'s local error and
# Query_log_event::error_code
diff --git a/mysql-test/suite/binlog/t/binlog_mixed_load_data.test b/mysql-test/suite/binlog/t/binlog_mixed_load_data.test
new file mode 100644
index 00000000000..7e7cb973c1b
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_mixed_load_data.test
@@ -0,0 +1,15 @@
+#
+# Bug #34283 mysqlbinlog leaves tmpfile after termination
+# if binlog contains load data infile, so in mixed mode we
+# go to row-based for avoiding the problem.
+#
+
+--source include/have_binlog_format_mixed.inc
+--source include/have_log_bin.inc
+
+RESET MASTER;
+CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=MYISAM;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
+--source include/show_binlog_events.inc
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/binlog_stm_blackhole.test b/mysql-test/suite/binlog/t/binlog_stm_blackhole.test
index 02ba2be095b..6047d8ca2fc 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_blackhole.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_blackhole.test
@@ -2,5 +2,5 @@
# For both statement and row based bin logs 9/19/2005 [jbm]
-- source include/not_embedded.inc
--- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/have_binlog_format_statement.inc
-- source extra/binlog_tests/blackhole.test
diff --git a/mysql-test/suite/binlog/t/binlog_stm_row.test b/mysql-test/suite/binlog/t/binlog_stm_row.test
index 6165048c7d4..87758d57725 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_row.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_row.test
@@ -60,7 +60,7 @@ let $wait_condition=
--echo # con1
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
- state = "Table lock" and info = "INSERT INTO t2 VALUES (3)";
+ state = "Waiting for table level lock" and info = "INSERT INTO t2 VALUES (3)";
--source include/wait_condition.inc
SELECT RELEASE_LOCK('Bug#34306');
--connection con2
diff --git a/mysql-test/suite/funcs_1/datadict/processlist_val.inc b/mysql-test/suite/funcs_1/datadict/processlist_val.inc
index 9c6bd585fde..1327338e761 100644
--- a/mysql-test/suite/funcs_1/datadict/processlist_val.inc
+++ b/mysql-test/suite/funcs_1/datadict/processlist_val.inc
@@ -367,14 +367,14 @@ echo
;
connection default;
echo
-# Poll till INFO is no more NULL and State = 'Waiting for table'.
+# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
;
let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE INFO IS NOT NULL AND STATE = 'Waiting for table';
+ WHERE INFO IS NOT NULL AND STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
#
-# Expect to see the state 'Waiting for table' for the third connection because the SELECT
-# collides with the WRITE TABLE LOCK.
+# Expect to see the state 'Waiting for table metadata lock' for the third
+# connection because the SELECT collides with the WRITE TABLE LOCK.
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
UNLOCK TABLES;
@@ -422,10 +422,10 @@ echo
;
connection default;
echo
-# Poll till INFO is no more NULL and State = 'Waiting for table'.
+# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
;
let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE INFO IS NOT NULL AND STATE = 'Waiting for table';
+ WHERE INFO IS NOT NULL AND STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
echo
# Expect result:
diff --git a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
index 5f79fd04a90..fbc1f2d5015 100644
--- a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
+++ b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
@@ -193,11 +193,11 @@ LOCK TABLE test.t1 WRITE;
SELECT COUNT(*) FROM test.t1;
# ----- switch to connection default (user = root) -----
-# Poll till INFO is no more NULL and State = 'Waiting for table'.
+# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO
-<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table SELECT COUNT(*) FROM test.t1
+<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table metadata lock SELECT COUNT(*) FROM test.t1
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL
<ID> root <HOST_NAME> information_schema Query <TIME> executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
UNLOCK TABLES;
@@ -221,7 +221,7 @@ LOCK TABLE test.t1 WRITE;
SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1;
# ----- switch to connection default (user = root) -----
-# Poll till INFO is no more NULL and State = 'Waiting for table'.
+# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
# Expect result:
# Statement Content of INFO
diff --git a/mysql-test/suite/funcs_1/r/processlist_val_ps.result b/mysql-test/suite/funcs_1/r/processlist_val_ps.result
index bb8e25c87ab..c003b5b66f6 100644
--- a/mysql-test/suite/funcs_1/r/processlist_val_ps.result
+++ b/mysql-test/suite/funcs_1/r/processlist_val_ps.result
@@ -193,11 +193,11 @@ LOCK TABLE test.t1 WRITE;
SELECT COUNT(*) FROM test.t1;
# ----- switch to connection default (user = root) -----
-# Poll till INFO is no more NULL and State = 'Waiting for table'.
+# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO
-<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table SELECT COUNT(*) FROM test.t1
+<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table metadata lock SELECT COUNT(*) FROM test.t1
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL
<ID> root <HOST_NAME> information_schema Execute <TIME> executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
UNLOCK TABLES;
@@ -221,7 +221,7 @@ LOCK TABLE test.t1 WRITE;
SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1;
# ----- switch to connection default (user = root) -----
-# Poll till INFO is no more NULL and State = 'Waiting for table'.
+# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
# Expect result:
# Statement Content of INFO
diff --git a/mysql-test/suite/funcs_2/charset/charset_master.test b/mysql-test/suite/funcs_2/charset/charset_master.test
index 99ca4564a0b..dd02d7491cc 100644
--- a/mysql-test/suite/funcs_2/charset/charset_master.test
+++ b/mysql-test/suite/funcs_2/charset/charset_master.test
@@ -695,3 +695,5 @@ let $coll= utf8_unicode_ci;
}
+DROP database test;
+CREATE database test; \ No newline at end of file
diff --git a/mysql-test/suite/funcs_2/r/innodb_charset.result b/mysql-test/suite/funcs_2/r/innodb_charset.result
index 09076145c44..60785d09430 100644
--- a/mysql-test/suite/funcs_2/r/innodb_charset.result
+++ b/mysql-test/suite/funcs_2/r/innodb_charset.result
@@ -27980,6 +27980,7 @@ F6 1
213 1
53 1
73 1
+DF 1
15A 1
15B 1
15C 1
@@ -28150,7 +28151,6 @@ F8 1
1FF 1
DE 1
FE 1
-DF 1
F7 1
110 1
111 1
@@ -78790,6 +78790,7 @@ C892 1
C893 1
53 1
73 1
+C39F 1
C59A 1
C59B 1
C59C 1
@@ -78960,7 +78961,6 @@ C7BE 1
C7BF 1
C39E 1
C3BE 1
-C39F 1
C3B7 1
C490 1
C491 1
@@ -119154,3 +119154,5 @@ DFBD 1
DFBE 1
DFBF 1
DROP TABLE IF EXISTS test.t1;
+DROP database test;
+CREATE database test;
diff --git a/mysql-test/suite/funcs_2/r/memory_charset.result b/mysql-test/suite/funcs_2/r/memory_charset.result
index 8536ac4a9b2..55951e4443e 100644
--- a/mysql-test/suite/funcs_2/r/memory_charset.result
+++ b/mysql-test/suite/funcs_2/r/memory_charset.result
@@ -27980,6 +27980,7 @@ F6 1
213 1
53 1
73 1
+DF 1
15A 1
15B 1
15C 1
@@ -28150,7 +28151,6 @@ F8 1
1FF 1
DE 1
FE 1
-DF 1
F7 1
110 1
111 1
@@ -78790,6 +78790,7 @@ C892 1
C893 1
53 1
73 1
+C39F 1
C59A 1
C59B 1
C59C 1
@@ -78960,7 +78961,6 @@ C7BE 1
C7BF 1
C39E 1
C3BE 1
-C39F 1
C3B7 1
C490 1
C491 1
@@ -119154,3 +119154,5 @@ DFBD 1
DFBE 1
DFBF 1
DROP TABLE IF EXISTS test.t1;
+DROP database test;
+CREATE database test;
diff --git a/mysql-test/suite/funcs_2/r/myisam_charset.result b/mysql-test/suite/funcs_2/r/myisam_charset.result
index 698cce1be37..c4630637177 100644
--- a/mysql-test/suite/funcs_2/r/myisam_charset.result
+++ b/mysql-test/suite/funcs_2/r/myisam_charset.result
@@ -27980,6 +27980,7 @@ F6 1
213 1
53 1
73 1
+DF 1
15A 1
15B 1
15C 1
@@ -28150,7 +28151,6 @@ F8 1
1FF 1
DE 1
FE 1
-DF 1
F7 1
110 1
111 1
@@ -78790,6 +78790,7 @@ C892 1
C893 1
53 1
73 1
+C39F 1
C59A 1
C59B 1
C59C 1
@@ -78960,7 +78961,6 @@ C7BE 1
C7BF 1
C39E 1
C3BE 1
-C39F 1
C3B7 1
C490 1
C491 1
@@ -119154,3 +119154,5 @@ DFBD 1
DFBE 1
DFBF 1
DROP TABLE IF EXISTS test.t1;
+DROP database test;
+CREATE database test;
diff --git a/mysql-test/suite/funcs_2/t/disabled.def b/mysql-test/suite/funcs_2/t/disabled.def
index da6230bd7ed..8ca94961dd2 100644
--- a/mysql-test/suite/funcs_2/t/disabled.def
+++ b/mysql-test/suite/funcs_2/t/disabled.def
@@ -1,6 +1,4 @@
-# Disabled by hhunger (2008-03-03) due to WL4204
-innodb_charset : Bug#20447 Problem with prefix keys with contractions and expansions
-myisam_charset : Bug#20447 Problem with prefix keys with contractions and expansions
-memory_charset : Bug#20447 Problem with prefix keys with contractions and expansions
+# Should maybe be enabled, but ndb is not part of the ordinary build.
+# Bernt M. Johnsen 2010-05-10
ndb_charset : Bug#20447 Problem with prefix keys with contractions and expansions
diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result
index 0ce1ebe56ad..5712d08c9fa 100644
--- a/mysql-test/suite/innodb/r/innodb_gis.result
+++ b/mysql-test/suite/innodb/r/innodb_gis.result
@@ -572,7 +572,7 @@ COUNT(*)
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
+1 SIMPLE t2 ref p p 28 const 2 Using where
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
2
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 9a677f83080..1adc16456ba 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -720,7 +720,8 @@ 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'
+Warnings:
+Note 1050 Table 't2' already exists
SELECT * from t2;
a b
100 100
@@ -738,7 +739,8 @@ 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'
+Warnings:
+Note 1050 Table 't2' already exists
SELECT * from t2;
a b
100 100
@@ -746,7 +748,8 @@ 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'
+Warnings:
+Note 1050 Table 't2' already exists
SELECT * from t2;
a b
100 100
@@ -889,13 +892,13 @@ EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
id 1
select_type SIMPLE
table t1
-type range
+type index
possible_keys bkey
-key bkey
-key_len 5
+key PRIMARY
+key_len 4
ref NULL
-rows 16
-Extra Using where; Using index; Using filesort
+rows 32
+Extra Using where
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
a b
1 2
@@ -934,12 +937,12 @@ EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
id 1
select_type SIMPLE
table t1
-type range
+type index
possible_keys bkey
key bkey
key_len 5
ref NULL
-rows 16
+rows 32
Extra Using where; Using index
SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
a b
@@ -989,7 +992,7 @@ possible_keys bkey
key bkey
key_len 5
ref const
-rows 8
+rows 16
Extra Using where; Using index; Using filesort
SELECT * FROM t2 WHERE b=1 ORDER BY a;
a b c
@@ -1018,7 +1021,7 @@ possible_keys bkey
key bkey
key_len 10
ref const,const
-rows 8
+rows 16
Extra Using where; Using index
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
a b c
@@ -1047,7 +1050,7 @@ possible_keys bkey
key bkey
key_len 10
ref const,const
-rows 8
+rows 16
Extra Using where; Using index
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
a b c
@@ -1076,7 +1079,7 @@ possible_keys bkey
key bkey
key_len 10
ref const,const
-rows 8
+rows 16
Extra Using where; Using index
SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
a b c
@@ -1213,7 +1216,7 @@ possible_keys b
key b
key_len 5
ref const
-rows 1
+rows 2
Extra Using where; Using index
SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
a b
@@ -1228,7 +1231,7 @@ possible_keys b
key b
key_len 5
ref const
-rows 1
+rows 2
Extra Using where; Using index
SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
a b
@@ -1372,7 +1375,7 @@ 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
+1 SIMPLE t1 range t1_b t1_b 5 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
@@ -1735,7 +1738,7 @@ 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
+2 DERIVED t1 ALL c3,c2 c3 5 5 Using filesort
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
ENGINE=InnoDB;
@@ -1749,7 +1752,7 @@ 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
+2 DERIVED t1 ALL c3,c2 c3 9 5 Using filesort
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
KEY (c3), KEY (c2, c3))
@@ -1764,7 +1767,7 @@ 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
+2 DERIVED t1 ALL c3,c2 c3 7 5 Using filesort
DROP TABLE t1;
End of 5.1 tests
#
@@ -1871,7 +1874,7 @@ possible_keys b
key b
key_len 5
ref NULL
-rows 3
+rows 5
Extra Using where; Using index
EXPLAIN SELECT c FROM bar WHERE c>2;;
id 1
@@ -2536,7 +2539,7 @@ f1 f2 f3 f4
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
+1 SIMPLE t1 range f2,f4 f4 1 NULL 22 Using where
DROP TABLE t1;
#
# Bug#54117 crash in thr_multi_unlock, temporary table
@@ -2546,6 +2549,64 @@ LOCK TABLES t1 READ;
ALTER TABLE t1 COMMENT 'test';
UNLOCK TABLES;
DROP TABLE t1;
+#
+# Bug#55656: mysqldump can be slower after bug #39653 fix
+#
+CREATE TABLE t1 (a INT , b INT, c INT, d INT,
+KEY (b), PRIMARY KEY (a,b)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 4
+ref NULL
+rows 3
+Extra Using index
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 8
+ref NULL
+rows 3
+Extra Using index
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b,c);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 13
+ref NULL
+rows 3
+Extra Using index
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b,c,d);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key PRIMARY
+key_len 8
+ref NULL
+rows 3
+Extra Using index
+DROP TABLE t1;
+#
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different
diff --git a/mysql-test/suite/innodb/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test
index 05df3615822..96f555e3ecc 100644
--- a/mysql-test/suite/innodb/t/innodb-lock.test
+++ b/mysql-test/suite/innodb/t/innodb-lock.test
@@ -87,7 +87,8 @@ connection con1;
--echo # Wait until LOCK TABLE is blocked on SQL-level lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "lock table t1 write";
+ where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # We should be able to do UPDATEs and SELECTs within transaction.
update t1 set x=1 where id = 0;
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
index 2ff6971444e..6244670ef57 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -746,6 +746,31 @@ UNLOCK TABLES;
DROP TABLE t1;
+--echo #
+--echo # Bug#55656: mysqldump can be slower after bug #39653 fix
+--echo #
+
+CREATE TABLE t1 (a INT , b INT, c INT, d INT,
+ KEY (b), PRIMARY KEY (a,b)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3);
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b);
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b,c);
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP INDEX b ON t1;
+CREATE INDEX b ON t1(a,b,c,d);
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP TABLE t1;
+
+--echo #
+
--echo End of 5.1 tests
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
index 0699f8c4a59..e3792f8272d 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
@@ -193,4 +193,4 @@ mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows 2 # table_id: #
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query 2 # COMMIT
-mysqld-bin.000001 # Query 2 # use `test`; drop table t2
+mysqld-bin.000001 # Query 2 # use `test`; DROP TABLE `t2` /* generated by server */
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
index d018f67dd71..423b9f71ac6 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
@@ -7,5 +7,5 @@ create table t1 (a int primary key, b int) engine=ndb;
insert into t1 values (1, 1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-mysqld-bin.000001 # Query 1 # use `test`; drop table if exists t1
+mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
drop database mysqltest;
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
index 0260d49f75f..ab952430d2d 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
@@ -47,8 +47,8 @@ mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows 1 # table_id: #
mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query 1 # COMMIT
-mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t1
-mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t2
+mysqld-bin.000001 # Query 1 # use `mysqltest`; DROP TABLE `t1` /* generated by server */
+mysqld-bin.000001 # Query 1 # use `mysqltest`; DROP TABLE `t2` /* generated by server */
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
mysqld-bin.000001 # Query 1 # BEGIN
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_multi.result
index e1af4aea092..3fbb2660eb6 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_multi.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_multi.result
@@ -37,7 +37,7 @@ mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows 1 # table_id: #
mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query 1 # COMMIT
-mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE t2
+mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE `t2` /* generated by server */
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch=<the_epoch>;
inserts updates deletes schemaops
@@ -73,7 +73,7 @@ mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows 2 # table_id: #
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query 2 # COMMIT
-mysqld-bin.000001 # Query 2 # use `test`; drop table t1
+mysqld-bin.000001 # Query 2 # use `test`; DROP TABLE `t1` /* generated by server */
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
inserts updates deletes schemaops
diff --git a/mysql-test/suite/ndb/t/disabled.def b/mysql-test/suite/ndb/t/disabled.def
index d38f60d6a54..c3c046e7ece 100644
--- a/mysql-test/suite/ndb/t/disabled.def
+++ b/mysql-test/suite/ndb/t/disabled.def
@@ -11,7 +11,6 @@
##############################################################################
ndb_binlog_discover : Bug#54851 2010-07-02 alik ndb.ndb_binlog_discover crashes the server
-ndb_condition_pushdown : Bug#49746 2010-02-08 alik ndb_condition_pushdown fails in mysql-next-mr
ndb_partition_error2 : Bug#40989 ndb_partition_error2 needs maintenance
diff --git a/mysql-test/suite/parts/inc/partition_crash.inc b/mysql-test/suite/parts/inc/partition_crash.inc
new file mode 100644
index 00000000000..f18b8728784
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_crash.inc
@@ -0,0 +1,28 @@
+# Include file to decrease test code duplication
+
+--eval $create_statement
+--eval $insert_statement
+--echo # State before crash
+--replace_result #p# #P#
+--list_files $DATADIR/test
+SHOW CREATE TABLE t1;
+--sorted_result
+SELECT * FROM t1;
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--disable_reconnect
+# CR_SERVER_LOST
+--error 2013
+--eval $crash_statement
+--echo # State after crash (before recovery)
+--replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#p#/#P#/
+--list_files $DATADIR/test
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--echo # State after crash recovery
+--replace_result #p# #P#
+--list_files $DATADIR/test
+SHOW CREATE TABLE t1;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/parts/inc/partition_crash_add.inc b/mysql-test/suite/parts/inc/partition_crash_add.inc
new file mode 100644
index 00000000000..c7cec9c8791
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_crash_add.inc
@@ -0,0 +1,33 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 ADD PARTITION (LIST/RANGE PARTITIONING).
+--echo # Crash testing ADD PARTITION
+SET SESSION debug="+d,crash_add_partition_1";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_1";
+SET SESSION debug="+d,crash_add_partition_2";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_2";
+SET SESSION debug="+d,crash_add_partition_3";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_3";
+SET SESSION debug="+d,crash_add_partition_4";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_4";
+SET SESSION debug="+d,crash_add_partition_5";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_5";
+SET SESSION debug="+d,crash_add_partition_6";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_6";
+SET SESSION debug="+d,crash_add_partition_7";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_7";
+SET SESSION debug="+d,crash_add_partition_8";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_8";
+SET SESSION debug="+d,crash_add_partition_9";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_9";
+SET SESSION debug="+d,crash_add_partition_10";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_10";
diff --git a/mysql-test/suite/parts/inc/partition_crash_change.inc b/mysql-test/suite/parts/inc/partition_crash_change.inc
new file mode 100644
index 00000000000..2a6630b6537
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_crash_change.inc
@@ -0,0 +1,40 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 COALESCE/REBUILD/REORGANIZE PARTITION.
+--echo # Test change partition (REORGANIZE/REBUILD/COALESCE
+--echo # or ADD HASH PARTITION).
+SET SESSION debug="+d,crash_change_partition_1";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_1";
+SET SESSION debug="+d,crash_change_partition_2";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_2";
+SET SESSION debug="+d,crash_change_partition_3";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_3";
+SET SESSION debug="+d,crash_change_partition_4";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_4";
+SET SESSION debug="+d,crash_change_partition_5";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_5";
+SET SESSION debug="+d,crash_change_partition_6";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_6";
+SET SESSION debug="+d,crash_change_partition_7";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_7";
+SET SESSION debug="+d,crash_change_partition_8";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_8";
+SET SESSION debug="+d,crash_change_partition_9";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_9";
+SET SESSION debug="+d,crash_change_partition_10";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_10";
+SET SESSION debug="+d,crash_change_partition_11";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_11";
+SET SESSION debug="+d,crash_change_partition_12";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_12";
diff --git a/mysql-test/suite/parts/inc/partition_crash_drop.inc b/mysql-test/suite/parts/inc/partition_crash_drop.inc
new file mode 100644
index 00000000000..0e35e126f4e
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_crash_drop.inc
@@ -0,0 +1,30 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 DROP PARTITION.
+--echo # Test DROP PARTITION
+SET SESSION debug="+d,crash_drop_partition_1";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_1";
+SET SESSION debug="+d,crash_drop_partition_2";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_2";
+SET SESSION debug="+d,crash_drop_partition_3";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_3";
+SET SESSION debug="+d,crash_drop_partition_4";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_4";
+SET SESSION debug="+d,crash_drop_partition_5";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_5";
+SET SESSION debug="+d,crash_drop_partition_6";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_6";
+SET SESSION debug="+d,crash_drop_partition_7";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_7";
+SET SESSION debug="+d,crash_drop_partition_8";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_8";
+SET SESSION debug="+d,crash_drop_partition_9";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_9";
diff --git a/mysql-test/suite/parts/inc/partition_fail.inc b/mysql-test/suite/parts/inc/partition_fail.inc
new file mode 100644
index 00000000000..6942b40042a
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_fail.inc
@@ -0,0 +1,18 @@
+# Include file to decrease test code duplication
+
+--eval $create_statement
+--eval $insert_statement
+--echo # State before failure
+--list_files $DATADIR/test
+SHOW CREATE TABLE t1;
+--sorted_result
+SELECT * FROM t1;
+--disable_abort_on_error
+--eval $fail_statement
+--enable_abort_on_error
+--echo # State after failure
+--list_files $DATADIR/test
+SHOW CREATE TABLE t1;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/parts/inc/partition_fail_add.inc b/mysql-test/suite/parts/inc/partition_fail_add.inc
new file mode 100644
index 00000000000..71d09792fd1
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_fail_add.inc
@@ -0,0 +1,33 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 ADD PARTITION (LIST/RANGE PARTITIONING).
+--echo # Error recovery testing ADD PARTITION
+SET SESSION debug="+d,fail_add_partition_1";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_1";
+SET SESSION debug="+d,fail_add_partition_2";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_2";
+SET SESSION debug="+d,fail_add_partition_3";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_3";
+SET SESSION debug="+d,fail_add_partition_4";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_4";
+SET SESSION debug="+d,fail_add_partition_5";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_5";
+SET SESSION debug="+d,fail_add_partition_6";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_6";
+SET SESSION debug="+d,fail_add_partition_7";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_7";
+SET SESSION debug="+d,fail_add_partition_8";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_8";
+SET SESSION debug="+d,fail_add_partition_9";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_9";
+SET SESSION debug="+d,fail_add_partition_10";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_10";
diff --git a/mysql-test/suite/parts/inc/partition_fail_change.inc b/mysql-test/suite/parts/inc/partition_fail_change.inc
new file mode 100644
index 00000000000..390dea34fab
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_fail_change.inc
@@ -0,0 +1,40 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 COALESCE/REBUILD/REORGANIZE PARTITION.
+--echo # Error recovery change partition (REORGANIZE/REBUILD/COALESCE
+--echo # or ADD HASH PARTITION).
+SET SESSION debug="+d,fail_change_partition_1";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_1";
+SET SESSION debug="+d,fail_change_partition_2";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_2";
+SET SESSION debug="+d,fail_change_partition_3";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_3";
+SET SESSION debug="+d,fail_change_partition_4";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_4";
+SET SESSION debug="+d,fail_change_partition_5";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_5";
+SET SESSION debug="+d,fail_change_partition_6";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_6";
+SET SESSION debug="+d,fail_change_partition_7";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_7";
+SET SESSION debug="+d,fail_change_partition_8";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_8";
+SET SESSION debug="+d,fail_change_partition_9";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_9";
+SET SESSION debug="+d,fail_change_partition_10";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_10";
+SET SESSION debug="+d,fail_change_partition_11";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_11";
+SET SESSION debug="+d,fail_change_partition_12";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_12";
diff --git a/mysql-test/suite/parts/inc/partition_fail_drop.inc b/mysql-test/suite/parts/inc/partition_fail_drop.inc
new file mode 100644
index 00000000000..54a57ba845f
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_fail_drop.inc
@@ -0,0 +1,30 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 DROP PARTITION.
+--echo # Error recovery DROP PARTITION
+SET SESSION debug="+d,fail_drop_partition_1";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_1";
+SET SESSION debug="+d,fail_drop_partition_2";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_2";
+SET SESSION debug="+d,fail_drop_partition_3";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_3";
+SET SESSION debug="+d,fail_drop_partition_4";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_4";
+SET SESSION debug="+d,fail_drop_partition_5";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_5";
+SET SESSION debug="+d,fail_drop_partition_6";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_6";
+SET SESSION debug="+d,fail_drop_partition_7";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_7";
+SET SESSION debug="+d,fail_drop_partition_8";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_8";
+SET SESSION debug="+d,fail_drop_partition_9";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_9";
diff --git a/mysql-test/suite/parts/inc/partition_mgm.inc b/mysql-test/suite/parts/inc/partition_mgm.inc
index 9dfa2b2ffb3..67d1feb8046 100644
--- a/mysql-test/suite/parts/inc/partition_mgm.inc
+++ b/mysql-test/suite/parts/inc/partition_mgm.inc
@@ -533,6 +533,8 @@ PARTITION BY KEY (a)
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
--error ER_PARTITION_MGMT_ON_NONPARTITIONED, ER_ILLEGAL_HA
ALTER TABLE t1 TRUNCATE PARTITION MAX;
+--sorted_result
+SELECT * FROM t1;
}
if (!$no_truncate)
{
diff --git a/mysql-test/suite/parts/inc/partition_mgm_crash.inc b/mysql-test/suite/parts/inc/partition_mgm_crash.inc
new file mode 100644
index 00000000000..2148d7ed1b6
--- /dev/null
+++ b/mysql-test/suite/parts/inc/partition_mgm_crash.inc
@@ -0,0 +1,34 @@
+# collection of tests which crashes the server and checks recovery.
+# also using error injection to test recovery of failures.
+# uses $DATADIR and $engine
+
+--echo #
+--echo # Bug#53676: Unexpected errors and possible table corruption on
+--echo # ADD PARTITION and LOCK TABLE
+--echo # Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
+--echo # after timed out COALESCE PARTITION
+--echo # Extended crash recovery testing of fast_alter_partition_table.
+call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
+
+let $create_statement= CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = $engine
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+let $insert_statement= INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+
+let $crash_statement= ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+--source suite/parts/inc/partition_crash_add.inc
+let $fail_statement= $crash_statement;
+--source suite/parts/inc/partition_fail_add.inc
+let $crash_statement= ALTER TABLE t1 DROP PARTITION p10;
+--source suite/parts/inc/partition_crash_drop.inc
+let $fail_statement= $crash_statement;
+--source suite/parts/inc/partition_fail_drop.inc
+let $crash_statement= ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+--source suite/parts/inc/partition_crash_change.inc
+let $fail_statement= $crash_statement;
+--source suite/parts/inc/partition_fail_change.inc
diff --git a/mysql-test/suite/parts/r/part_ctype_utf32.result b/mysql-test/suite/parts/r/part_ctype_utf32.result
new file mode 100644
index 00000000000..5d52a8eace4
--- /dev/null
+++ b/mysql-test/suite/parts/r/part_ctype_utf32.result
@@ -0,0 +1,14 @@
+#
+# Bug#52121 partition by key on utf32 enum field cause debug assertion: (length % 4) == 0
+#
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (
+a enum('a') CHARACTER SET utf32 COLLATE utf32_spanish2_ci
+) ENGINE=MYISAM PARTITION BY KEY(a) PARTITIONS 2;
+INSERT INTO t1 VALUES ('a');
+SELECT * FROM t1;
+a
+a
+DROP TABLE t1;
diff --git a/mysql-test/suite/parts/r/partition_debug_innodb.result b/mysql-test/suite/parts/r/partition_debug_innodb.result
new file mode 100644
index 00000000000..eb2218e204e
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_debug_innodb.result
@@ -0,0 +1,3923 @@
+DROP TABLE IF EXISTS t1;
+call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was");
+call mtr.add_suppression("InnoDB: Error: table .* does not exist in the InnoDB internal");
+call mtr.add_suppression("InnoDB: Warning: MySQL is trying to drop table ");
+# Test crash and failure recovery in fast_alter_partition_table.
+#
+# Bug#53676: Unexpected errors and possible table corruption on
+# ADD PARTITION and LOCK TABLE
+# Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
+# after timed out COALESCE PARTITION
+# Extended crash recovery testing of fast_alter_partition_table.
+call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
+# Crash testing ADD PARTITION
+SET SESSION debug="+d,crash_add_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_1";
+SET SESSION debug="+d,crash_add_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_2";
+SET SESSION debug="+d,crash_add_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_3";
+SET SESSION debug="+d,crash_add_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_4";
+SET SESSION debug="+d,crash_add_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_5";
+SET SESSION debug="+d,crash_add_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_6";
+SET SESSION debug="+d,crash_add_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_7";
+SET SESSION debug="+d,crash_add_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_8";
+SET SESSION debug="+d,crash_add_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_9";
+SET SESSION debug="+d,crash_add_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_10";
+# Error recovery testing ADD PARTITION
+SET SESSION debug="+d,fail_add_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_1";
+SET SESSION debug="+d,fail_add_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_2";
+SET SESSION debug="+d,fail_add_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_3";
+SET SESSION debug="+d,fail_add_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_4";
+SET SESSION debug="+d,fail_add_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_5";
+SET SESSION debug="+d,fail_add_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_6";
+SET SESSION debug="+d,fail_add_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_7";
+SET SESSION debug="+d,fail_add_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_8";
+SET SESSION debug="+d,fail_add_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_9";
+SET SESSION debug="+d,fail_add_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_10";
+# Test DROP PARTITION
+SET SESSION debug="+d,crash_drop_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_1";
+SET SESSION debug="+d,crash_drop_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_2";
+SET SESSION debug="+d,crash_drop_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_3";
+SET SESSION debug="+d,crash_drop_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_4";
+SET SESSION debug="+d,crash_drop_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_5";
+SET SESSION debug="+d,crash_drop_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_6";
+SET SESSION debug="+d,crash_drop_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_7";
+SET SESSION debug="+d,crash_drop_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_8";
+SET SESSION debug="+d,crash_drop_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_9";
+# Error recovery DROP PARTITION
+SET SESSION debug="+d,fail_drop_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_1";
+SET SESSION debug="+d,fail_drop_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_2";
+SET SESSION debug="+d,fail_drop_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_3";
+SET SESSION debug="+d,fail_drop_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_4";
+SET SESSION debug="+d,fail_drop_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_5";
+SET SESSION debug="+d,fail_drop_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_6";
+SET SESSION debug="+d,fail_drop_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_7";
+SET SESSION debug="+d,fail_drop_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_8";
+SET SESSION debug="+d,fail_drop_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_9";
+# Test change partition (REORGANIZE/REBUILD/COALESCE
+# or ADD HASH PARTITION).
+SET SESSION debug="+d,crash_change_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_1";
+SET SESSION debug="+d,crash_change_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_2";
+SET SESSION debug="+d,crash_change_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_3";
+SET SESSION debug="+d,crash_change_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_4";
+SET SESSION debug="+d,crash_change_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_5";
+SET SESSION debug="+d,crash_change_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_6";
+SET SESSION debug="+d,crash_change_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_7";
+SET SESSION debug="+d,crash_change_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_8";
+SET SESSION debug="+d,crash_change_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_9";
+SET SESSION debug="+d,crash_change_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_10";
+SET SESSION debug="+d,crash_change_partition_11";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_11";
+SET SESSION debug="+d,crash_change_partition_12";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_12";
+# Error recovery change partition (REORGANIZE/REBUILD/COALESCE
+# or ADD HASH PARTITION).
+SET SESSION debug="+d,fail_change_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_1";
+SET SESSION debug="+d,fail_change_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_2";
+SET SESSION debug="+d,fail_change_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_3";
+SET SESSION debug="+d,fail_change_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_4";
+SET SESSION debug="+d,fail_change_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_5";
+SET SESSION debug="+d,fail_change_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_6";
+SET SESSION debug="+d,fail_change_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_7";
+SET SESSION debug="+d,fail_change_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_8";
+SET SESSION debug="+d,fail_change_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_9";
+SET SESSION debug="+d,fail_change_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_10";
+SET SESSION debug="+d,fail_change_partition_11";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_11";
+SET SESSION debug="+d,fail_change_partition_12";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+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,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_12";
diff --git a/mysql-test/suite/parts/r/partition_debug_myisam.result b/mysql-test/suite/parts/r/partition_debug_myisam.result
new file mode 100644
index 00000000000..d3f40aedee5
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_debug_myisam.result
@@ -0,0 +1,4256 @@
+DROP TABLE IF EXISTS t1;
+# Test crash and failure recovery in fast_alter_partition_table.
+#
+# Bug#53676: Unexpected errors and possible table corruption on
+# ADD PARTITION and LOCK TABLE
+# Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
+# after timed out COALESCE PARTITION
+# Extended crash recovery testing of fast_alter_partition_table.
+call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
+# Crash testing ADD PARTITION
+SET SESSION debug="+d,crash_add_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_1";
+SET SESSION debug="+d,crash_add_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_2";
+SET SESSION debug="+d,crash_add_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_3";
+SET SESSION debug="+d,crash_add_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_4";
+SET SESSION debug="+d,crash_add_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_5";
+SET SESSION debug="+d,crash_add_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_6";
+SET SESSION debug="+d,crash_add_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_7";
+SET SESSION debug="+d,crash_add_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_8";
+SET SESSION debug="+d,crash_add_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_9";
+SET SESSION debug="+d,crash_add_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_10";
+# Error recovery testing ADD PARTITION
+SET SESSION debug="+d,fail_add_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_1";
+SET SESSION debug="+d,fail_add_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_2";
+SET SESSION debug="+d,fail_add_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_3";
+SET SESSION debug="+d,fail_add_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_4";
+SET SESSION debug="+d,fail_add_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_5";
+SET SESSION debug="+d,fail_add_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_6";
+SET SESSION debug="+d,fail_add_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_7";
+SET SESSION debug="+d,fail_add_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_8";
+SET SESSION debug="+d,fail_add_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_9";
+SET SESSION debug="+d,fail_add_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_10";
+# Test DROP PARTITION
+SET SESSION debug="+d,crash_drop_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_1";
+SET SESSION debug="+d,crash_drop_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_2";
+SET SESSION debug="+d,crash_drop_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_3";
+SET SESSION debug="+d,crash_drop_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_4";
+SET SESSION debug="+d,crash_drop_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_5";
+SET SESSION debug="+d,crash_drop_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_6";
+SET SESSION debug="+d,crash_drop_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_7";
+SET SESSION debug="+d,crash_drop_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_8";
+SET SESSION debug="+d,crash_drop_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_9";
+# Error recovery DROP PARTITION
+SET SESSION debug="+d,fail_drop_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_1";
+SET SESSION debug="+d,fail_drop_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_2";
+SET SESSION debug="+d,fail_drop_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_3";
+SET SESSION debug="+d,fail_drop_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_4";
+SET SESSION debug="+d,fail_drop_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_5";
+SET SESSION debug="+d,fail_drop_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_6";
+SET SESSION debug="+d,fail_drop_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_7";
+SET SESSION debug="+d,fail_drop_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_8";
+SET SESSION debug="+d,fail_drop_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_9";
+# Test change partition (REORGANIZE/REBUILD/COALESCE
+# or ADD HASH PARTITION).
+SET SESSION debug="+d,crash_change_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_1";
+SET SESSION debug="+d,crash_change_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_2";
+SET SESSION debug="+d,crash_change_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_3";
+SET SESSION debug="+d,crash_change_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_4";
+SET SESSION debug="+d,crash_change_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_5";
+SET SESSION debug="+d,crash_change_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_6";
+SET SESSION debug="+d,crash_change_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_7";
+SET SESSION debug="+d,crash_change_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_8";
+SET SESSION debug="+d,crash_change_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_9";
+SET SESSION debug="+d,crash_change_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_10";
+SET SESSION debug="+d,crash_change_partition_11";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_11";
+SET SESSION debug="+d,crash_change_partition_12";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_12";
+# Error recovery change partition (REORGANIZE/REBUILD/COALESCE
+# or ADD HASH PARTITION).
+SET SESSION debug="+d,fail_change_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_1";
+SET SESSION debug="+d,fail_change_partition_2";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_2";
+SET SESSION debug="+d,fail_change_partition_3";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_3";
+SET SESSION debug="+d,fail_change_partition_4";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_4";
+SET SESSION debug="+d,fail_change_partition_5";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_5";
+SET SESSION debug="+d,fail_change_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_6";
+SET SESSION debug="+d,fail_change_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_7";
+SET SESSION debug="+d,fail_change_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_8";
+SET SESSION debug="+d,fail_change_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_9";
+SET SESSION debug="+d,fail_change_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_10";
+SET SESSION debug="+d,fail_change_partition_11";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_11";
+SET SESSION debug="+d,fail_change_partition_12";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a b
+1 Original from partition p0
+11 Original from partition p1
+12 Original from partition p1
+13 Original from partition p1
+14 Original from partition p1
+2 Original from partition p0
+3 Original from partition p0
+4 Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_12";
diff --git a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
index 9e72259a150..268db30bda0 100644
--- a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
+++ b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
@@ -1,4 +1,38 @@
#
+# Bug#49907: ALTER TABLE ... TRUNCATE PARTITION
+# does not wait for locks on the table
+#
+CREATE TABLE t1 (a INT)
+ENGINE = InnoDB
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (15),
+PARTITION pMax VALUES LESS THAN MAXVALUE);
+INSERT INTO t1 VALUES (1), (11), (21), (33);
+BEGIN;
+DELETE FROM t1 WHERE a = 11;
+SELECT * FROM t1;
+a
+1
+21
+33
+# con1 (send)
+ALTER TABLE t1 TRUNCATE PARTITION pMax;
+# con default
+SELECT * FROM t1;
+a
+1
+21
+33
+# Commit will allow the TRUNCATE to finish
+COMMIT;
+# con1 (reap)
+# con1 (disconnect)
+# default connection
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+#
# Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
# concurrent I_S query
create table t1 (a int)
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc0_archive.result b/mysql-test/suite/parts/r/partition_mgm_lc0_archive.result
index 4f623813386..f4d76874b4c 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc0_archive.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc0_archive.result
@@ -927,6 +927,16 @@ PARTITION MAX);
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
ALTER TABLE t1 TRUNCATE PARTITION MAX;
Got one of the listed errors
+SELECT * FROM t1;
+a b
+1 First
+1000 First in LT2000
+1001 Second in LT2000
+1999 Last in LT2000
+2 Second
+2000 First in MAX
+2001 Second in MAX
+999 Last in LT1000
# Cleaning up before exit
USE test;
DROP DATABASE MySQL_Test_DB;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_archive.result b/mysql-test/suite/parts/r/partition_mgm_lc1_archive.result
index 4cd8cafa3ee..1113e7dcb0c 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc1_archive.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc1_archive.result
@@ -894,6 +894,16 @@ PARTITION MAX);
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
ALTER TABLE t1 TRUNCATE PARTITION MAX;
Got one of the listed errors
+SELECT * FROM t1;
+a b
+1 First
+1000 First in LT2000
+1001 Second in LT2000
+1999 Last in LT2000
+2 Second
+2000 First in MAX
+2001 Second in MAX
+999 Last in LT1000
# Cleaning up before exit
USE test;
DROP DATABASE MySQL_Test_DB;
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_archive.result b/mysql-test/suite/parts/r/partition_mgm_lc2_archive.result
index 6e8abfef06d..e71803fcac9 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc2_archive.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc2_archive.result
@@ -894,6 +894,16 @@ PARTITION MAX);
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
ALTER TABLE t1 TRUNCATE PARTITION MAX;
Got one of the listed errors
+SELECT * FROM t1;
+a b
+1 First
+1000 First in LT2000
+1001 Second in LT2000
+1999 Last in LT2000
+2 Second
+2000 First in MAX
+2001 Second in MAX
+999 Last in LT1000
# Cleaning up before exit
USE test;
DROP DATABASE MySQL_Test_DB;
diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result
index a9c5b2e766e..b8dffd61fbe 100644
--- a/mysql-test/suite/parts/r/partition_special_innodb.result
+++ b/mysql-test/suite/parts/r/partition_special_innodb.result
@@ -216,3 +216,71 @@ SET SESSION lock_wait_timeout= 1;
ALTER TABLE t1 AUTO_INCREMENT = 10;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DROP TABLE t1;
+#
+# Bug#53676: Unexpected errors and possible table corruption on
+# ADD PARTITION and LOCK TABLE
+CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+SET lock_wait_timeout = 2;
+#Connection 1 locks the table
+LOCK TABLE t1 READ;
+# Connection 2 tries to add partitions:
+# First attempt: lock wait timeout (as expected)
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Second attempt: says that partition already exists
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Connection 1 unlocks the table and locks it again:
+UNLOCK TABLES;
+LOCK TABLE t1 READ;
+# Connection 2 tries again to add partitions:
+# Third attempt: says that the table does not exist
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Check table returns the same
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error Lock wait timeout exceeded; try restarting transaction
+test.t1 check error Corrupt
+UNLOCK TABLES;
+DROP TABLE t1;
+CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+SET lock_wait_timeout = 2;
+LOCK TABLE t2 READ;
+ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
+UNLOCK TABLES;
+CHECK TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+SELECT * FROM t2;
+i f
+DROP TABLE t2;
+CREATE TABLE t3 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+SET lock_wait_timeout = 2;
+# Connection 1 locks the table
+LOCK TABLE t3 READ;
+# Connection 2 tries to add partitions (timeout):
+ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SET lock_wait_timeout = 2;
+# Connection 3 tries to add partitions (partition already exists):
+ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Connection 4 tries to rename the table:
+RENAME TABLE t3 TO t4;
+# Connection 1 unlocks the table:
+UNLOCK TABLES;
+# Connection 4 gets error on rename:
+# SHOW TABLES returns the table (not renamed):
+SHOW TABLES;
+Tables_in_test
+t4
+# Connection 5 attempts to read from the table (table does not exist):
+SELECT * FROM t3;
+ERROR 42S02: Table 'test.t3' doesn't exist
+DROP TABLE t4;
diff --git a/mysql-test/suite/parts/r/partition_special_myisam.result b/mysql-test/suite/parts/r/partition_special_myisam.result
index 60c9f9666cd..f8618fcbb6d 100644
--- a/mysql-test/suite/parts/r/partition_special_myisam.result
+++ b/mysql-test/suite/parts/r/partition_special_myisam.result
@@ -200,3 +200,22 @@ a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f
1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi
1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
drop table t1;
+#
+# Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
+# after timed out COALESCE PARTITION
+CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ENGINE = MyISAM PARTITION BY HASH(i) PARTITIONS 3;
+# Connection 1 starts transaction and gets lock
+START TRANSACTION;
+SELECT * FROM t1;
+i f
+SET lock_wait_timeout = 2;
+# Connection 2 tries to coalesce partitions (timeout):
+ALTER TABLE t1 COALESCE PARTITION 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Connection 3 tries to load into the table:
+LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f);
+# Connection 1 commits the transaction
+COMMIT;
+# Connection 3...
+DROP TABLE t1;
diff --git a/mysql-test/suite/parts/t/part_ctype_utf32.test b/mysql-test/suite/parts/t/part_ctype_utf32.test
new file mode 100644
index 00000000000..12aa1fb3751
--- /dev/null
+++ b/mysql-test/suite/parts/t/part_ctype_utf32.test
@@ -0,0 +1,28 @@
+################################################################################
+# t/partition_ctype_utf32.test #
+# #
+# Purpose: #
+# Tests for partitions + UTF32 #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: Alexander Barkov #
+# Original Date: 2010-08-05 #
+# Change Author: #
+# Change Date: #
+# Change: #
+################################################################################
+
+--source include/have_partition.inc
+--source include/have_utf32.inc
+
+--echo #
+--echo # Bug#52121 partition by key on utf32 enum field cause debug assertion: (length % 4) == 0
+--echo #
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+ a enum('a') CHARACTER SET utf32 COLLATE utf32_spanish2_ci
+) ENGINE=MYISAM PARTITION BY KEY(a) PARTITIONS 2;
+INSERT INTO t1 VALUES ('a');
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/parts/t/partition_debug_innodb-master.opt b/mysql-test/suite/parts/t/partition_debug_innodb-master.opt
new file mode 100644
index 00000000000..d6c06191422
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_debug_innodb-master.opt
@@ -0,0 +1 @@
+--innodb-file-format-check --innodb-file-per-table=1 --skip-stack-trace --skip-core-file
diff --git a/mysql-test/suite/parts/t/partition_debug_innodb.test b/mysql-test/suite/parts/t/partition_debug_innodb.test
new file mode 100644
index 00000000000..c5d8df33213
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_debug_innodb.test
@@ -0,0 +1,26 @@
+# Partitioning test that require debug features
+# including crashing tests.
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+--source include/have_partition.inc
+--source include/not_valgrind.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $DATADIR= `SELECT @@datadir;`
+
+# Checking with #innodb what this is...
+call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was");
+# If there is a crash or failure between the ddl_log is written and the
+# operation is completed, mysql will try to drop a not yet created partition
+call mtr.add_suppression("InnoDB: Error: table .* does not exist in the InnoDB internal");
+call mtr.add_suppression("InnoDB: Warning: MySQL is trying to drop table ");
+
+
+let $engine= 'InnoDB';
+
+--echo # Test crash and failure recovery in fast_alter_partition_table.
+--source suite/parts/inc/partition_mgm_crash.inc
diff --git a/mysql-test/suite/parts/t/partition_debug_myisam-master.opt b/mysql-test/suite/parts/t/partition_debug_myisam-master.opt
new file mode 100644
index 00000000000..425fda95086
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_debug_myisam-master.opt
@@ -0,0 +1 @@
+--skip-stack-trace --skip-core-file
diff --git a/mysql-test/suite/parts/t/partition_debug_myisam.test b/mysql-test/suite/parts/t/partition_debug_myisam.test
new file mode 100644
index 00000000000..a4d5ee4bf04
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_debug_myisam.test
@@ -0,0 +1,17 @@
+# Partitioning test that require debug features
+# including crashing tests.
+
+--source include/have_debug.inc
+--source include/have_partition.inc
+--source include/not_valgrind.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $DATADIR= `SELECT @@datadir;`
+
+let $engine= 'MyISAM';
+
+--echo # Test crash and failure recovery in fast_alter_partition_table.
+--source suite/parts/inc/partition_mgm_crash.inc
diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
index 79ef3d537bf..915a3f2ceb6 100644
--- a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
+++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
@@ -5,6 +5,48 @@
let $MYSQLD_DATADIR=`SELECT @@datadir`;
--echo #
+--echo # Bug#49907: ALTER TABLE ... TRUNCATE PARTITION
+--echo # does not wait for locks on the table
+--echo #
+CREATE TABLE t1 (a INT)
+ENGINE = InnoDB
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (15),
+ PARTITION pMax VALUES LESS THAN MAXVALUE);
+INSERT INTO t1 VALUES (1), (11), (21), (33);
+BEGIN;
+DELETE FROM t1 WHERE a = 11;
+--sorted_result
+SELECT * FROM t1;
+
+--connect (con1, localhost, root,,)
+--echo # con1 (send)
+--send
+ALTER TABLE t1 TRUNCATE PARTITION pMax;
+
+--connection default
+--echo # con default
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE STATE = "Waiting for table metadata lock" AND
+ INFO = "ALTER TABLE t1 TRUNCATE PARTITION pMax";
+--source include/wait_condition.inc
+--sorted_result
+SELECT * FROM t1;
+--echo # Commit will allow the TRUNCATE to finish
+COMMIT;
+
+--echo # con1 (reap)
+--connection con1
+--reap
+--echo # con1 (disconnect)
+--disconnect con1
+--connection default
+--echo # default connection
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
--echo # concurrent I_S query
create table t1 (a int)
diff --git a/mysql-test/suite/parts/t/partition_special_innodb-master.opt b/mysql-test/suite/parts/t/partition_special_innodb-master.opt
index e76299453d3..624645d75c7 100644
--- a/mysql-test/suite/parts/t/partition_special_innodb-master.opt
+++ b/mysql-test/suite/parts/t/partition_special_innodb-master.opt
@@ -1 +1 @@
---innodb_lock_wait_timeout=2
+--innodb_lock_wait_timeout=2 --innodb-file-per-table=1
diff --git a/mysql-test/suite/parts/t/partition_special_innodb.test b/mysql-test/suite/parts/t/partition_special_innodb.test
index 833e489558e..9c26ab6fdb4 100644
--- a/mysql-test/suite/parts/t/partition_special_innodb.test
+++ b/mysql-test/suite/parts/t/partition_special_innodb.test
@@ -76,3 +76,132 @@ ALTER TABLE t1 AUTO_INCREMENT = 10;
--disconnect con1
--connection default
DROP TABLE t1;
+
+--echo #
+--echo # Bug#53676: Unexpected errors and possible table corruption on
+--echo # ADD PARTITION and LOCK TABLE
+--connect (con1,localhost,root,,)
+CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 2;
+
+--connection con1
+--echo #Connection 1 locks the table
+LOCK TABLE t1 READ;
+
+--connection con2
+--echo # Connection 2 tries to add partitions:
+--echo # First attempt: lock wait timeout (as expected)
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+--echo # Second attempt: says that partition already exists
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+
+--connection con1
+--echo # Connection 1 unlocks the table and locks it again:
+UNLOCK TABLES;
+--real_sleep 1
+LOCK TABLE t1 READ;
+
+--connection con2
+--echo # Connection 2 tries again to add partitions:
+--echo # Third attempt: says that the table does not exist
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+--echo # Check table returns the same
+CHECK TABLE t1;
+
+--connection con1
+UNLOCK TABLES;
+
+--connection con2
+DROP TABLE t1;
+
+# End of Test1
+
+# Test2
+
+--connection con1
+
+CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+
+--connection con2
+SET lock_wait_timeout = 2;
+
+--connection con1
+LOCK TABLE t2 READ;
+
+--connection con2
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
+send ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
+
+--connection con1
+UNLOCK TABLES;
+
+--connection con2
+--reap
+
+--connect (con3,localhost,root,,)
+CHECK TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+
+# End of Test2
+# Test #3
+
+--connection con1
+
+CREATE TABLE t3 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+
+--connection con2
+SET lock_wait_timeout = 2;
+
+--connection con1
+--echo # Connection 1 locks the table
+LOCK TABLE t3 READ;
+
+--connection con2
+--echo # Connection 2 tries to add partitions (timeout):
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
+
+--connection con3
+SET lock_wait_timeout = 2;
+--echo # Connection 3 tries to add partitions (partition already exists):
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
+
+--connect (con4,localhost,root,,)
+--echo # Connection 4 tries to rename the table:
+send RENAME TABLE t3 TO t4;
+
+--connection con1
+--real_sleep 1
+--echo # Connection 1 unlocks the table:
+UNLOCK TABLES;
+
+--connection con4
+--echo # Connection 4 gets error on rename:
+--reap
+
+--connect (con5,localhost,root,,)
+--echo # SHOW TABLES returns the table (not renamed):
+SHOW TABLES;
+--echo # Connection 5 attempts to read from the table (table does not exist):
+--error ER_NO_SUCH_TABLE
+SELECT * FROM t3;
+DROP TABLE t4;
+
+--disconnect con5
+--disconnect con4
+--disconnect con3
+--disconnect con2
+--disconnect con1
+--connection default
+# End of Test #3
diff --git a/mysql-test/suite/parts/t/partition_special_myisam.test b/mysql-test/suite/parts/t/partition_special_myisam.test
index e1737ebc3c2..032722cbb7d 100644
--- a/mysql-test/suite/parts/t/partition_special_myisam.test
+++ b/mysql-test/suite/parts/t/partition_special_myisam.test
@@ -43,3 +43,43 @@ let $engine= 'MyISAM';
--source suite/parts/inc/partition_key_8col.inc
--source suite/parts/inc/partition_key_16col.inc
--source suite/parts/inc/partition_key_32col.inc
+
+--echo #
+--echo # Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
+--echo # after timed out COALESCE PARTITION
+CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ ENGINE = MyISAM PARTITION BY HASH(i) PARTITIONS 3;
+
+--echo # Connection 1 starts transaction and gets lock
+START TRANSACTION;
+SELECT * FROM t1;
+
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 2;
+--echo # Connection 2 tries to coalesce partitions (timeout):
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 COALESCE PARTITION 2;
+
+--connect (con3,localhost,root,,)
+
+perl;
+open( LD, ">" . "/tmp/load.in" ) || die "Could not open file for writing " . $ENV{'MYSQLTEST_DATADIR'} . "/test/load.in";
+print LD "1\n2\n3\n";
+close( LD );
+EOF
+--echo # Connection 3 tries to load into the table:
+send LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f);
+
+--connection default
+--real_sleep 1
+--echo # Connection 1 commits the transaction
+COMMIT;
+
+--connection con3
+--echo # Connection 3...
+--reap
+DROP TABLE t1;
+
+--disconnect con3
+--disconnect con2
+--connection default
diff --git a/mysql-test/suite/perfschema/include/setup_helper.inc b/mysql-test/suite/perfschema/include/setup_helper.inc
index 8a2dfa86496..1c8d4e412d5 100644
--- a/mysql-test/suite/perfschema/include/setup_helper.inc
+++ b/mysql-test/suite/perfschema/include/setup_helper.inc
@@ -25,17 +25,17 @@ update performance_schema.SETUP_CONSUMERS set enabled='YES';
connect (con1, localhost, root, , );
-let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID in (select connection_id())`;
connect (con2, localhost, root, , );
-let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID in (select connection_id())`;
connect (con3, localhost, root, , );
-let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID in (select connection_id())`;
connection default;
@@ -49,6 +49,6 @@ prepare stmt_dump_events from
where thread_id=? order by event_id;";
prepare stmt_dump_thread from
- "select name from performance_schema.PROCESSLIST where thread_id=? ;";
+ "select name from performance_schema.THREADS where thread_id=? ;";
--enable_query_log
diff --git a/mysql-test/suite/perfschema/include/start_server_common.inc b/mysql-test/suite/perfschema/include/start_server_common.inc
index fa1cb953f59..083b302c5f7 100644
--- a/mysql-test/suite/perfschema/include/start_server_common.inc
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc
@@ -29,20 +29,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
--enable_result_log
# This has a stable output, printing the result:
diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result
index 197378ca38f..c7ac05ba69d 100644
--- a/mysql-test/suite/perfschema/r/aggregate.result
+++ b/mysql-test/suite/perfschema/r/aggregate.result
@@ -4,7 +4,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO';
update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
+truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
@@ -49,14 +49,14 @@ OR @dump_all;
EVENT_NAME SUM_NUMBER_OF_BYTES_WRITE SUM(i.SUM_NUMBER_OF_BYTES_WRITE)
"Verifying waits aggregate consistency (instance)"
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
OR @dump_all;
EVENT_NAME SUM_TIMER_WAIT SUM(i.SUM_TIMER_WAIT)
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
@@ -64,7 +64,7 @@ AND (MIN(i.MIN_TIMER_WAIT) != 0)
OR @dump_all;
EVENT_NAME MIN_TIMER_WAIT MIN(i.MIN_TIMER_WAIT)
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
@@ -72,7 +72,7 @@ OR @dump_all;
EVENT_NAME MAX_TIMER_WAIT MAX(i.MAX_TIMER_WAIT)
"Verifying waits aggregate consistency (thread)"
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
@@ -80,7 +80,7 @@ HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT))
OR @dump_all;
EVENT_NAME SUM_TIMER_WAIT SUM(t.SUM_TIMER_WAIT)
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
@@ -89,7 +89,7 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0)
OR @dump_all;
EVENT_NAME MIN_TIMER_WAIT MIN(t.MIN_TIMER_WAIT)
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
diff --git a/mysql-test/suite/perfschema/r/bad_option_3.result b/mysql-test/suite/perfschema/r/bad_option_3.result
new file mode 100644
index 00000000000..ec717d6f7d2
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/bad_option_3.result
@@ -0,0 +1,2 @@
+Found: unknown option '-x'
+Found: Aborting
diff --git a/mysql-test/suite/perfschema/r/bad_option_4.result b/mysql-test/suite/perfschema/r/bad_option_4.result
new file mode 100644
index 00000000000..812ee546200
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/bad_option_4.result
@@ -0,0 +1,2 @@
+Found: Can't change dir to.*bad_option_h_param
+Found: Aborting
diff --git a/mysql-test/suite/perfschema/r/bad_option_5.result b/mysql-test/suite/perfschema/r/bad_option_5.result
new file mode 100644
index 00000000000..b318b6e0482
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/bad_option_5.result
@@ -0,0 +1,2 @@
+Found: unknown option '-X'
+Found: Aborting
diff --git a/mysql-test/suite/perfschema/r/binlog_mix.result b/mysql-test/suite/perfschema/r/binlog_mix.result
index b437f4eda1f..1e58179af51 100644
--- a/mysql-test/suite/perfschema/r/binlog_mix.result
+++ b/mysql-test/suite/perfschema/r/binlog_mix.result
@@ -28,8 +28,8 @@ master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUME
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table if exists test.t1
-master-bin.000001 # Query # # use `test`; drop table if exists test.t2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer)
master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128))
master-bin.000001 # Query # # BEGIN
@@ -40,8 +40,8 @@ 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 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table test.t1
-master-bin.000001 # Query # # use `test`; drop table test.t2
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS)
master-bin.000001 # Update_rows # # table_id: #
diff --git a/mysql-test/suite/perfschema/r/binlog_row.result b/mysql-test/suite/perfschema/r/binlog_row.result
index 50a201a81d9..28803c73a84 100644
--- a/mysql-test/suite/perfschema/r/binlog_row.result
+++ b/mysql-test/suite/perfschema/r/binlog_row.result
@@ -28,8 +28,8 @@ master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUME
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table if exists test.t1
-master-bin.000001 # Query # # use `test`; drop table if exists test.t2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer)
master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128))
master-bin.000001 # Query # # BEGIN
@@ -40,8 +40,8 @@ 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 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table test.t1
-master-bin.000001 # Query # # use `test`; drop table test.t2
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS)
master-bin.000001 # Update_rows # # table_id: #
diff --git a/mysql-test/suite/perfschema/r/binlog_stmt.result b/mysql-test/suite/perfschema/r/binlog_stmt.result
index 531559763bc..288eba4d3d6 100644
--- a/mysql-test/suite/perfschema/r/binlog_stmt.result
+++ b/mysql-test/suite/perfschema/r/binlog_stmt.result
@@ -36,8 +36,8 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
where name like "wait/synch/rwlock/%"
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table if exists test.t1
-master-bin.000001 # Query # # use `test`; drop table if exists test.t2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer)
master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128))
master-bin.000001 # Query # # BEGIN
@@ -49,8 +49,8 @@ master-bin.000001 # Query # # use `test`; insert into test.t2
select name from performance_schema.SETUP_INSTRUMENTS
where name like "wait/synch/rwlock/%"
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table test.t1
-master-bin.000001 # Query # # use `test`; drop table test.t2
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
where name like "wait/synch/rwlock/%"
diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result
deleted file mode 100644
index 74fc4e1a640..00000000000
--- a/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result
+++ /dev/null
@@ -1,7 +0,0 @@
-alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME add column foo integer;
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(EVENT_NAME);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(EVENT_NAME);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result
new file mode 100644
index 00000000000..4f3ebcaea43
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result
@@ -0,0 +1,10 @@
+alter table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+add column foo integer;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+ADD INDEX test_index(EVENT_NAME);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+CREATE UNIQUE INDEX test_index
+ON performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(EVENT_NAME);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_setup_objects.result b/mysql-test/suite/perfschema/r/ddl_setup_objects.result
deleted file mode 100644
index c0f00745963..00000000000
--- a/mysql-test/suite/perfschema/r/ddl_setup_objects.result
+++ /dev/null
@@ -1,7 +0,0 @@
-alter table performance_schema.SETUP_OBJECTS add column foo integer;
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.SETUP_OBJECTS;
-ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/ddl_processlist.result b/mysql-test/suite/perfschema/r/ddl_threads.result
index 5a9eb766349..5d4b54d8bbe 100644
--- a/mysql-test/suite/perfschema/r/ddl_processlist.result
+++ b/mysql-test/suite/perfschema/r/ddl_threads.result
@@ -1,8 +1,8 @@
-alter table performance_schema.PROCESSLIST add column foo integer;
+alter table performance_schema.THREADS add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.PROCESSLIST;
+truncate table performance_schema.THREADS;
ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID);
+ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result
deleted file mode 100644
index 675fba021fe..00000000000
--- a/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result
+++ /dev/null
@@ -1,28 +0,0 @@
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-where event_name like 'Wait/Synch/%' limit 1;
-EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
-# # # # # #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-where event_name='FOO';
-EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
-insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
-avg_timer_wait=4, max_timer_wait=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-set count_star=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-set count_star=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-where count_star=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-UNLOCK TABLES;
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result
new file mode 100644
index 00000000000..64ede2fddac
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result
@@ -0,0 +1,28 @@
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+where event_name like 'Wait/Synch/%' limit 1;
+EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
+# # # # # #
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+where event_name='FOO';
+EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
+insert into performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
+avg_timer_wait=4, max_timer_wait=5;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+set count_star=12;
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+set count_star=12 where event_name like "FOO";
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+where count_star=1;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+UNLOCK TABLES;
+LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
index 55256894743..2338252976c 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@ -40,12 +40,12 @@ wait/synch/cond/sql/COND_flush_thread_cache YES YES
wait/synch/cond/sql/COND_global_read_lock YES YES
wait/synch/cond/sql/COND_manager YES YES
wait/synch/cond/sql/COND_queue_state YES YES
-wait/synch/cond/sql/COND_refresh YES YES
wait/synch/cond/sql/COND_rpl_status YES YES
wait/synch/cond/sql/COND_server_started YES YES
wait/synch/cond/sql/COND_thread_cache YES YES
wait/synch/cond/sql/COND_thread_count YES YES
wait/synch/cond/sql/Delayed_insert::cond YES YES
+wait/synch/cond/sql/Delayed_insert::cond_client YES YES
select * from performance_schema.SETUP_INSTRUMENTS
where name='Wait';
select * from performance_schema.SETUP_INSTRUMENTS
diff --git a/mysql-test/suite/perfschema/r/dml_setup_objects.result b/mysql-test/suite/perfschema/r/dml_setup_objects.result
deleted file mode 100644
index a9d97357227..00000000000
--- a/mysql-test/suite/perfschema/r/dml_setup_objects.result
+++ /dev/null
@@ -1,35 +0,0 @@
-select * from performance_schema.SETUP_OBJECTS;
-OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED
-select * from performance_schema.SETUP_OBJECTS
-where object_type = 'TABLE';
-OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED
-select * from performance_schema.SETUP_OBJECTS
-where enabled='YES';
-OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED
-insert into performance_schema.SETUP_OBJECTS
-set object_type='TABLE', object_schema='FOO', object_name='BAR',
-enabled='YES', timed='YES', aggregated='YES';
-ERROR HY000: Table storage engine for 'SETUP_OBJECTS' doesn't have this option
-update performance_schema.SETUP_OBJECTS
-set object_type='TABLE';
-update performance_schema.SETUP_OBJECTS
-set object_schema='ILLEGAL';
-update performance_schema.SETUP_OBJECTS
-set object_name='ILLEGAL';
-update performance_schema.SETUP_OBJECTS
-set enabled='NO';
-update performance_schema.SETUP_OBJECTS
-set timed='NO';
-update performance_schema.SETUP_OBJECTS
-set aggregated='NO';
-select * from performance_schema.SETUP_OBJECTS;
-OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED
-update performance_schema.SETUP_OBJECTS
-set enabled='YES', timed='YES', aggregated='YES';
-delete from performance_schema.SETUP_OBJECTS
-where object_type = 'TABLE';
-delete from performance_schema.SETUP_OBJECTS;
-LOCK TABLES performance_schema.SETUP_OBJECTS READ;
-UNLOCK TABLES;
-LOCK TABLES performance_schema.SETUP_OBJECTS WRITE;
-UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/dml_processlist.result b/mysql-test/suite/perfschema/r/dml_threads.result
index ee0da5a7f1d..b4fa8705c95 100644
--- a/mysql-test/suite/perfschema/r/dml_processlist.result
+++ b/mysql-test/suite/perfschema/r/dml_threads.result
@@ -1,27 +1,27 @@
-select * from performance_schema.PROCESSLIST
+select * from performance_schema.THREADS
where name like 'Thread/%' limit 1;
THREAD_ID ID NAME
# # #
-select * from performance_schema.PROCESSLIST
+select * from performance_schema.THREADS
where name='FOO';
THREAD_ID ID NAME
-insert into performance_schema.PROCESSLIST
+insert into performance_schema.THREADS
set name='FOO', thread_id=1, id=2;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-update performance_schema.PROCESSLIST
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'THREADS'
+update performance_schema.THREADS
set thread_id=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-update performance_schema.PROCESSLIST
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS'
+update performance_schema.THREADS
set thread_id=12 where name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-delete from performance_schema.PROCESSLIST
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS'
+delete from performance_schema.THREADS
where id=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-delete from performance_schema.PROCESSLIST;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-LOCK TABLES performance_schema.PROCESSLIST READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PROCESSLIST'
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
+delete from performance_schema.THREADS;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
+LOCK TABLES performance_schema.THREADS READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'THREADS'
UNLOCK TABLES;
-LOCK TABLES performance_schema.PROCESSLIST WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PROCESSLIST'
+LOCK TABLES performance_schema.THREADS WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'THREADS'
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result
index 69e6072fc22..201254aca21 100644
--- a/mysql-test/suite/perfschema/r/func_file_io.result
+++ b/mysql-test/suite/perfschema/r/func_file_io.result
@@ -90,27 +90,27 @@ SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write
FROM performance_schema.FILE_SUMMARY_BY_INSTANCE
WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL;
SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
WHERE COUNT_STAR > 0
ORDER BY SUM_TIMER_WAIT DESC
LIMIT 10;
SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
LEFT JOIN information_schema.PROCESSLIST i USING (ID)
GROUP BY i.user
ORDER BY SUM_WAIT DESC
LIMIT 20;
SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
WHERE p.ID = 1
GROUP BY h.EVENT_NAME
HAVING TOTAL_WAIT > 0;
SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
LEFT JOIN information_schema.PROCESSLIST i USING (ID)
GROUP BY i.user, h.operation
HAVING BYTES > 0
diff --git a/mysql-test/suite/perfschema/r/information_schema.result b/mysql-test/suite/perfschema/r/information_schema.result
index 86ebe80768c..8e7478564fb 100644
--- a/mysql-test/suite/perfschema/r/information_schema.result
+++ b/mysql-test/suite/perfschema/r/information_schema.result
@@ -6,20 +6,19 @@ performance_schema COND_INSTANCES def
performance_schema EVENTS_WAITS_CURRENT def
performance_schema EVENTS_WAITS_HISTORY def
performance_schema EVENTS_WAITS_HISTORY_LONG def
-performance_schema EVENTS_WAITS_SUMMARY_BY_EVENT_NAME def
performance_schema EVENTS_WAITS_SUMMARY_BY_INSTANCE def
performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME def
+performance_schema EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME def
performance_schema FILE_INSTANCES def
performance_schema FILE_SUMMARY_BY_EVENT_NAME def
performance_schema FILE_SUMMARY_BY_INSTANCE def
performance_schema MUTEX_INSTANCES def
performance_schema PERFORMANCE_TIMERS def
-performance_schema PROCESSLIST def
performance_schema RWLOCK_INSTANCES def
performance_schema SETUP_CONSUMERS def
performance_schema SETUP_INSTRUMENTS def
-performance_schema SETUP_OBJECTS def
performance_schema SETUP_TIMERS def
+performance_schema THREADS def
select upper(TABLE_NAME), TABLE_TYPE, ENGINE
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
@@ -28,20 +27,19 @@ COND_INSTANCES BASE TABLE PERFORMANCE_SCHEMA
EVENTS_WAITS_CURRENT BASE TABLE PERFORMANCE_SCHEMA
EVENTS_WAITS_HISTORY BASE TABLE PERFORMANCE_SCHEMA
EVENTS_WAITS_HISTORY_LONG BASE TABLE PERFORMANCE_SCHEMA
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA
EVENTS_WAITS_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA
FILE_INSTANCES BASE TABLE PERFORMANCE_SCHEMA
FILE_SUMMARY_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA
FILE_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA
MUTEX_INSTANCES BASE TABLE PERFORMANCE_SCHEMA
PERFORMANCE_TIMERS BASE TABLE PERFORMANCE_SCHEMA
-PROCESSLIST BASE TABLE PERFORMANCE_SCHEMA
RWLOCK_INSTANCES BASE TABLE PERFORMANCE_SCHEMA
SETUP_CONSUMERS BASE TABLE PERFORMANCE_SCHEMA
SETUP_INSTRUMENTS BASE TABLE PERFORMANCE_SCHEMA
-SETUP_OBJECTS BASE TABLE PERFORMANCE_SCHEMA
SETUP_TIMERS BASE TABLE PERFORMANCE_SCHEMA
+THREADS BASE TABLE PERFORMANCE_SCHEMA
select upper(TABLE_NAME), VERSION, ROW_FORMAT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
@@ -50,20 +48,19 @@ COND_INSTANCES 10 Dynamic
EVENTS_WAITS_CURRENT 10 Dynamic
EVENTS_WAITS_HISTORY 10 Dynamic
EVENTS_WAITS_HISTORY_LONG 10 Dynamic
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 10 Dynamic
EVENTS_WAITS_SUMMARY_BY_INSTANCE 10 Dynamic
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 10 Dynamic
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 10 Dynamic
FILE_INSTANCES 10 Dynamic
FILE_SUMMARY_BY_EVENT_NAME 10 Dynamic
FILE_SUMMARY_BY_INSTANCE 10 Dynamic
MUTEX_INSTANCES 10 Dynamic
PERFORMANCE_TIMERS 10 Fixed
-PROCESSLIST 10 Dynamic
RWLOCK_INSTANCES 10 Dynamic
SETUP_CONSUMERS 10 Dynamic
SETUP_INSTRUMENTS 10 Dynamic
-SETUP_OBJECTS 10 Dynamic
SETUP_TIMERS 10 Dynamic
+THREADS 10 Dynamic
select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
@@ -72,20 +69,19 @@ COND_INSTANCES 1000 0
EVENTS_WAITS_CURRENT 1000 0
EVENTS_WAITS_HISTORY 1000 0
EVENTS_WAITS_HISTORY_LONG 10000 0
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 1000 0
EVENTS_WAITS_SUMMARY_BY_INSTANCE 1000 0
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 1000 0
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 1000 0
FILE_INSTANCES 1000 0
FILE_SUMMARY_BY_EVENT_NAME 1000 0
FILE_SUMMARY_BY_INSTANCE 1000 0
MUTEX_INSTANCES 1000 0
PERFORMANCE_TIMERS 5 0
-PROCESSLIST 1000 0
RWLOCK_INSTANCES 1000 0
SETUP_CONSUMERS 8 0
SETUP_INSTRUMENTS 1000 0
-SETUP_OBJECTS 1000 0
SETUP_TIMERS 1 0
+THREADS 1000 0
select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
@@ -94,20 +90,19 @@ COND_INSTANCES 0 0
EVENTS_WAITS_CURRENT 0 0
EVENTS_WAITS_HISTORY 0 0
EVENTS_WAITS_HISTORY_LONG 0 0
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 0 0
EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 0 0
FILE_INSTANCES 0 0
FILE_SUMMARY_BY_EVENT_NAME 0 0
FILE_SUMMARY_BY_INSTANCE 0 0
MUTEX_INSTANCES 0 0
PERFORMANCE_TIMERS 0 0
-PROCESSLIST 0 0
RWLOCK_INSTANCES 0 0
SETUP_CONSUMERS 0 0
SETUP_INSTRUMENTS 0 0
-SETUP_OBJECTS 0 0
SETUP_TIMERS 0 0
+THREADS 0 0
select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
@@ -116,20 +111,19 @@ COND_INSTANCES 0 0 NULL
EVENTS_WAITS_CURRENT 0 0 NULL
EVENTS_WAITS_HISTORY 0 0 NULL
EVENTS_WAITS_HISTORY_LONG 0 0 NULL
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 0 0 NULL
EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0 NULL
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0 NULL
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME 0 0 NULL
FILE_INSTANCES 0 0 NULL
FILE_SUMMARY_BY_EVENT_NAME 0 0 NULL
FILE_SUMMARY_BY_INSTANCE 0 0 NULL
MUTEX_INSTANCES 0 0 NULL
PERFORMANCE_TIMERS 0 0 NULL
-PROCESSLIST 0 0 NULL
RWLOCK_INSTANCES 0 0 NULL
SETUP_CONSUMERS 0 0 NULL
SETUP_INSTRUMENTS 0 0 NULL
-SETUP_OBJECTS 0 0 NULL
SETUP_TIMERS 0 0 NULL
+THREADS 0 0 NULL
select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
@@ -138,20 +132,19 @@ COND_INSTANCES NULL NULL NULL
EVENTS_WAITS_CURRENT NULL NULL NULL
EVENTS_WAITS_HISTORY NULL NULL NULL
EVENTS_WAITS_HISTORY_LONG NULL NULL NULL
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME NULL NULL NULL
EVENTS_WAITS_SUMMARY_BY_INSTANCE NULL NULL NULL
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME NULL NULL NULL
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME NULL NULL NULL
FILE_INSTANCES NULL NULL NULL
FILE_SUMMARY_BY_EVENT_NAME NULL NULL NULL
FILE_SUMMARY_BY_INSTANCE NULL NULL NULL
MUTEX_INSTANCES NULL NULL NULL
PERFORMANCE_TIMERS NULL NULL NULL
-PROCESSLIST NULL NULL NULL
RWLOCK_INSTANCES NULL NULL NULL
SETUP_CONSUMERS NULL NULL NULL
SETUP_INSTRUMENTS NULL NULL NULL
-SETUP_OBJECTS NULL NULL NULL
SETUP_TIMERS NULL NULL NULL
+THREADS NULL NULL NULL
select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
@@ -160,20 +153,19 @@ COND_INSTANCES utf8_general_ci NULL
EVENTS_WAITS_CURRENT utf8_general_ci NULL
EVENTS_WAITS_HISTORY utf8_general_ci NULL
EVENTS_WAITS_HISTORY_LONG utf8_general_ci NULL
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME utf8_general_ci NULL
EVENTS_WAITS_SUMMARY_BY_INSTANCE utf8_general_ci NULL
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME utf8_general_ci NULL
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME utf8_general_ci NULL
FILE_INSTANCES utf8_general_ci NULL
FILE_SUMMARY_BY_EVENT_NAME utf8_general_ci NULL
FILE_SUMMARY_BY_INSTANCE utf8_general_ci NULL
MUTEX_INSTANCES utf8_general_ci NULL
PERFORMANCE_TIMERS utf8_general_ci NULL
-PROCESSLIST utf8_general_ci NULL
RWLOCK_INSTANCES utf8_general_ci NULL
SETUP_CONSUMERS utf8_general_ci NULL
SETUP_INSTRUMENTS utf8_general_ci NULL
-SETUP_OBJECTS utf8_general_ci NULL
SETUP_TIMERS utf8_general_ci NULL
+THREADS utf8_general_ci NULL
select upper(TABLE_NAME), TABLE_COMMENT
from information_schema.tables
where TABLE_SCHEMA='performance_schema';
@@ -182,17 +174,16 @@ COND_INSTANCES
EVENTS_WAITS_CURRENT
EVENTS_WAITS_HISTORY
EVENTS_WAITS_HISTORY_LONG
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
EVENTS_WAITS_SUMMARY_BY_INSTANCE
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
FILE_INSTANCES
FILE_SUMMARY_BY_EVENT_NAME
FILE_SUMMARY_BY_INSTANCE
MUTEX_INSTANCES
PERFORMANCE_TIMERS
-PROCESSLIST
RWLOCK_INSTANCES
SETUP_CONSUMERS
SETUP_INSTRUMENTS
-SETUP_OBJECTS
SETUP_TIMERS
+THREADS
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index 00619595749..e389a4ce65c 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -1,6 +1,6 @@
SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
WHERE THREAD_ID IN
-(SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+(SELECT THREAD_ID FROM performance_schema.THREADS)
AND EVENT_NAME IN
(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
WHERE NAME LIKE "wait/synch/%")
diff --git a/mysql-test/suite/perfschema/r/no_threads.result b/mysql-test/suite/perfschema/r/no_threads.result
index b38dc9fd733..79d16809eee 100644
--- a/mysql-test/suite/perfschema/r/no_threads.result
+++ b/mysql-test/suite/perfschema/r/no_threads.result
@@ -17,11 +17,11 @@ show variables like "performance_schema_max_thread%";
Variable_name Value
performance_schema_max_thread_classes 50
performance_schema_max_thread_instances 10
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
where name like "thread/sql/main";
count(*)
1
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
where name like "thread/sql/OneConnection";
count(*)
0
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result
index 9e2018f5c11..7a782687184 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result
@@ -12,21 +12,20 @@ ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1142: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_table";
Tables_in_performance_schema (user_table)
@@ -43,21 +42,20 @@ ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1142: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_view";
Tables_in_performance_schema (user_view)
@@ -72,21 +70,20 @@ ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1142: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -101,21 +98,20 @@ ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1142: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -130,21 +126,20 @@ ERROR 1050 (42S01) at line 183: Table 'COND_INSTANCES' already exists
ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1142: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1122: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.event where db='performance_schema';
name
diff --git a/mysql-test/suite/perfschema/r/schema.result b/mysql-test/suite/perfschema/r/schema.result
index d402df70ed5..a802539b7e0 100644
--- a/mysql-test/suite/perfschema/r/schema.result
+++ b/mysql-test/suite/perfschema/r/schema.result
@@ -12,20 +12,19 @@ COND_INSTANCES
EVENTS_WAITS_CURRENT
EVENTS_WAITS_HISTORY
EVENTS_WAITS_HISTORY_LONG
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
EVENTS_WAITS_SUMMARY_BY_INSTANCE
EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
FILE_INSTANCES
FILE_SUMMARY_BY_EVENT_NAME
FILE_SUMMARY_BY_INSTANCE
MUTEX_INSTANCES
PERFORMANCE_TIMERS
-PROCESSLIST
RWLOCK_INSTANCES
SETUP_CONSUMERS
SETUP_INSTRUMENTS
-SETUP_OBJECTS
SETUP_TIMERS
+THREADS
show create table COND_INSTANCES;
Table Create Table
COND_INSTANCES CREATE TABLE `COND_INSTANCES` (
@@ -92,31 +91,31 @@ EVENTS_WAITS_HISTORY_LONG CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` (
`NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
`FLAGS` int(10) unsigned DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
+show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
Table Create Table
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_EVENT_NAME` (
+EVENTS_WAITS_SUMMARY_BY_INSTANCE CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` (
`EVENT_NAME` varchar(128) NOT NULL,
+ `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
Table Create Table
-EVENTS_WAITS_SUMMARY_BY_INSTANCE CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` (
+EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` (
+ `THREAD_ID` int(11) NOT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
- `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
`MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
Table Create Table
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` (
- `THREAD_ID` int(11) NOT NULL,
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME` (
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
@@ -165,13 +164,6 @@ PERFORMANCE_TIMERS CREATE TABLE `PERFORMANCE_TIMERS` (
`TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
`TIMER_OVERHEAD` bigint(20) DEFAULT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table PROCESSLIST;
-Table Create Table
-PROCESSLIST CREATE TABLE `PROCESSLIST` (
- `THREAD_ID` int(11) NOT NULL,
- `ID` int(11) NOT NULL,
- `NAME` varchar(64) NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table RWLOCK_INSTANCES;
Table Create Table
RWLOCK_INSTANCES CREATE TABLE `RWLOCK_INSTANCES` (
@@ -193,19 +185,16 @@ SETUP_INSTRUMENTS CREATE TABLE `SETUP_INSTRUMENTS` (
`ENABLED` enum('YES','NO') NOT NULL,
`TIMED` enum('YES','NO') NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table SETUP_OBJECTS;
-Table Create Table
-SETUP_OBJECTS CREATE TABLE `SETUP_OBJECTS` (
- `OBJECT_TYPE` varchar(64) DEFAULT NULL,
- `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
- `OBJECT_NAME` varchar(64) DEFAULT NULL,
- `ENABLED` enum('YES','NO') NOT NULL,
- `TIMED` enum('YES','NO') NOT NULL,
- `AGGREGATED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table SETUP_TIMERS;
Table Create Table
SETUP_TIMERS CREATE TABLE `SETUP_TIMERS` (
`NAME` varchar(64) NOT NULL,
`TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table THREADS;
+Table Create Table
+THREADS CREATE TABLE `THREADS` (
+ `THREAD_ID` int(11) NOT NULL,
+ `ID` int(11) NOT NULL,
+ `NAME` varchar(64) NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/perfschema/r/selects.result b/mysql-test/suite/perfschema/r/selects.result
index 9b91c6f0fc8..dfc9007c740 100644
--- a/mysql-test/suite/perfschema/r/selects.result
+++ b/mysql-test/suite/perfschema/r/selects.result
@@ -13,7 +13,7 @@ OPERATION TOTAL
chsize [NUM_BYTES]
SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
WHERE THREAD_ID IN
-(SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+(SELECT THREAD_ID FROM performance_schema.THREADS)
AND EVENT_NAME IN
(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
WHERE NAME LIKE "wait/synch/%")
@@ -86,7 +86,7 @@ DROP TRIGGER t_ps_trigger;
DROP PROCEDURE IF EXISTS t_ps_proc;
CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
BEGIN
-SELECT id FROM performance_schema.PROCESSLIST
+SELECT id FROM performance_schema.THREADS
WHERE THREAD_ID = tid INTO pid;
END;
|
@@ -94,7 +94,7 @@ CALL t_ps_proc(0, @p_id);
DROP FUNCTION IF EXISTS t_ps_proc;
CREATE FUNCTION t_ps_func(tid INT) RETURNS int
BEGIN
-return (SELECT id FROM performance_schema.PROCESSLIST
+return (SELECT id FROM performance_schema.THREADS
WHERE THREAD_ID = tid);
END;
|
diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result
index 8c35425029e..5f3b071484d 100644
--- a/mysql-test/suite/perfschema/r/server_init.result
+++ b/mysql-test/suite/perfschema/r/server_init.result
@@ -182,7 +182,7 @@ count(name)
select count(name) from COND_INSTANCES
where name like "wait/synch/cond/sql/COND_refresh";
count(name)
-1
+0
select count(name) from COND_INSTANCES
where name like "wait/synch/cond/sql/COND_thread_count";
count(name)
diff --git a/mysql-test/suite/perfschema/r/short_option_1.result b/mysql-test/suite/perfschema/r/short_option_1.result
new file mode 100644
index 00000000000..ad48fe05ad9
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/short_option_1.result
@@ -0,0 +1,27 @@
+select 'Ok, the server started' as result;
+result
+Ok, the server started
+select @@SQL_MODE;
+@@SQL_MODE
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
+show variables like 'sql_mode';
+Variable_name Value
+sql_mode REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
+select @@character_set_server;
+@@character_set_server
+utf8
+show variables like 'character_set_system';
+Variable_name Value
+character_set_system utf8
+show variables like 'log';
+Variable_name Value
+log ON
+show variables like 'general_log';
+Variable_name Value
+general_log ON
+show variables like 'new';
+Variable_name Value
+new ON
+show variables like 'log_warnings';
+Variable_name Value
+log_warnings 3
diff --git a/mysql-test/suite/perfschema/r/short_option_2.result b/mysql-test/suite/perfschema/r/short_option_2.result
new file mode 100644
index 00000000000..0587fdef73b
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/short_option_2.result
@@ -0,0 +1,9 @@
+select 'Ok, the server started' as result;
+result
+Ok, the server started
+select @@SQL_MODE;
+@@SQL_MODE
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
+select @@log_warnings;
+@@log_warnings
+5
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
index d6089139d5a..0241313863d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
index eaa04c7629d..fe3e5646218 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
index d68ec00a456..974d933ed8d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 0
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
index 258712ebf68..303c31d1f08 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 0
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
index d221cb2c22a..11b91f80b04 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 0
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
index adfd4c5ec17..8cda000e36a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -47,8 +46,8 @@ performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
performance_schema_max_mutex_instances 0
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
index 5248becf0e5..6cd7c180ddc 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
+performance_schema_max_mutex_instances 1000000
performance_schema_max_rwlock_classes 0
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
index e7a94c4a60d..4393f9ea57b 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,8 +45,8 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
performance_schema_max_rwlock_instances 0
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
@@ -57,7 +56,7 @@ show engine PERFORMANCE_SCHEMA status;
show status like "performance_schema%";
show variables like "performance_schema_max_rwlock_classes";
Variable_name Value
-performance_schema_max_rwlock_classes 20
+performance_schema_max_rwlock_classes 30
select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS
where name like "wait/synch/rwlock/%";
count(*) > 0
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
index 92f1ec29b38..20e6f18a284 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 0
@@ -66,7 +65,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST';
variable_value > 0
1
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
count(*)
0
show status like "performance_schema_thread_instances_lost";
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
index 3ecf7fe98db..28fe6923991 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
@@ -64,7 +63,7 @@ Performance_schema_thread_classes_lost 0
show variables like "performance_schema_max_thread_instances";
Variable_name Value
performance_schema_max_thread_instances 0
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
count(*)
0
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result
index 4ce5aa75ce7..de09d9daa07 100644
--- a/mysql-test/suite/perfschema/r/start_server_off.result
+++ b/mysql-test/suite/perfschema/r/start_server_off.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema OFF
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result
index 1d9dc731c7b..30546496050 100644
--- a/mysql-test/suite/perfschema/r/start_server_on.result
+++ b/mysql-test/suite/perfschema/r/start_server_on.result
@@ -21,20 +21,19 @@ select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
show variables like "performance_schema%";
Variable_name Value
performance_schema ON
@@ -46,9 +45,9 @@ performance_schema_max_file_classes 50
performance_schema_max_file_handles 32768
performance_schema_max_file_instances 10000
performance_schema_max_mutex_classes 200
-performance_schema_max_mutex_instances 1000
-performance_schema_max_rwlock_classes 20
-performance_schema_max_rwlock_instances 1000
+performance_schema_max_mutex_instances 1000000
+performance_schema_max_rwlock_classes 30
+performance_schema_max_rwlock_instances 1000000
performance_schema_max_table_handles 100000
performance_schema_max_table_instances 50000
performance_schema_max_thread_classes 50
diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test
index 0fa4651ecda..a8ca3dd91e2 100644
--- a/mysql-test/suite/perfschema/t/aggregate.test
+++ b/mysql-test/suite/perfschema/t/aggregate.test
@@ -31,7 +31,7 @@ update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
# Cleanup statistics
truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
+truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
@@ -66,9 +66,9 @@ set @dump_all=FALSE;
# because doing so removes a row in FILE_SUMMARY_BY_INSTANCE.
# Likewise:
-# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) >=
+# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >=
# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_INSTANCE)
-# - MIN(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) <=
+# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <=
# MIN(EVENTS_WAITS_SUMMARY_BY_INSTANCE)
# There will be equality only when an instrument instance
# is not removed, which is next to impossible to predictably guarantee
@@ -80,9 +80,9 @@ set @dump_all=FALSE;
# Both cause a row to be deleted from EVENTS_WAITS_SUMMARY_BY_INSTANCE.
# Likewise:
-# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) >=
+# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >=
# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME)
-# - MIN(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) <=
+# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <=
# MIN(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME)
# There will be equality only when no thread is removed,
# that is if no thread disconnects, or no sub thread (for example insert
@@ -131,14 +131,14 @@ OR @dump_all;
--echo "Verifying waits aggregate consistency (instance)"
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
OR @dump_all;
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
@@ -146,7 +146,7 @@ AND (MIN(i.MIN_TIMER_WAIT) != 0)
OR @dump_all;
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
@@ -155,7 +155,7 @@ OR @dump_all;
--echo "Verifying waits aggregate consistency (thread)"
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
@@ -163,7 +163,7 @@ HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT))
OR @dump_all;
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
@@ -172,7 +172,7 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0)
OR @dump_all;
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
diff --git a/mysql-test/suite/perfschema/t/bad_option_3.test b/mysql-test/suite/perfschema/t/bad_option_3.test
new file mode 100644
index 00000000000..1a9efb61fdf
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/bad_option_3.test
@@ -0,0 +1,49 @@
+# Copyright (c) 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
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check error handling for invalid server start options
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_3.txt;
+--error 0,1
+--remove_file $outfile
+--error 2
+--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -a -x > $outfile 2>&1
+
+perl;
+ use strict;
+ use warnings;
+ my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_3.txt";
+ open(FILE, "<", $fname) or die;
+ my @lines= <FILE>;
+ # those must be in the file for the test to pass
+ my @patterns=
+ ("unknown option '-x'",
+ "Aborting");
+ foreach my $one_line (@lines)
+ {
+ foreach my $one_pattern (@patterns)
+ {
+ # print pattern, not line, to get a stable output
+ print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
+ }
+ }
+ close FILE;
+EOF
+--remove_file $outfile
+
diff --git a/mysql-test/suite/perfschema/t/bad_option_4.test b/mysql-test/suite/perfschema/t/bad_option_4.test
new file mode 100644
index 00000000000..c13df1b614d
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/bad_option_4.test
@@ -0,0 +1,49 @@
+# Copyright (c) 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
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check error handling for invalid server start options
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_4.txt;
+--error 0,1
+--remove_file $outfile
+--error 1
+--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -a -h bad_option_h_param > $outfile 2>&1
+
+perl;
+ use strict;
+ use warnings;
+ my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_4.txt";
+ open(FILE, "<", $fname) or die;
+ my @lines= <FILE>;
+ # those must be in the file for the test to pass
+ my @patterns=
+ ("Can't change dir to.*bad_option_h_param",
+ "Aborting");
+ foreach my $one_line (@lines)
+ {
+ foreach my $one_pattern (@patterns)
+ {
+ # print pattern, not line, to get a stable output
+ print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
+ }
+ }
+ close FILE;
+EOF
+--remove_file $outfile
+
diff --git a/mysql-test/suite/perfschema/t/bad_option_5.test b/mysql-test/suite/perfschema/t/bad_option_5.test
new file mode 100644
index 00000000000..d0ae1370859
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/bad_option_5.test
@@ -0,0 +1,52 @@
+# Copyright (c) 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
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check error handling for invalid server start options
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_5.txt;
+--error 0,1
+--remove_file $outfile
+--error 2
+--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -aXbroken > $outfile 2>&1
+
+# -aXbroken should be parsed as -a -Xbroken, or --ansi -Xbroken,
+# therefore the -X option is what the server should complain about
+
+perl;
+ use strict;
+ use warnings;
+ my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_5.txt";
+ open(FILE, "<", $fname) or die;
+ my @lines= <FILE>;
+ # those must be in the file for the test to pass
+ my @patterns=
+ ("unknown option '-X'",
+ "Aborting");
+ foreach my $one_line (@lines)
+ {
+ foreach my $one_pattern (@patterns)
+ {
+ # print pattern, not line, to get a stable output
+ print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
+ }
+ }
+ close FILE;
+EOF
+--remove_file $outfile
+
diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test
index fbf2d2925a7..c7a767b013b 100644
--- a/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test
+++ b/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test
@@ -19,13 +19,16 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME add column foo integer;
+alter table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+ add column foo integer;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
+truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(EVENT_NAME);
+ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+ ADD INDEX test_index(EVENT_NAME);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(EVENT_NAME);
+CREATE UNIQUE INDEX test_index
+ ON performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(EVENT_NAME);
diff --git a/mysql-test/suite/perfschema/t/ddl_setup_objects.test b/mysql-test/suite/perfschema/t/ddl_setup_objects.test
deleted file mode 100644
index 6ae6156ef00..00000000000
--- a/mysql-test/suite/perfschema/t/ddl_setup_objects.test
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
-#
-# 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
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---replace_result '\'setup_objects' '\'SETUP_OBJECTS'
--- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.SETUP_OBJECTS add column foo integer;
-
-truncate table performance_schema.SETUP_OBJECTS;
-
--- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME);
-
--- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME);
-
diff --git a/mysql-test/suite/perfschema/t/ddl_processlist.test b/mysql-test/suite/perfschema/t/ddl_threads.test
index fb133b66e26..12613e30c1f 100644
--- a/mysql-test/suite/perfschema/t/ddl_processlist.test
+++ b/mysql-test/suite/perfschema/t/ddl_threads.test
@@ -19,14 +19,14 @@
--source include/have_perfschema.inc
-- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.PROCESSLIST add column foo integer;
+alter table performance_schema.THREADS add column foo integer;
-- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.PROCESSLIST;
+truncate table performance_schema.THREADS;
-- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID);
+ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID);
-- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID);
+CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID);
diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test
index c1fddbe9f87..cd3918f38be 100644
--- a/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test
+++ b/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test
@@ -19,44 +19,44 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 # 4 # 5 # 6 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
where event_name like 'Wait/Synch/%' limit 1;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
where event_name='FOO';
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+insert into performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
avg_timer_wait=4, max_timer_wait=5;
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
set count_star=12;
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
set count_star=12 where event_name like "FOO";
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
where count_star=1;
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
+delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME READ;
+LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME READ;
UNLOCK TABLES;
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME WRITE;
+LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/dml_setup_objects.test b/mysql-test/suite/perfschema/t/dml_setup_objects.test
deleted file mode 100644
index 21fac64d924..00000000000
--- a/mysql-test/suite/perfschema/t/dml_setup_objects.test
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
-#
-# 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
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
-select * from performance_schema.SETUP_OBJECTS;
-
-select * from performance_schema.SETUP_OBJECTS
- where object_type = 'TABLE';
-
-select * from performance_schema.SETUP_OBJECTS
- where enabled='YES';
-
-# Not implemented yet
---replace_result '\'setup_objects' '\'SETUP_OBJECTS'
---error ER_ILLEGAL_HA
-insert into performance_schema.SETUP_OBJECTS
- set object_type='TABLE', object_schema='FOO', object_name='BAR',
- enabled='YES', timed='YES', aggregated='YES';
-
-# Not implemented yet
-# --error ER_ILLEGAL_HA
-update performance_schema.SETUP_OBJECTS
- set object_type='TABLE';
-
-# Not implemented yet
-# --error ER_ILLEGAL_HA
-update performance_schema.SETUP_OBJECTS
- set object_schema='ILLEGAL';
-
-# Not implemented yet
-# --error ER_ILLEGAL_HA
-update performance_schema.SETUP_OBJECTS
- set object_name='ILLEGAL';
-
-update performance_schema.SETUP_OBJECTS
- set enabled='NO';
-
-update performance_schema.SETUP_OBJECTS
- set timed='NO';
-
-update performance_schema.SETUP_OBJECTS
- set aggregated='NO';
-
-select * from performance_schema.SETUP_OBJECTS;
-
-update performance_schema.SETUP_OBJECTS
- set enabled='YES', timed='YES', aggregated='YES';
-
-delete from performance_schema.SETUP_OBJECTS
- where object_type = 'TABLE';
-
-delete from performance_schema.SETUP_OBJECTS;
-
-LOCK TABLES performance_schema.SETUP_OBJECTS READ;
-UNLOCK TABLES;
-
-LOCK TABLES performance_schema.SETUP_OBJECTS WRITE;
-UNLOCK TABLES;
-
diff --git a/mysql-test/suite/perfschema/t/dml_processlist.test b/mysql-test/suite/perfschema/t/dml_threads.test
index 6062b8481f0..6ea456fee69 100644
--- a/mysql-test/suite/perfschema/t/dml_processlist.test
+++ b/mysql-test/suite/perfschema/t/dml_threads.test
@@ -19,43 +19,43 @@
--source include/have_perfschema.inc
--replace_column 1 # 2 # 3 #
-select * from performance_schema.PROCESSLIST
+select * from performance_schema.THREADS
where name like 'Thread/%' limit 1;
-select * from performance_schema.PROCESSLIST
+select * from performance_schema.THREADS
where name='FOO';
---replace_result '\'processlist' '\'PROCESSLIST'
+--replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.PROCESSLIST
+insert into performance_schema.THREADS
set name='FOO', thread_id=1, id=2;
---replace_result '\'processlist' '\'PROCESSLIST'
+--replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.PROCESSLIST
+update performance_schema.THREADS
set thread_id=12;
---replace_result '\'processlist' '\'PROCESSLIST'
+--replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.PROCESSLIST
+update performance_schema.THREADS
set thread_id=12 where name like "FOO";
---replace_result '\'processlist' '\'PROCESSLIST'
+--replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.PROCESSLIST
+delete from performance_schema.THREADS
where id=1;
---replace_result '\'processlist' '\'PROCESSLIST'
+--replace_result '\'threads' '\'THREADS'
--error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.PROCESSLIST;
+delete from performance_schema.THREADS;
---replace_result '\'processlist' '\'PROCESSLIST'
+--replace_result '\'threads' '\'THREADS'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.PROCESSLIST READ;
+LOCK TABLES performance_schema.THREADS READ;
UNLOCK TABLES;
---replace_result '\'processlist' '\'PROCESSLIST'
+--replace_result '\'threads' '\'THREADS'
-- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.PROCESSLIST WRITE;
+LOCK TABLES performance_schema.THREADS WRITE;
UNLOCK TABLES;
diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test
index 4317f68d13b..6b6335ac424 100644
--- a/mysql-test/suite/perfschema/t/func_file_io.test
+++ b/mysql-test/suite/perfschema/t/func_file_io.test
@@ -144,7 +144,7 @@ WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL;
#
--disable_result_log
SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
WHERE COUNT_STAR > 0
ORDER BY SUM_TIMER_WAIT DESC
LIMIT 10;
@@ -158,7 +158,7 @@ LIMIT 10;
SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
LEFT JOIN information_schema.PROCESSLIST i USING (ID)
GROUP BY i.user
ORDER BY SUM_WAIT DESC
@@ -171,7 +171,7 @@ LIMIT 20;
--disable_result_log
SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
WHERE p.ID = 1
GROUP BY h.EVENT_NAME
HAVING TOTAL_WAIT > 0;
@@ -184,7 +184,7 @@ HAVING TOTAL_WAIT > 0;
--disable_result_log
SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
LEFT JOIN information_schema.PROCESSLIST i USING (ID)
GROUP BY i.user, h.operation
HAVING BYTES > 0
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index dfa865e8702..d497c205d50 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -27,7 +27,7 @@
--disable_result_log
SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
WHERE THREAD_ID IN
- (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+ (SELECT THREAD_ID FROM performance_schema.THREADS)
AND EVENT_NAME IN
(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
WHERE NAME LIKE "wait/synch/%")
diff --git a/mysql-test/suite/perfschema/t/no_threads.test b/mysql-test/suite/perfschema/t/no_threads.test
index 3d3f712e364..9254535bf1f 100644
--- a/mysql-test/suite/perfschema/t/no_threads.test
+++ b/mysql-test/suite/perfschema/t/no_threads.test
@@ -45,10 +45,10 @@ show variables like "performance_schema_max_thread%";
# Verification : in this main thread
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
where name like "thread/sql/main";
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
where name like "thread/sql/OneConnection";
select event_name, operation,
diff --git a/mysql-test/suite/perfschema/t/schema.test b/mysql-test/suite/perfschema/t/schema.test
index d13c399a97b..727c4f5a755 100644
--- a/mysql-test/suite/perfschema/t/schema.test
+++ b/mysql-test/suite/perfschema/t/schema.test
@@ -29,18 +29,17 @@ show create table COND_INSTANCES;
show create table EVENTS_WAITS_CURRENT;
show create table EVENTS_WAITS_HISTORY;
show create table EVENTS_WAITS_HISTORY_LONG;
-show create table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
show create table FILE_INSTANCES;
show create table FILE_SUMMARY_BY_EVENT_NAME;
show create table FILE_SUMMARY_BY_INSTANCE;
show create table MUTEX_INSTANCES;
show create table PERFORMANCE_TIMERS;
-show create table PROCESSLIST;
show create table RWLOCK_INSTANCES;
show create table SETUP_CONSUMERS;
show create table SETUP_INSTRUMENTS;
-show create table SETUP_OBJECTS;
show create table SETUP_TIMERS;
+show create table THREADS;
diff --git a/mysql-test/suite/perfschema/t/selects.test b/mysql-test/suite/perfschema/t/selects.test
index a0c000b80c1..b673c896024 100644
--- a/mysql-test/suite/perfschema/t/selects.test
+++ b/mysql-test/suite/perfschema/t/selects.test
@@ -45,7 +45,7 @@ LIMIT 1;
--replace_column 1 [EVENT_ID]
SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
WHERE THREAD_ID IN
- (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+ (SELECT THREAD_ID FROM performance_schema.THREADS)
AND EVENT_NAME IN
(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
WHERE NAME LIKE "wait/synch/%")
@@ -138,7 +138,7 @@ delimiter |;
CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
BEGIN
- SELECT id FROM performance_schema.PROCESSLIST
+ SELECT id FROM performance_schema.THREADS
WHERE THREAD_ID = tid INTO pid;
END;
@@ -157,7 +157,7 @@ delimiter |;
CREATE FUNCTION t_ps_func(tid INT) RETURNS int
BEGIN
- return (SELECT id FROM performance_schema.PROCESSLIST
+ return (SELECT id FROM performance_schema.THREADS
WHERE THREAD_ID = tid);
END;
diff --git a/mysql-test/suite/perfschema/t/short_option_1-master.opt b/mysql-test/suite/perfschema/t/short_option_1-master.opt
new file mode 100644
index 00000000000..6a6e8d4c5ca
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/short_option_1-master.opt
@@ -0,0 +1 @@
+-a -n -Cutf8 --collation=utf8_bin -l -T12 -W3
diff --git a/mysql-test/suite/perfschema/t/short_option_1.test b/mysql-test/suite/perfschema/t/short_option_1.test
new file mode 100644
index 00000000000..1d3e0835188
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/short_option_1.test
@@ -0,0 +1,35 @@
+# Copyright (c) 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
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check server start for short server start options
+
+select 'Ok, the server started' as result;
+
+# See the associated -master.opt file.
+
+select @@SQL_MODE;
+show variables like 'sql_mode';
+
+select @@character_set_server;
+show variables like 'character_set_system';
+
+show variables like 'log';
+show variables like 'general_log';
+
+show variables like 'new';
+
+show variables like 'log_warnings';
+
diff --git a/mysql-test/suite/perfschema/t/short_option_2-master.opt b/mysql-test/suite/perfschema/t/short_option_2-master.opt
new file mode 100644
index 00000000000..5cf7590a1c8
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/short_option_2-master.opt
@@ -0,0 +1 @@
+-aW5
diff --git a/mysql-test/suite/perfschema/t/short_option_2.test b/mysql-test/suite/perfschema/t/short_option_2.test
new file mode 100644
index 00000000000..eb528dfcf72
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/short_option_2.test
@@ -0,0 +1,29 @@
+# Copyright (c) 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
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+# Check server start for short server start options
+
+select 'Ok, the server started' as result;
+
+# See the associated -master.opt file.
+# -aW5 should be parsed as -a -W5, which are two separate short options
+# stuffed inside a single argv[i] argument.
+
+# Should contain ANSI, since we started the server with -a (stands for --ansi)
+select @@SQL_MODE;
+
+# Should be 5, since we started the server with -W5
+select @@log_warnings;
diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test
index ba214ba9966..1ed0fecb538 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test
@@ -31,7 +31,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST';
# Expect no instances
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
# Expect no instances lost
show status like "performance_schema_thread_instances_lost";
diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
index 7d8a44ebcd5..489f814ba10 100644
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
@@ -33,7 +33,7 @@ show status like "performance_schema_thread_classes_lost";
# Expect no instances
show variables like "performance_schema_max_thread_instances";
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
# Expect instances lost
select variable_value > 0 from information_schema.global_status
diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test
index 8c3271ba406..5560f66babb 100644
--- a/mysql-test/suite/perfschema/t/thread_cache.test
+++ b/mysql-test/suite/perfschema/t/thread_cache.test
@@ -30,14 +30,14 @@ connect (con1, localhost, root, , );
let $con1_ID=`select connection_id()`;
-let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID = connection_id()`;
connect (con2, localhost, root, , );
let $con2_ID=`select connection_id()`;
-let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID = connection_id()`;
connection default;
@@ -58,7 +58,7 @@ connect (con3, localhost, root, , );
let $con3_ID=`select connection_id()`;
-let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID = connection_id()`;
disconnect con3;
@@ -82,14 +82,14 @@ connect (con1, localhost, root, , );
let $con1_ID=`select connection_id()`;
-let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID = connection_id()`;
connect (con2, localhost, root, , );
let $con2_ID=`select connection_id()`;
-let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID = connection_id()`;
connection default;
@@ -108,7 +108,7 @@ connect (con3, localhost, root, , );
let $con3_ID=`select connection_id()`;
-let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
where ID = connection_id()`;
disconnect con3;
diff --git a/mysql-test/suite/rpl/r/rpl_conditional_comments.result b/mysql-test/suite/rpl/r/rpl_conditional_comments.result
index f3de3e5eb70..0a2f4d60e6f 100644
--- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result
+++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result
@@ -43,7 +43,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
@@ -51,7 +51,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/
diff --git a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
index fc53aca5136..0d3fc1b79a7 100644
--- a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
+++ b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
@@ -26,7 +26,6 @@ SHOW TABLES in mysqltest;
Tables_in_mysqltest
t
t1
-t2
SHOW EVENTS in mysqltest;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
mysqltest e root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
@@ -65,3 +64,65 @@ c1
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+# WL#5370
+# The behavior of statement 'CREATE TABLE SELECT IF NOT EXISTS' is changed.
+# After the worklog, it will insert nothing and the statement will not be
+# binlogged if the table already exists.
+# After the worklog, some bugs will disappear automotically.
+stop slave;
+drop table if exists t1,t2,t3,t4,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: BUG#47132
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int);
+INSERT INTO t1 VALUES (1), (1);
+INSERT INTO t2 VALUES (2), (2);
+CREATE VIEW v1 AS SELECT id FROM t2;
+CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1;
+Warnings:
+Note 1050 Table 'v1' already exists
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SHOW CREATE TABLE v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t2`.`id` AS `id` from `t2` latin1 latin1_swedish_ci
+SELECT * FROM t2;
+id
+2
+2
+SELECT * FROM v1;
+id
+2
+2
+DROP VIEW v1;
+CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2;
+CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1;
+Warnings:
+Note 1050 Table 'tt1' already exists
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SELECT * FROM t2;
+id
+2
+2
+SELECT * FROM tt1;
+id
+2
+2
+DROP TEMPORARY TABLE tt1;
+
+# Case 1: BUG#47132
+# RBR breaks on CREATE TABLE IF EXISTS <existing VIEW> AS SELECT
+CREATE VIEW v1 AS SELECT 1 as a;
+CREATE TABLE IF NOT EXISTS v1 SELECT 2 as a;
+Warnings:
+Note 1050 Table 'v1' already exists
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+DROP VIEW v1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result
index 8d0b61cc6d8..7459a977cf8 100644
--- a/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result
+++ b/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result
@@ -19,4 +19,3 @@ master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS t
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp
diff --git a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result b/mysql-test/suite/rpl/r/rpl_drop_if_exists.result
index e2d4c727c98..0c398bed440 100644
--- a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result
+++ b/mysql-test/suite/rpl/r/rpl_drop_if_exists.result
@@ -13,7 +13,7 @@ master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
CREATE DATABASE db_bug_13684;
CREATE TABLE db_bug_13684.t (a int);
@@ -39,7 +39,7 @@ master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
master-bin.000001 # Query # # CREATE DATABASE db_bug_13684
master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int)
@@ -71,7 +71,7 @@ master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
master-bin.000001 # Query # # CREATE DATABASE db_bug_13684
master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int)
@@ -94,5 +94,5 @@ master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f
master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v
master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684
diff --git a/mysql-test/suite/rpl/r/rpl_flush_logs.result b/mysql-test/suite/rpl/r/rpl_flush_logs.result
index 7f50ce0cdd0..4c3352559c4 100644
--- a/mysql-test/suite/rpl/r/rpl_flush_logs.result
+++ b/mysql-test/suite/rpl/r/rpl_flush_logs.result
@@ -4,12 +4,8 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-# Make sure the 'master_log.err-old' file does not
-# exist before execute 'flush error logs' statement.
# Test if support 'flush error logs' statement.
flush error logs;
-# Check the 'master_log.err-old' file is created
-# after executed 'flush error logs' statement.
# Make sure binary logs was not be flushed
# after execute 'flush error logs' statement.
# Make sure relay logs was not be flushed
@@ -42,12 +38,8 @@ flush binary logs;
# after executed 'flush binary logs' statement.
# Make sure the 'slave-relay-bin.000007' file does not exist
# exist before execute 'flush error logs, relay logs' statement.
-# Make sure the 'master_log.err-old' file does not exist
-# before execute 'flush error logs, relay logs' statement.
# Test if support to combine all kinds of logs into one statement.
flush error logs, relay logs;
-# Check the 'master_log.err-old' file is created
-# after executed 'flush error logs, relay logs' statement.
# Make sure binary logs was not be flushed
# after execute 'flush error logs, relay logs' statement.
# Check the 'slave-relay-bin.000007' file is created after
@@ -55,12 +47,8 @@ flush error logs, relay logs;
# Make sure the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
# files do not exist before execute 'flush error logs, relay logs'
# statement.
-# Make sure the 'master_log.err-old' file does not exist
-# before execute 'flush logs' statement.
# Test if 'flush logs' statement works fine and flush all the logs.
flush logs;
-# Check the 'master_log.err-old' file is created
-# after executed 'flush logs' statement.
# Check 'master-bin.000003' is created
# after execute 'flush logs' statement.
# Check the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
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 daef153cdef..c1fd3396626 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -883,8 +883,8 @@ 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 # 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
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
index c752e836ebb..b749778bcc2 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
@@ -57,14 +57,14 @@ SET @commands= 'Drop-Temp-T-Temp';
DROP TEMPORARY TABLE tt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-N-Temp';
DROP TEMPORARY TABLE nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-Xe-Temp';
@@ -80,7 +80,7 @@ Warnings:
Note 1051 Unknown table 'tt_xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TXe-Temp';
@@ -88,7 +88,7 @@ DROP TEMPORARY TABLE tt_tmp_2, tt_1;
ERROR 42S02: Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-If-TXe-Temp';
@@ -97,7 +97,7 @@ Warnings:
Note 1051 Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-NXe-Temp';
@@ -105,7 +105,7 @@ DROP TEMPORARY TABLE nt_tmp_2, tt_1;
ERROR 42S02: Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-If-NXe-Temp';
@@ -114,28 +114,30 @@ Warnings:
Note 1051 Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TN-Temp';
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TT-Temp';
DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-NN-Temp';
DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -151,7 +153,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -169,8 +171,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -182,8 +184,10 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -197,12 +201,16 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -249,7 +257,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -271,8 +279,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -286,7 +294,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -306,8 +314,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -322,7 +330,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -344,8 +352,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -358,8 +366,10 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -375,12 +385,16 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -394,8 +408,11 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -413,12 +430,18 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -430,8 +453,11 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -440,18 +466,23 @@ BEGIN;
INSERT INTO tt_xx_1() VALUES (1);
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -464,7 +495,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -481,7 +512,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -493,8 +524,10 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -507,11 +540,13 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -528,7 +563,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -548,8 +583,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -561,8 +596,10 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -578,12 +615,16 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -632,7 +673,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -656,8 +697,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -671,7 +712,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -693,8 +734,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -709,7 +750,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -733,8 +774,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -747,8 +788,10 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -766,12 +809,16 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -785,8 +832,11 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -806,12 +856,18 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -823,8 +879,11 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -833,20 +892,25 @@ BEGIN;
INSERT INTO tt_xx_1() VALUES (1);
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -859,7 +923,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -878,7 +942,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -890,8 +954,10 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -906,11 +972,13 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -925,14 +993,14 @@ SET @commands= 'Drop-T';
DROP TABLE tt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-N';
DROP TABLE nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Xe';
@@ -948,7 +1016,7 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TXe';
@@ -956,7 +1024,7 @@ DROP TABLE tt_2, xx_1;
ERROR 42S02: Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-If-TXe';
@@ -965,7 +1033,7 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-NXe';
@@ -973,7 +1041,7 @@ DROP TABLE nt_2, xx_1;
ERROR 42S02: Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-If-NXe';
@@ -982,42 +1050,45 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TN';
DROP TABLE tt_2, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TT';
DROP TABLE tt_1, tt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-NN';
DROP TABLE nt_1, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-N-TN-Temp';
DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TN-Temp';
DROP TABLE tt_tmp_2, nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1033,7 +1104,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-N';
@@ -1045,7 +1116,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-Xe';
@@ -1071,7 +1142,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TXe';
@@ -1084,7 +1155,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-If-TXe';
@@ -1098,7 +1169,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-NXe';
@@ -1111,7 +1182,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-If-NXe';
@@ -1125,7 +1196,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TN';
@@ -1137,7 +1208,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TT';
@@ -1149,7 +1220,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-NN';
@@ -1161,7 +1232,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-N-TN-Temp';
@@ -1173,7 +1244,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TN-Temp';
@@ -1185,7 +1258,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
#########################################################################
@@ -1202,10 +1276,10 @@ DROP TEMPORARY TABLE nt_tmp_1;
DROP TEMPORARY TABLE nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
@@ -1215,10 +1289,10 @@ DROP TEMPORARY TABLE tt_tmp_1;
DROP TEMPORARY TABLE tt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1236,11 +1310,19 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1254,10 +1336,10 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1276,11 +1358,19 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1294,10 +1384,10 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1347,8 +1437,8 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1362,16 +1452,8 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1385,14 +1467,8 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1413,16 +1489,12 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+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`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1438,15 +1510,9 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+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`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R';
@@ -1461,16 +1527,8 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1486,15 +1544,9 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+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`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result
index 386274af7b2..47ce547fcac 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result
@@ -494,7 +494,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (3)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
index f3a0254f6a4..7024851d369 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
@@ -10398,12 +10398,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10419,12 +10419,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10440,12 +10440,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM nt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10461,12 +10461,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10482,12 +10482,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10503,12 +10503,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -10689,11 +10689,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10863,11 +10863,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11061,11 +11061,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11267,11 +11267,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -11308,11 +11308,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_11;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11366,11 +11366,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_12;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11410,11 +11410,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_13;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11460,11 +11460,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_14;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11498,11 +11498,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_15;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11548,11 +11548,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_16;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
index 0a1a776d37c..2db035d0ecf 100644
--- a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
@@ -10770,12 +10770,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10791,12 +10791,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10812,12 +10812,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM nt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10833,12 +10833,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10854,12 +10854,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10875,12 +10875,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -11061,11 +11061,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11235,11 +11235,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11433,11 +11433,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11639,11 +11639,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -11680,11 +11680,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_11;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11738,11 +11738,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_12;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11782,11 +11782,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_13;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11832,11 +11832,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_14;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11870,11 +11870,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_15;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11920,11 +11920,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_16;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
index cde0a9cfa8c..9467039a407 100644
--- a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
@@ -12403,7 +12403,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12417,7 +12417,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `tt_xx_1` (
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12443,7 +12443,7 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12458,7 +12458,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_xx_2)
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 IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12484,7 +12484,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12499,7 +12499,7 @@ master-bin.000001 # Table_map # # table_id: # (test.tt_xx_3)
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 # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12524,7 +12524,7 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12538,7 +12538,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `nt_xx_4` (
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_4)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12563,7 +12563,7 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12577,7 +12577,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `nt_xx_5` (
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_5)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12602,7 +12602,7 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12616,7 +12616,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `nt_xx_6` (
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_6)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -12827,11 +12827,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13031,11 +13031,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13261,11 +13261,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13499,11 +13499,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
index d716886e5bf..993baeb32f0 100644
--- a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
@@ -10012,12 +10012,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10033,12 +10033,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10054,12 +10054,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM nt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10075,12 +10075,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10096,12 +10096,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10117,12 +10117,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -10293,11 +10293,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10463,11 +10463,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10646,11 +10646,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10829,11 +10829,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -10870,11 +10870,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_11;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10928,11 +10928,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_12;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10972,11 +10972,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_13;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11022,11 +11022,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_14;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11060,11 +11060,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_15;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11110,11 +11110,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_16;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_row_drop.result b/mysql-test/suite/rpl/r/rpl_row_drop.result
index 1ab262d087e..402d20e469b 100644
--- a/mysql-test/suite/rpl/r/rpl_row_drop.result
+++ b/mysql-test/suite/rpl/r/rpl_row_drop.result
@@ -46,8 +46,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int)
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
+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_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
index fa9412de67e..a0b7f74fea4 100644
--- a/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
+++ b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
@@ -80,6 +80,7 @@ Warnings:
Note 1051 Unknown table 'tt_xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TXe-Temp';
@@ -96,7 +97,7 @@ Warnings:
Note 1051 Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-NXe-Temp';
@@ -114,13 +115,15 @@ Note 1051 Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TN-Temp';
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TT-Temp';
@@ -184,9 +187,11 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -200,14 +205,18 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -258,6 +267,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -281,6 +291,8 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -334,7 +346,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -358,8 +370,8 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -372,9 +384,11 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -390,14 +404,18 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -411,9 +429,12 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -431,14 +452,20 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -450,9 +477,12 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -461,20 +491,25 @@ BEGIN;
INSERT INTO tt_xx_1() VALUES (1);
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -519,9 +554,11 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -534,13 +571,15 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -593,9 +632,11 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -611,14 +652,18 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -671,6 +716,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -696,6 +742,8 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -751,7 +799,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -777,8 +825,8 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -791,9 +839,11 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -811,14 +861,18 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -832,9 +886,12 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -854,14 +911,20 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -873,9 +936,12 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -884,22 +950,27 @@ BEGIN;
INSERT INTO tt_xx_1() VALUES (1);
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -946,9 +1017,11 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -963,13 +1036,15 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
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.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -984,14 +1059,14 @@ SET @commands= 'Drop-T';
DROP TABLE tt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-N';
DROP TABLE nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Xe';
@@ -1007,7 +1082,7 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TXe';
@@ -1015,7 +1090,7 @@ DROP TABLE tt_2, xx_1;
ERROR 42S02: Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-If-TXe';
@@ -1024,7 +1099,7 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-NXe';
@@ -1032,7 +1107,7 @@ DROP TABLE nt_2, xx_1;
ERROR 42S02: Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-If-NXe';
@@ -1041,43 +1116,45 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TN';
DROP TABLE tt_2, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TT';
DROP TABLE tt_1, tt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-NN';
DROP TABLE nt_1, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-N-TN-Temp';
DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TN-Temp';
DROP TABLE tt_tmp_2, nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1094,7 +1171,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-N';
@@ -1107,7 +1184,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-Xe';
@@ -1135,7 +1212,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 IF EXISTS xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TXe';
@@ -1149,7 +1226,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-If-TXe';
@@ -1164,7 +1241,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 IF EXISTS tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-NXe';
@@ -1178,7 +1255,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-If-NXe';
@@ -1193,7 +1270,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 IF EXISTS nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TN';
@@ -1206,7 +1283,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 tt_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TT';
@@ -1219,7 +1296,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 tt_1, tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-NN';
@@ -1232,7 +1309,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 nt_1, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-N-TN-Temp';
@@ -1245,8 +1322,9 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TN-Temp';
@@ -1259,7 +1337,8 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
#########################################################################
@@ -1308,11 +1387,17 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1347,11 +1432,17 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
diff --git a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result
index 459dc83e01d..b9480abd4b8 100644
--- a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result
+++ b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result
@@ -530,7 +530,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
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 IF EXISTS tt_xx, new_tt_xx
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
index d94c0cdad10..dbb43b9415b 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -23,7 +23,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
@@ -198,7 +198,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
@@ -228,7 +228,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
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 b594851be9b..ed6051829d4 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -23,7 +23,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
@@ -198,7 +198,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
@@ -228,7 +228,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
diff --git a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
index cde0a9cfa8c..9467039a407 100644
--- a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
@@ -12403,7 +12403,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12417,7 +12417,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `tt_xx_1` (
master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
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 IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12443,7 +12443,7 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12458,7 +12458,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_xx_2)
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 IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12484,7 +12484,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12499,7 +12499,7 @@ master-bin.000001 # Table_map # # table_id: # (test.tt_xx_3)
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 # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12524,7 +12524,7 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12538,7 +12538,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `nt_xx_4` (
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_4)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12563,7 +12563,7 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12577,7 +12577,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `nt_xx_5` (
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_5)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12602,7 +12602,7 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
@@ -12616,7 +12616,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `nt_xx_6` (
master-bin.000001 # Table_map # # table_id: # (test.nt_xx_6)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -12827,11 +12827,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13031,11 +13031,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13261,11 +13261,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13499,11 +13499,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
index b5adcefe373..0852d1048f2 100644
--- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
+++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
@@ -188,7 +188,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-DROP TABLE IF EXISTS t1,t2,t3
+DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t1(word VARCHAR(20))
@@ -297,7 +297,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-DROP TABLE IF EXISTS t1,t2,t3
+DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t1(word VARCHAR(20))
diff --git a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
index 92b6592dcfb..a05213217b2 100644
--- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
+++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
@@ -201,7 +201,7 @@ DROP TABLE t1;
[MASTER] ********* SOW BINLOG EVENTS IN ... *********
show binlog events in 'master-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Query # # use `test`; DROP TABLE t1
+master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
[MASTER] ********* SOW BINLOG EVENTS *********
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
@@ -234,7 +234,7 @@ master-bin.000001 # Rotate # # master-bin.000002;pos=4
[SLAVE] ********* SOW BINLOG EVENTS IN ... *********
show binlog events in 'slave-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Query # # use `test`; DROP TABLE t1
+slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
[SLAVE] ********* SOW BINLOG EVENTS *********
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
diff --git a/mysql-test/suite/rpl/r/rpl_server_id.result b/mysql-test/suite/rpl/r/rpl_server_id.result
index 1e74394c122..f7d778a288b 100644
--- a/mysql-test/suite/rpl/r/rpl_server_id.result
+++ b/mysql-test/suite/rpl/r/rpl_server_id.result
@@ -7,7 +7,7 @@ select @@server_id;
1
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3
+master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
set global server_id=2;
create table t2 (b int);
@@ -16,7 +16,7 @@ select @@server_id;
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3
+master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 2 # use `test`; create table t2 (b int)
set global server_id=3;
@@ -26,7 +26,7 @@ select @@server_id;
3
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3
+master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
master-bin.000001 # Query 2 # use `test`; create table t2 (b int)
master-bin.000001 # Query 3 # use `test`; create table t3 (c int)
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 42f7a9c7ed8..7d1d050e56b 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -430,7 +430,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
select * from mysqltest1.t1
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`; DROP TABLE `t1` /* generated by server */
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`()
@@ -571,7 +571,7 @@ master-bin.000001 # Query # # COMMIT
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`; DROP TABLE IF EXISTS `t1` /* generated by server */
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)
@@ -587,7 +587,7 @@ master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNC
RETURN 0
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 # # use `test`; DROP TABLE `t1` /* generated by server */
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
@@ -722,7 +722,7 @@ SET TIMESTAMP=t/*!*/;
alter procedure foo2 contains sql
/*!*/;
SET TIMESTAMP=t/*!*/;
-drop table t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
SET TIMESTAMP=t/*!*/;
create table t1 (a int)
@@ -1060,7 +1060,7 @@ SET TIMESTAMP=t/*!*/;
DROP PROCEDURE IF EXISTS p1
/*!*/;
SET TIMESTAMP=t/*!*/;
-DROP TABLE IF EXISTS t1
+DROP TABLE IF EXISTS `t1` /* generated by server */
/*!*/;
SET TIMESTAMP=t/*!*/;
CREATE TABLE t1(col VARCHAR(10))
@@ -1102,7 +1102,7 @@ SET TIMESTAMP=t/*!*/;
DROP FUNCTION f1
/*!*/;
SET TIMESTAMP=t/*!*/;
-drop table t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
SET TIMESTAMP=t/*!*/;
drop database if exists mysqltest
diff --git a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
index c752e836ebb..75f668d8c08 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
@@ -57,14 +57,14 @@ SET @commands= 'Drop-Temp-T-Temp';
DROP TEMPORARY TABLE tt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-N-Temp';
DROP TEMPORARY TABLE nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-Xe-Temp';
@@ -80,7 +80,7 @@ Warnings:
Note 1051 Unknown table 'tt_xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TXe-Temp';
@@ -88,7 +88,7 @@ DROP TEMPORARY TABLE tt_tmp_2, tt_1;
ERROR 42S02: Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-If-TXe-Temp';
@@ -97,7 +97,7 @@ Warnings:
Note 1051 Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-NXe-Temp';
@@ -105,7 +105,7 @@ DROP TEMPORARY TABLE nt_tmp_2, tt_1;
ERROR 42S02: Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-If-NXe-Temp';
@@ -114,28 +114,30 @@ Warnings:
Note 1051 Unknown table 'tt_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TN-Temp';
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-TT-Temp';
DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-NN-Temp';
DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -151,7 +153,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -169,8 +171,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -182,8 +184,10 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -197,12 +201,16 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -249,7 +257,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -271,8 +279,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -286,7 +294,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -306,8 +314,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -322,7 +330,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -344,8 +352,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -358,8 +366,10 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -375,12 +385,16 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -394,8 +408,11 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -413,12 +430,18 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -430,8 +453,11 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -440,18 +466,23 @@ BEGIN;
INSERT INTO tt_xx_1() VALUES (1);
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -464,7 +495,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -481,7 +512,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -493,8 +524,10 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -507,11 +540,13 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -528,7 +563,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -548,8 +583,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -561,8 +596,10 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -578,12 +615,16 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -632,7 +673,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -656,8 +697,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -671,7 +712,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -693,8 +734,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -709,7 +750,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -733,8 +774,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -747,8 +788,10 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -766,12 +809,16 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -785,8 +832,11 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -806,12 +856,18 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -823,8 +879,11 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -833,20 +892,25 @@ BEGIN;
INSERT INTO tt_xx_1() VALUES (1);
DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -859,7 +923,7 @@ ROLLBACK;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -878,7 +942,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -890,8 +954,10 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -906,11 +972,13 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -925,14 +993,14 @@ SET @commands= 'Drop-T';
DROP TABLE tt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-N';
DROP TABLE nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Xe';
@@ -948,7 +1016,7 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TXe';
@@ -956,7 +1024,7 @@ DROP TABLE tt_2, xx_1;
ERROR 42S02: Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-If-TXe';
@@ -965,7 +1033,7 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-NXe';
@@ -973,7 +1041,7 @@ DROP TABLE nt_2, xx_1;
ERROR 42S02: Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-If-NXe';
@@ -982,42 +1050,45 @@ Warnings:
Note 1051 Unknown table 'xx_1'
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TN';
DROP TABLE tt_2, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TT';
DROP TABLE tt_1, tt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-NN';
DROP TABLE nt_1, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-N-TN-Temp';
DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-TN-Temp';
DROP TABLE tt_tmp_2, nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1033,7 +1104,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-N';
@@ -1045,7 +1116,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-Xe';
@@ -1071,7 +1142,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TXe';
@@ -1084,7 +1155,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-If-TXe';
@@ -1098,7 +1169,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-NXe';
@@ -1111,7 +1182,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-If-NXe';
@@ -1125,7 +1196,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TN';
@@ -1137,7 +1208,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TT';
@@ -1149,7 +1220,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-NN';
@@ -1161,7 +1232,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-N-TN-Temp';
@@ -1173,7 +1244,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'B T Drop-TN-Temp';
@@ -1185,7 +1258,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
#########################################################################
@@ -1202,10 +1276,10 @@ DROP TEMPORARY TABLE nt_tmp_1;
DROP TEMPORARY TABLE nt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
@@ -1215,10 +1289,10 @@ DROP TEMPORARY TABLE tt_tmp_1;
DROP TEMPORARY TABLE tt_tmp_2;
-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1236,11 +1310,19 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1254,10 +1336,10 @@ COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1276,11 +1358,19 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1294,10 +1384,10 @@ ROLLBACK;
-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1336,6 +1426,8 @@ BEGIN;
INSERT INTO nt_xx_1() VALUES (1);
INSERT INTO nt_tmp_xx_1() VALUES (1);
INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
INSERT INTO nt_tmp_xx_1() VALUES (1);
COMMIT;
-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1347,8 +1439,10 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1391,9 +1485,11 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1431,6 +1527,8 @@ BEGIN;
INSERT INTO nt_xx_1() VALUES (1);
INSERT INTO nt_tmp_xx_1() VALUES (1);
INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
INSERT INTO nt_tmp_xx_1() VALUES (1);
ROLLBACK;
Warnings:
@@ -1444,8 +1542,10 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -1492,8 +1592,10 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
diff --git a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result
index 8e245db6c3c..6f53ad68d76 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result
@@ -430,7 +430,7 @@ DROP TEMPORARY TABLE IF EXISTS new_tt_xx;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (8)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS new_tt_xx
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `new_tt_xx` /* generated by server */
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
@@ -493,7 +493,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (3)
master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
index 1dfd8f4eb3f..472be5ee607 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -23,7 +23,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=1
master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
@@ -198,7 +198,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=1
master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
@@ -227,7 +227,7 @@ slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Intvar # # INSERT_ID=1
slave-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
slave-bin.000001 # Query # # COMMIT
-slave-bin.000001 # Query # # use `test`; drop table t1
+slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
diff --git a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
index d2b21099cd6..5dc86137635 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
@@ -171,7 +171,7 @@ DROP TABLE t1;
[MASTER] ********* SOW BINLOG EVENTS IN ... *********
show binlog events in 'master-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Query # # use `test`; DROP TABLE t1
+master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
[MASTER] ********* SOW BINLOG EVENTS *********
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
@@ -198,7 +198,7 @@ master-bin.000001 # Rotate # # master-bin.000002;pos=4
[SLAVE] ********* SOW BINLOG EVENTS IN ... *********
show binlog events in 'slave-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Query # # use `test`; DROP TABLE t1
+slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
[SLAVE] ********* SOW BINLOG EVENTS *********
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
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 300932b7b8d..c71dd780138 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
@@ -7092,24 +7092,20 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1
-master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (233, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T tN C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (233, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T tN C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -7345,24 +7341,20 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1;
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1
-master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (241, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T tNe C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (241, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> B T tNe C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -7532,9 +7524,6 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1
-master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
ROLLBACK;
@@ -7543,15 +7532,14 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (247, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T tN R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (247, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T tN R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -7791,9 +7779,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1;
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1
-master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
ROLLBACK;
@@ -7802,15 +7787,14 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (255, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B T tNe R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (255, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> B T tNe R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10164,12 +10148,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10185,12 +10169,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10206,12 +10190,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM nt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10227,12 +10211,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10248,12 +10232,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10269,12 +10253,12 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(tran
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -10445,11 +10429,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10615,11 +10599,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10651,9 +10635,6 @@ Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
-master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> IS-N<-T << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 6);
@@ -10664,6 +10645,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 3)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 6)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10671,10 +10653,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_xx_9
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 3)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 6)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> trunc-CS-N B T IS-N<-T T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10696,9 +10676,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1;;
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1
-master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> ISe-N<-T << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 6);
@@ -10709,6 +10686,7 @@ COMMIT;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 3)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 6)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10716,10 +10694,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_xx_9
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 3)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 6)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> trunc-CS-N B T ISe-N<-T T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10806,11 +10782,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10996,11 +10972,11 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
@@ -11037,11 +11013,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_11;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11095,11 +11071,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_12;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11139,11 +11115,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_13;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11189,11 +11165,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_14;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11227,11 +11203,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_15;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11277,11 +11253,11 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
DROP TEMPORARY TABLE IF EXISTS tt_xx_16;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
-e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
###################################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
index 3de1eb46a4c..e90d7c3f2d2 100644
--- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
+++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
@@ -60,8 +60,8 @@ slave-bin.000001 # Query # # use `test`; CREATE TABLE t3 ( i1 INT NOT NULL AUTO_
slave-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES ()
slave-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t1_tmp (i1 int)
slave-bin.000001 # Query # # use `test`; ALTER TABLE t1_tmp ADD COLUMN b INT
-slave-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
slave-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t1_tmp` /* generated by server */
+slave-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
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
@@ -70,4 +70,4 @@ slave-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2_tmp`
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
slave-bin.000001 # Query # # COMMIT
-slave-bin.000001 # Query # # use `test`; DROP TABLE t3, t1
+slave-bin.000001 # Query # # use `test`; DROP TABLE `t3`,`t1` /* generated by server */
diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def
index 00c1193ec49..f864139495a 100644
--- a/mysql-test/suite/rpl/t/disabled.def
+++ b/mysql-test/suite/rpl/t/disabled.def
@@ -10,7 +10,8 @@
#
##############################################################################
-rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576
-rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
-rpl_failed_optimize : WL#4284: Can't optimize table used by a pending transaction (there is metadata lock on the table).
-rpl_read_only : WL#4284: Setting Read only won't succeed until all metadata locks are released.
+rpl_failed_optimize : WL#4284: Can't optimize table used by a pending transaction (there is metadata lock on the table).
+rpl_plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5
+rpl_read_only : WL#4284: Setting Read only won't succeed until all metadata locks are released.
+rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576
+rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
diff --git a/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test
index 114f71af873..6b459bb9c76 100644
--- a/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test
+++ b/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test
@@ -120,4 +120,57 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+--echo # WL#5370
+--echo # The behavior of statement 'CREATE TABLE SELECT IF NOT EXISTS' is changed.
+--echo # After the worklog, it will insert nothing and the statement will not be
+--echo # binlogged if the table already exists.
+--echo # After the worklog, some bugs will disappear automotically.
+source include/master-slave-reset.inc;
+
+--echo
+--echo # Case 1: BUG#47132
+connection master;
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int);
+INSERT INTO t1 VALUES (1), (1);
+INSERT INTO t2 VALUES (2), (2);
+
+CREATE VIEW v1 AS SELECT id FROM t2;
+--let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
+CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1;
+--source include/show_binlog_events.inc
+
+SHOW CREATE TABLE v1;
+SELECT * FROM t2;
+SELECT * FROM v1;
+DROP VIEW v1;
+
+# the warning only happens on SBR, so we disable it.
+--disable_warnings
+CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2;
+--enable_warnings
+
+--let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
+CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1;
+--source include/show_binlog_events.inc
+SELECT * FROM t2;
+SELECT * FROM tt1;
+DROP TEMPORARY TABLE tt1;
+
+--echo
+--echo # Case 1: BUG#47132
+--echo # RBR breaks on CREATE TABLE IF EXISTS <existing VIEW> AS SELECT
+CREATE VIEW v1 AS SELECT 1 as a;
+--let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
+CREATE TABLE IF NOT EXISTS v1 SELECT 2 as a;
+--source include/show_binlog_events.inc
+sync_slave_with_master;
+
+connection master;
+DROP VIEW v1;
+
+DROP TABLE t1, t2;
+
source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_drop.test b/mysql-test/suite/rpl/t/rpl_drop.test
index 6f586d90de3..7af325240ee 100644
--- a/mysql-test/suite/rpl/t/rpl_drop.test
+++ b/mysql-test/suite/rpl/t/rpl_drop.test
@@ -10,3 +10,4 @@ drop table t1, t2;
sync_slave_with_master;
# End of 4.1 tests
+
diff --git a/mysql-test/suite/rpl/t/rpl_flush_logs.test b/mysql-test/suite/rpl/t/rpl_flush_logs.test
index 2118b48f946..5159acaae14 100644
--- a/mysql-test/suite/rpl/t/rpl_flush_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_flush_logs.test
@@ -9,17 +9,10 @@
connection master;
# Test 'flush error logs' statement.
---echo # Make sure the 'master_log.err-old' file does not
---echo # exist before execute 'flush error logs' statement.
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
--echo # Test if support 'flush error logs' statement.
flush error logs;
---echo # Check the 'master_log.err-old' file is created
---echo # after executed 'flush error logs' statement.
-file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
--echo # Make sure binary logs was not be flushed
@@ -109,19 +102,10 @@ sync_slave_with_master;
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007;
connection master;
-remove_file $MYSQLTEST_VARDIR/tmp/master_log.err-old;
-
---echo # Make sure the 'master_log.err-old' file does not exist
---echo # before execute 'flush error logs, relay logs' statement.
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
--echo # Test if support to combine all kinds of logs into one statement.
flush error logs, relay logs;
---echo # Check the 'master_log.err-old' file is created
---echo # after executed 'flush error logs, relay logs' statement.
-file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
--echo # Make sure binary logs was not be flushed
@@ -145,19 +129,10 @@ file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008;
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000009;
connection master;
-remove_file $MYSQLTEST_VARDIR/tmp/master_log.err-old;
-
---echo # Make sure the 'master_log.err-old' file does not exist
---echo # before execute 'flush logs' statement.
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
--echo # Test if 'flush logs' statement works fine and flush all the logs.
flush logs;
---echo # Check the 'master_log.err-old' file is created
---echo # after executed 'flush logs' statement.
-file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
--echo # Check 'master-bin.000003' is created
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata.test b/mysql-test/suite/rpl/t/rpl_loaddata.test
index c47b84144ff..d5e0388be46 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata.test
@@ -3,7 +3,7 @@
# Added to skip if ndb is default #
########################################################
-- source include/not_ndb_default.inc
--- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/have_binlog_format_statement.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_loaddata.test
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
index e80fc160d8f..b8975308a86 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
@@ -1,4 +1,4 @@
-source include/have_binlog_format_mixed_or_statement.inc;
+source include/have_binlog_format_statement.inc;
source include/have_debug.inc;
source include/master-slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map.test b/mysql-test/suite/rpl/t/rpl_loaddata_map.test
index ddee9e7e989..1db7c4a893b 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_map.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_map.test
@@ -16,7 +16,7 @@
# BUG#33413 show binlog events fails if binlog has event size of close
# to max_allowed_packet
-source include/have_binlog_format_mixed_or_statement.inc;
+source include/have_binlog_format_statement.inc;
source include/master-slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_mixed_row_innodb.test b/mysql-test/suite/rpl/t/rpl_mixed_row_innodb.test
deleted file mode 100644
index 3f7ee971347..00000000000
--- a/mysql-test/suite/rpl/t/rpl_mixed_row_innodb.test
+++ /dev/null
@@ -1,8 +0,0 @@
-# File for specialities regarding replication from or to InnoDB
-# tables.
-
-source include/master-slave.inc;
-source include/have_innodb.inc;
-source include/have_binlog_format_mixed_or_row.inc;
-
-source extra/rpl_tests/rpl_innodb.test;
diff --git a/mysql-test/suite/rpl/t/rpl_savepoint.test b/mysql-test/suite/rpl/t/rpl_savepoint.test
index c3d1f44d162..7fe8a0da651 100644
--- a/mysql-test/suite/rpl/t/rpl_savepoint.test
+++ b/mysql-test/suite/rpl/t/rpl_savepoint.test
@@ -30,7 +30,7 @@ connection master1;
connection master;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table" AND info = "DROP TABLE tt";
+ WHERE state = "Waiting for table metadata lock" AND info = "DROP TABLE tt";
--source include/wait_condition.inc
ROLLBACK TO SAVEPOINT insert_statement;
COMMIT;
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 b85ed18ab51..1cf88deb56f 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
@@ -8,7 +8,7 @@
# 2 - Catches error.
##########################################################################
---source include/have_binlog_format_mixed_or_statement.inc
+--source include/have_binlog_format_statement.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/master-slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index 8510f387111..b2e7418ce14 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -655,7 +655,8 @@ connection master;
connection master1;
--echo # Waitng for 'insert into t1 ...' to get blocked on table lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='insert into t1 (a) values (f1())';
+where state='Waiting for table metadata lock' and
+ info='insert into t1 (a) values (f1())';
--source include/wait_condition.inc
--echo # Sending 'drop function f1'. It will wait till insert finishes.
--send drop function f1;
@@ -663,7 +664,7 @@ where state='Waiting for table' and info='insert into t1 (a) values (f1())';
connection default;
--echo # Check that 'drop function f1' gets blocked.
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop function f1';
+where state='Waiting for stored function metadata lock' and info='drop function f1';
--source include/wait_condition.inc
--echo # Now let's let 'insert' go through...
unlock tables;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_innodb.test b/mysql-test/suite/rpl/t/rpl_stm_innodb.test
index cbdc402d407..5b3fef9c66b 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_innodb.test
@@ -3,6 +3,6 @@
source include/master-slave.inc;
source include/have_innodb.inc;
-source include/have_binlog_format_statement.inc;
+source include/have_binlog_format_mixed_or_statement.inc;
source extra/rpl_tests/rpl_innodb.test;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_log.test b/mysql-test/suite/rpl/t/rpl_stm_log.test
index 2af9d7f85bc..7bc17fbaada 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_log.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_log.test
@@ -1,5 +1,5 @@
# Requires statement logging
--- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test
diff --git a/mysql-test/suite/rpl/t/rpl_view_multi.test b/mysql-test/suite/rpl/t/rpl_view_multi.test
index 852d1d8d20c..5b3e7cf76f8 100644
--- a/mysql-test/suite/rpl/t/rpl_view_multi.test
+++ b/mysql-test/suite/rpl/t/rpl_view_multi.test
@@ -56,7 +56,7 @@ let $wait_condition=
connection master;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "drop view v1";
+ where state = "Waiting for table metadata lock" and info = "drop view v1";
--source include/wait_condition.inc
select release_lock("lock_bg25144");
@@ -106,7 +106,7 @@ let $wait_condition=
connection master;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "alter view v1 as select * from t2";
--source include/wait_condition.inc
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result
index 6a0c863440e..6fdfaa30369 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result
@@ -34,7 +34,7 @@ pk1 b c
1 2 3
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
master-bin.000001 # Query 1 # use `test`; CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
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 375717ee171..ef563d71342 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
@@ -25,7 +25,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
@@ -204,7 +204,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
@@ -240,7 +240,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result
index f29953a1dd5..65e5469c9eb 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result
@@ -609,7 +609,7 @@ Note 1051 Unknown table 'tt_xx'
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result
index 20c70092446..0f2732069ec 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result
@@ -610,7 +610,7 @@ Note 1051 Unknown table 'tt_xx'
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
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 14d3baee1b0..36a7ae0016b 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
@@ -37,7 +37,7 @@ 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`; DROP TABLE `t1` /* generated by server */
**** On Master ****
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
INSERT INTO t1 VALUES (1,1), (2,2);
@@ -72,7 +72,7 @@ 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`; DROP TABLE `t1` /* generated by server */
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)
@@ -86,4 +86,4 @@ 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
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
diff --git a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def
index 8eda2f18958..3dca5048213 100644
--- a/mysql-test/suite/rpl_ndb/t/disabled.def
+++ b/mysql-test/suite/rpl_ndb/t/disabled.def
@@ -10,8 +10,6 @@
#
##############################################################################
-rpl_ndb_stm_innodb : Bug#54850 2010-07-02 alik rpl_ndb.rpl_ndb_stm_innodb and rpl_ndb.rpl_ndb_2other fails
-rpl_ndb_2other : Bug#54850 2010-07-02 alik rpl_ndb.rpl_ndb_stm_innodb and rpl_ndb.rpl_ndb_2other fails
rpl_ndb_row_implicit_commit_binlog : Bug#55849 2010-08-09 alik rpl_ndb.rpl_ndb_row_implicit_commit_binlog fails
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt
index dff423702b4..378a377e053 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt
@@ -1 +1 @@
---innodb --loose-ndbcluster=OFF --log-slave-updates=0
+--innodb --loose-ndbcluster=OFF --log-slave-updates=0 --default-storage-engine=MyISAM
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-slave.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-slave.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/suite/sys_vars/r/concurrent_insert_func.result b/mysql-test/suite/sys_vars/r/concurrent_insert_func.result
index 0b5b342e134..56e83d98872 100644
--- a/mysql-test/suite/sys_vars/r/concurrent_insert_func.result
+++ b/mysql-test/suite/sys_vars/r/concurrent_insert_func.result
@@ -37,9 +37,9 @@ INSERT INTO t1(name) VALUES('Record_7');
connection default;
## show processlist info and state ##
SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
+WHERE state= "Waiting for table level lock" AND info LIKE "INSERT INTO t1%";
state info
-Table lock INSERT INTO t1(name) VALUES('Record_7')
+Waiting for table level lock INSERT INTO t1(name) VALUES('Record_7')
## table contents befor UNLOCK ##
SELECT * FROM t1;
name
diff --git a/mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result b/mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result
index 5e55faa99c9..200f9166215 100644
--- a/mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result
@@ -1,32 +1,32 @@
SET @start_global_value = @@global.innodb_strict_mode;
SELECT @start_global_value;
@start_global_value
-1
+0
Valid values are 'ON' and 'OFF'
select @@global.innodb_strict_mode in (0, 1);
@@global.innodb_strict_mode in (0, 1)
1
select @@global.innodb_strict_mode;
@@global.innodb_strict_mode
-1
+0
select @@session.innodb_strict_mode in (0, 1);
@@session.innodb_strict_mode in (0, 1)
1
select @@session.innodb_strict_mode;
@@session.innodb_strict_mode
-1
+0
show global variables like 'innodb_strict_mode';
Variable_name Value
-innodb_strict_mode ON
+innodb_strict_mode OFF
show session variables like 'innodb_strict_mode';
Variable_name Value
-innodb_strict_mode ON
+innodb_strict_mode OFF
select * from information_schema.global_variables where variable_name='innodb_strict_mode';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_STRICT_MODE ON
+INNODB_STRICT_MODE OFF
select * from information_schema.session_variables where variable_name='innodb_strict_mode';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_STRICT_MODE ON
+INNODB_STRICT_MODE OFF
set global innodb_strict_mode='OFF';
set session innodb_strict_mode='OFF';
select @@global.innodb_strict_mode;
@@ -117,4 +117,4 @@ INNODB_STRICT_MODE ON
SET @@global.innodb_strict_mode = @start_global_value;
SELECT @@global.innodb_strict_mode;
@@global.innodb_strict_mode
-1
+0
diff --git a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result
index abb8fdcd2a0..6b90b61a035 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result
@@ -11,7 +11,6 @@ CREATE TABLE t1(id int, value varchar(10));
INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3');
-CREATE VIEW v1 AS SELECT * FROM t1;
SET GLOBAL query_cache_size = 131072;
FLUSHING CACHE
SET GLOBAL query_cache_size = 0;
@@ -33,11 +32,11 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
1 Expected
-LOCK TABLE v1 WRITE;
+LOCK TABLE t1 WRITE;
UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
-Qcache_queries_in_cache 1
+Qcache_queries_in_cache 0
0 Expected
'#----------------------------FN_DYNVARS_136_02-----------------------#'
SELECT * FROM t1;
@@ -49,13 +48,12 @@ id value
2 val2
3 val3
** Connection con0 **
-LOCK TABLE v1 WRITE;
+LOCK TABLE t1 WRITE;
** Connection con1 **
** Asynchronous Execution **
SELECT * FROM t1;
** Connection con0 **
wait until table is locked
-Timeout in wait_condition.inc for SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Table lock'
UNLOCK TABLES;
** Connection con1 **
** Asynchronous Result **
@@ -79,7 +77,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
1 Expected
-LOCK TABLE v1 WRITE;
+LOCK TABLE t1 WRITE;
UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
@@ -102,7 +100,7 @@ id value
2 val2
3 val3
** Connection con0 **
-LOCK TABLE v1 WRITE;
+LOCK TABLE t1 WRITE;
** Connection con1 **
** Should not be blocked **
SELECT * FROM t1;
@@ -165,4 +163,3 @@ SET @@GLOBAL.query_cache_type = @old_cache_type;
** Connection default **
Disconnecting Connections con0, con1
DROP TABLE t1;
-DROP VIEW v1;
diff --git a/mysql-test/suite/sys_vars/t/concurrent_insert_func.test b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test
index 018247df3ff..b97c926e6b5 100644
--- a/mysql-test/suite/sys_vars/t/concurrent_insert_func.test
+++ b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test
@@ -98,12 +98,13 @@ INSERT INTO t1(name) VALUES('Record_7');
connection default;
# wait until INSERT will be locked (low performance)
let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
+ WHERE state= "Waiting for table level lock" AND
+ info LIKE "INSERT INTO t1%";
--source include/wait_condition.inc
--echo ## show processlist info and state ##
SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
+WHERE state= "Waiting for table level lock" AND info LIKE "INSERT INTO t1%";
--echo ## table contents befor UNLOCK ##
SELECT * FROM t1;
UNLOCK TABLES;
diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test
index 60092dbb8e8..427f2730e47 100644
--- a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test
+++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test
@@ -123,7 +123,7 @@ connection default;
--echo ** Wait till con0 is blocked **
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = 'Table lock' AND info = '$my_select';
+ WHERE state = 'Waiting for table level lock' AND info = '$my_select';
--source include/wait_condition.inc
UNLOCK TABLES;
@@ -219,7 +219,7 @@ connection default;
--echo ** Wait till con0 is blocked **
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = 'Table lock' AND info = '$my_select';
+ WHERE state = 'Waiting for table level lock' AND info = '$my_select';
--source include/wait_condition.inc
UNLOCK TABLES;
diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
index a72d73105a6..e7486614ec7 100644
--- a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
@@ -60,8 +60,6 @@ INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3');
-CREATE VIEW v1 AS SELECT * FROM t1;
-
#
# Clearing the query cache and setting up cache size
#
@@ -101,7 +99,7 @@ SELECT * FROM t1;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected
-LOCK TABLE v1 WRITE;
+LOCK TABLE t1 WRITE;
UNLOCK TABLES;
@@ -129,7 +127,7 @@ SELECT * FROM t1;
--echo ** Connection con0 **
connection con0;
-LOCK TABLE v1 WRITE;
+LOCK TABLE t1 WRITE;
--echo ** Connection con1 **
connection con1;
@@ -141,7 +139,8 @@ send SELECT * FROM t1;
connection con0;
--echo wait until table is locked
-let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Table lock';
+let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist
+ WHERE state= 'Waiting for table metadata lock';
--source include/wait_condition.inc
UNLOCK TABLES;
@@ -177,7 +176,7 @@ SELECT * FROM t1;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected
-LOCK TABLE v1 WRITE;
+LOCK TABLE t1 WRITE;
UNLOCK TABLES;
@@ -201,7 +200,7 @@ SELECT * FROM t1;
--echo ** Connection con0 **
connection con0;
-LOCK TABLE v1 WRITE;
+LOCK TABLE t1 WRITE;
--echo ** Connection con1 **
connection con1;
@@ -283,7 +282,6 @@ disconnect con0;
disconnect con1;
DROP TABLE t1;
-DROP VIEW v1;
--enable_ps_protocol
diff --git a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test
index 03f56f1fe16..ba13558a135 100644
--- a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test
+++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test
@@ -86,7 +86,9 @@ delimiter ;|
--echo ** Connection con0 **
connection con0;
-let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state='Table lock' AND info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
+let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist
+ WHERE state='Waiting for table level lock' AND
+ info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
--source include/wait_condition.inc
--echo ** Asynchronous Execution **
@@ -102,7 +104,8 @@ delimiter ;|
--echo ** Connection default **
connection default;
-let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Table lock';
+let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist
+ WHERE state LIKE 'Waiting for table level lock';
--source include/wait_condition.inc
UNLOCK TABLES;
@@ -157,7 +160,9 @@ delimiter ;|
--echo ** Connection con0 **
connection con0;
-let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state='Table lock' AND info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
+let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist
+ WHERE state='Waiting for table level lock' AND
+ info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
--source include/wait_condition.inc
--echo ** Asynchronous Execution **
@@ -173,7 +178,8 @@ delimiter ;|
--echo ** Connection default **
connection default;
-let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Table lock';
+let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist
+ WHERE state LIKE 'Waiting for table level lock';
--source include/wait_condition.inc
UNLOCK TABLES;
diff --git a/mysql-test/suite/sys_vars/t/thread_concurrency_basic.test b/mysql-test/suite/sys_vars/t/thread_concurrency_basic.test
index d4acc961752..6d4ca3e2b4d 100644
--- a/mysql-test/suite/sys_vars/t/thread_concurrency_basic.test
+++ b/mysql-test/suite/sys_vars/t/thread_concurrency_basic.test
@@ -1,4 +1,3 @@
---source include/have_thread_concurrency.inc
#
# only global
#
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index 076e32eb22c..42751b8ce06 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -334,7 +334,7 @@ INSERT INTO t1 VALUES (1), (1);
CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
--error ER_DUP_ENTRY
-CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
+INSERT INTO t2 SELECT a FROM t1;
UPDATE t2 SET a = 2;
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index 028c64d6de7..e1c807fe32b 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -111,6 +111,9 @@ explain extended SELECT
SHOW CREATE TABLE t1;
DROP TABLE t1;
+--error 1267
+CREATE TABLE t1 SELECT IFNULL('a' COLLATE latin1_swedish_ci, 'b' COLLATE latin1_bin);
+
# Test for BUG#10151
SELECT 'case+union+test'
UNION
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 887ae4da404..8181b873029 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -5,6 +5,7 @@
--disable_warnings
drop table if exists t1,t2,t3,t4,t5;
drop database if exists mysqltest;
+drop view if exists v1;
--enable_warnings
create table t1 (b char(0));
@@ -232,7 +233,6 @@ drop table t1;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
---error 1136
create table if not exists t1 select 1,2,3,4;
create table if not exists t1 select 1;
select * from t1;
@@ -248,8 +248,6 @@ insert into t1 values (1,1);
create table if not exists t1 select 2;
select * from t1;
create table if not exists t1 select 3 as 'a',4 as 'b';
---error ER_DUP_ENTRY
-create table if not exists t1 select 3 as 'a',3 as 'b';
show warnings;
show status like "Opened_tables";
select * from t1;
@@ -517,7 +515,7 @@ drop table t1,t2;
# an improper fix is present.
#
create table t1 (a int);
---error 1093
+--error ER_TABLE_EXISTS_ERROR
create table t1 select * from t1;
--error ER_WRONG_OBJECT
create table t2 union = (t1) select * from t1;
@@ -730,7 +728,6 @@ create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1
create table t1 (primary key(a)) select "b" as b;
# Error in select_create::prepare() which is not related to table creation
create table t1 (a int);
---error ER_WRONG_VALUE_COUNT_ON_ROW
create table if not exists t1 select 1 as a, 2 as b;
drop table t1;
# Finally error which happens during insert
@@ -742,20 +739,13 @@ create table t1 (i int);
create table t1 select 1 as i;
create table if not exists t1 select 1 as i;
select * from t1;
-# Error which is detected after successfull table open.
---error ER_UPDATE_TABLE_USED
+# After WL#5370, it just generates a warning that the table already exists.
create table if not exists t1 select * from t1;
select * from t1;
+drop table t1;
# Error before select_create::prepare()
--error ER_CANT_AGGREGATE_2COLLATIONS
create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
-select * from t1;
-# Error which happens during insertion of rows
-alter table t1 add primary key (i);
---error ER_DUP_ENTRY
-create table if not exists t1 (select 2 as i) union all (select 2 as i);
-select * from t1;
-drop table t1;
# Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent
@@ -1229,11 +1219,9 @@ INSERT IGNORE INTO t1 (b) VALUES (5);
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
SELECT a FROM t1;
--error 1062
-CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
- SELECT a FROM t1;
+INSERT INTO t2 SELECT a FROM t1;
--error 1062
-CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
- SELECT a FROM t1;
+INSERT INTO t2 SELECT a FROM t1;
DROP TABLE t1, t2;
@@ -1273,7 +1261,7 @@ CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
drop table if exists t2;
CREATE TABLE t2 (a int, b int, primary key (a));
--error ER_DUP_ENTRY
-CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+INSERT INTO t2 select * from t1;
SELECT * from t2;
TRUNCATE table t2;
--error ER_DUP_ENTRY
@@ -1283,11 +1271,7 @@ drop table t2;
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
--error ER_DUP_ENTRY
-CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
-SELECT * from t2;
-TRUNCATE table t2;
---error ER_DUP_ENTRY
-INSERT INTO t2 select * from t1;
+INSERT INTO t2 SELECT * FROM t1;
SELECT * from t2;
drop table t1,t2;
@@ -1657,11 +1641,7 @@ END ; |
--delimiter ;
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-CREATE TABLE IF NOT EXISTS t1 (
- `pk` INTEGER NOT NULL AUTO_INCREMENT ,
- `int` INTEGER ,
- PRIMARY KEY ( `pk` )
-) SELECT `pk` , `int_key` FROM B ;
+INSERT INTO t1 (pk, int_key) SELECT `pk` , `int_key` FROM B ;
--delimiter |
--error ER_NOT_SUPPORTED_YET
@@ -1675,7 +1655,6 @@ END ;|
DROP TABLE t1;
DROP TABLE B;
-
--echo #
--echo # Bug #47107 assert in notify_shared_lock on incorrect
--echo # CREATE TABLE , HANDLER
@@ -1798,3 +1777,243 @@ show create table t1;
show create table t2;
set @@sql_mode= @old_mode;
drop tables t1, t2;
+#
+# Bug#47132 CREATE TABLE.. SELECT.. data not inserted if table
+# is view over multiple tables
+#
+
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int);
+INSERT INTO t1 VALUES (1), (1);
+INSERT INTO t2 VALUES (2), (2);
+
+CREATE VIEW v1 AS SELECT id FROM t2;
+CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1;
+SHOW CREATE TABLE v1;
+SELECT * FROM t2;
+SELECT * FROM v1;
+DROP VIEW v1;
+
+CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2;
+CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1;
+SELECT * FROM t2;
+SELECT * FROM tt1;
+DROP TEMPORARY TABLE tt1;
+
+DROP TABLE t1, t2;
+
+
+--echo #
+--echo # WL#5370 "Changing 'CREATE TABLE IF NOT EXISTS ... SELECT'
+--echo # behaviour.
+--echo #
+
+--echo #
+--echo # 1. Basic case: a base table.
+--echo #
+
+create table if not exists t1 (a int) select 1 as a;
+select * from t1;
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int) select 2 as a;
+select * from t1;
+--echo # Produces an essential warning ER_TABLE_EXISTS.
+create table if not exists t1 (a int) select 2 as a;
+--echo # No new data in t1.
+select * from t1;
+drop table t1;
+
+--echo #
+--echo # 2. A temporary table.
+--echo #
+
+create temporary table if not exists t1 (a int) select 1 as a;
+select * from t1;
+--error ER_TABLE_EXISTS_ERROR
+create temporary table t1 (a int) select 2 as a;
+select * from t1;
+--echo # An essential warning.
+create temporary table if not exists t1 (a int) select 2 as a;
+--echo # No new data in t1.
+select * from t1;
+drop temporary table t1;
+
+--echo #
+--echo # 3. Creating a base table in presence of a temporary table.
+--echo #
+
+create table t1 (a int);
+--echo # Create a view for convenience of querying t1 shadowed by a temp.
+create view v1 as select a from t1;
+drop table t1;
+create temporary table t1 (a int) select 1 as a;
+create table if not exists t1 (a int) select 2 as a;
+select * from t1;
+select * from v1;
+--echo # Note: an essential warning.
+create table if not exists t1 (a int) select 3 as a;
+select * from t1;
+select * from v1;
+drop temporary table t1;
+select * from t1;
+drop view v1;
+drop table t1;
+
+--echo #
+--echo # 4. Creating a temporary table in presence of a base table.
+--echo #
+
+create table t1 (a int) select 1 as a;
+create temporary table if not exists t1 select 2 as a;
+select * from t1;
+--echo # Note: an essential warning.
+create temporary table if not exists t1 select 3 as a;
+select * from t1;
+drop temporary table t1;
+select * from t1;
+drop table t1;
+
+--echo #
+--echo # 5. Creating a base table in presence of an updatable view.
+--echo #
+create table t2 (a int unique);
+create view t1 as select a from t2;
+insert into t1 (a) values (1);
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int);
+--echo # Note: an essential warning.
+create table if not exists t1 (a int);
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int) select 2 as a;
+select * from t1;
+--echo # Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+select * from t1;
+select * from t2;
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+select * from t2;
+--echo # Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+select * from t1;
+select * from t2;
+drop temporary table t1;
+
+--echo #
+--echo # Repeating the test with a non-updatable view.
+--echo #
+drop view t1;
+create view t1 as select a + 5 as a from t2;
+--error ER_NON_INSERTABLE_TABLE
+insert into t1 (a) values (1);
+--error ER_NONUPDATEABLE_COLUMN
+update t1 set a=3 where a=2;
+
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int);
+--echo # Note: an essential warning.
+create table if not exists t1 (a int);
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int) select 2 as a;
+select * from t1;
+--echo # Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+select * from t1;
+select * from t2;
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+select * from t2;
+--echo # Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+select * from t1;
+select * from t2;
+drop temporary table t1;
+drop view t1;
+drop table t2;
+
+--echo #
+--echo # Repeating the test with a view select a constant number
+--echo #
+create view t1 as select 1 as a;
+--error ER_NON_INSERTABLE_TABLE
+insert into t1 (a) values (1);
+--error ER_NON_UPDATABLE_TABLE
+update t1 set a=3 where a=2;
+
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int);
+--echo # Note: an essential warning.
+create table if not exists t1 (a int);
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int) select 2 as a;
+select * from t1;
+--echo # Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+select * from t1;
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+--echo # Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+select * from t1;
+drop temporary table t1;
+drop view t1;
+
+
+--echo #
+--echo # 6. Test of unique_table().
+--echo #
+
+create table t1 (a int) select 1 as a;
+create temporary table if not exists t1 (a int) select * from t1;
+--error ER_CANT_REOPEN_TABLE
+create temporary table if not exists t1 (a int) select * from t1;
+select * from t1;
+drop temporary table t1;
+select * from t1;
+drop table t1;
+create temporary table t1 (a int) select 1 as a;
+create table if not exists t1 (a int) select * from t1;
+create table if not exists t1 (a int) select * from t1;
+select * from t1;
+drop temporary table t1;
+select * from t1;
+drop table t1;
+--error ER_NO_SUCH_TABLE
+create table if not exists t1 (a int) select * from t1;
+
+--echo #
+--echo # 7. Test of non-matching columns, REPLACE and IGNORE.
+--echo #
+
+create table t1 (a int) select 1 as b, 2 as c;
+select * from t1;
+drop table t1;
+create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
+select * from t1;
+drop table t1;
+set @@session.sql_mode='STRICT_ALL_TABLES';
+--error ER_TRUNCATED_WRONG_VALUE
+create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
+--error ER_NO_SUCH_TABLE
+select * from t1;
+--error ER_TRUNCATED_WRONG_VALUE
+create table if not exists t1 (a int, b date, c date)
+ replace select 1 as b, 2 as c;
+--error ER_NO_SUCH_TABLE
+select * from t1;
+
+create table if not exists t1 (a int, b date, c date)
+ ignore select 1 as b, 2 as c;
+select * from t1;
+set @@session.sql_mode=default;
+drop table t1;
+
+create table if not exists t1 (a int unique, b int)
+ replace select 1 as a, 1 as b union select 1 as a, 2 as b;
+select * from t1;
+drop table t1;
+create table if not exists t1 (a int unique, b int)
+ ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
+select * from t1;
+drop table t1;
+--echo #
diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test
index e9c7e569250..ef705474eee 100644
--- a/mysql-test/t/ctype_utf16.test
+++ b/mysql-test/t/ctype_utf16.test
@@ -326,6 +326,7 @@ SET collation_connection='utf16_general_ci';
SET NAMES latin1;
SET collation_connection='utf16_bin';
-- source include/ctype_filesort.inc
+-- source include/ctype_filesort2.inc
-- source include/ctype_like_escape.inc
#
diff --git a/mysql-test/t/ctype_utf16_def-master.opt b/mysql-test/t/ctype_utf16_def-master.opt
new file mode 100644
index 00000000000..55bb5d14bbd
--- /dev/null
+++ b/mysql-test/t/ctype_utf16_def-master.opt
@@ -0,0 +1 @@
+--character-set-server=utf16,latin1
diff --git a/mysql-test/t/ctype_utf16_def.test b/mysql-test/t/ctype_utf16_def.test
new file mode 100644
index 00000000000..d8ef4a4278b
--- /dev/null
+++ b/mysql-test/t/ctype_utf16_def.test
@@ -0,0 +1,8 @@
+--source include/have_utf16.inc
+
+#
+# Bug #32391 Character sets: crash with --character-set-server
+#
+SHOW VARIABLES LIKE 'collation_server';
+SHOW VARIABLES LIKE 'character_set_server';
+SHOW VARIABLES LIKE 'ft_stopword_file';
diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
index 96f1a341d38..b03284a1c7c 100644
--- a/mysql-test/t/ctype_utf32.test
+++ b/mysql-test/t/ctype_utf32.test
@@ -328,6 +328,7 @@ SET collation_connection='utf32_general_ci';
SET NAMES latin1;
SET collation_connection='utf32_bin';
-- source include/ctype_filesort.inc
+-- source include/ctype_filesort2.inc
-- source include/ctype_like_escape.inc
#
@@ -800,6 +801,35 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#45263 utf32_general_ci, bad effects around CREATE TABLE AS SELECT
+--echo #
+SET collation_connection=utf32_general_ci;
+CREATE TABLE t1 AS SELECT HEX(0x00) AS my_col;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#55912 FORMAT with locale set fails for numbers < 1000
+--echo #
+SET collation_connection=utf32_general_ci;
+CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied
+--echo #
+CREATE TABLE t1 (
+ b char(250) CHARACTER SET utf32,
+ key (b)
+) ENGINE=MYISAM;
+INSERT INTO t1 VALUES ('d'),('f');
+SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z';
+DROP TABLE t1;
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index f2287488a4f..5b665e24958 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1505,6 +1505,11 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
+
+SET NAMES utf8;
+--source include/ctype_numconv.inc
+
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test
index 8fcba92ff47..03696f385b5 100644
--- a/mysql-test/t/ctype_utf8mb4.test
+++ b/mysql-test/t/ctype_utf8mb4.test
@@ -733,6 +733,7 @@ SET collation_connection='utf8mb4_general_ci';
-- source include/ctype_german.inc
SET collation_connection='utf8mb4_bin';
-- source include/ctype_filesort.inc
+-- source include/ctype_filesort2.inc
-- source include/ctype_like_escape.inc
#
diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test
index 142f1b241d6..5f56cdf54e1 100644
--- a/mysql-test/t/delayed.test
+++ b/mysql-test/t/delayed.test
@@ -307,7 +307,7 @@ connection update;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where command = "Delayed insert" and state = "Table lock";
+ where command = "Delayed insert" and state = "Waiting for table level lock";
--source include/wait_condition.inc
connect (select,localhost,root,,);
--echo connection: select
@@ -388,3 +388,167 @@ CREATE TABLE t1 LIKE t2;
DROP TABLE t2;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
+--echo #
+
+--echo # This test is not supposed to work under --ps-protocol since
+--echo # INSERT DELAYED doesn't work under LOCK TABLES with this protocol.
+--disable_ps_protocol
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+CREATE TABLE t3 (a INT);
+
+--echo # Test 1: Using LOCK TABLE
+
+--echo # Connection con1
+connect (con1, localhost, root);
+LOCK TABLE t1 WRITE;
+
+--echo # Connection default
+connection default;
+LOCK TABLE t2 WRITE;
+--echo # Sending:
+--send INSERT DELAYED INTO t1 VALUES (1)
+
+--echo # Connection con1
+connection con1;
+--echo # Wait until INSERT DELAYED is blocked on table 't1'.
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = "Waiting for table metadata lock"
+ AND info = "INSERT DELAYED INTO t1 VALUES (1)";
+--source include/wait_condition.inc
+--error ER_LOCK_DEADLOCK
+INSERT DELAYED INTO t2 VALUES (1);
+UNLOCK TABLES;
+
+--echo # Connection default
+connection default;
+--echo # Reaping: INSERT DELAYED INTO t1 VALUES (1)
+--reap
+UNLOCK TABLES;
+
+--echo # Test 2: Using ALTER TABLE
+
+START TRANSACTION;
+SELECT * FROM t1 WHERE a=0;
+
+--echo # Connection con1
+connection con1;
+--echo # Sending:
+--send ALTER TABLE t1 COMMENT 'test'
+
+--echo # Connection default
+connection default;
+--echo # Wait until ALTER TABLE is blocked on table 't1'.
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = "Waiting for table metadata lock"
+ AND info = "ALTER TABLE t1 COMMENT 'test'";
+--source include/wait_condition.inc
+--error ER_LOCK_DEADLOCK
+INSERT DELAYED INTO t1 VALUES (3);
+COMMIT;
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: ALTER TABLE t1 COMMENT 'test'
+--reap
+
+--echo # Test 3: Using RENAME TABLE
+
+--echo # Connection default
+connection default;
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+
+--echo # Connection con1
+connection con1;
+--echo # Sending:
+--send RENAME TABLE t1 to t5, t2 to t4
+
+--echo # Connection default
+connection default;
+--echo # Wait until RENAME TABLE is blocked on table 't1'.
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = "Waiting for table metadata lock"
+ AND info = "RENAME TABLE t1 to t5, t2 to t4";
+--source include/wait_condition.inc
+--error ER_LOCK_DEADLOCK
+INSERT DELAYED INTO t1 VALUES (4);
+COMMIT;
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: RENAME TABLE t1 to t5, t2 to t4
+--reap
+
+--echo # Connection default
+connection default;
+--echo # Reverting the renames
+RENAME TABLE t5 to t1, t4 to t2;
+
+--echo # Test 4: Two INSERT DELAYED on the same table
+
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+
+--echo # Connection con2
+connect (con2, localhost, root);
+--send LOCK TABLE t1 WRITE, t2 WRITE
+
+--echo # Connection con1
+connection con1;
+--echo # Wait until LOCK TABLE is blocked on table 't2'.
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = "Waiting for table metadata lock"
+ AND info = "LOCK TABLE t1 WRITE, t2 WRITE";
+--source include/wait_condition.inc
+--send INSERT DELAYED INTO t1 VALUES (5)
+
+--echo # Connection default
+connection default;
+--echo # Wait until INSERT DELAYED is blocked on table 't1'.
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = "Waiting for table metadata lock"
+ AND info = "INSERT DELAYED INTO t1 VALUES (5)";
+--source include/wait_condition.inc
+--error ER_LOCK_DEADLOCK
+INSERT DELAYED INTO t1 VALUES (6);
+COMMIT;
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: LOCK TABLE t1 WRITE, t2 WRITE
+--reap
+UNLOCK TABLES;
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: INSERT DELAYED INTO t1 VALUES (5)
+--reap
+
+--echo # Connection con2
+connection con2;
+disconnect con2;
+--source include/wait_until_disconnected.inc
+--echo # Connection con1
+connection con1;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+DROP TABLE t1, t2, t3;
+--enable_ps_protocol
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index a21fff60d33..15aade73ab7 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -540,4 +540,17 @@ DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
DROP TABLE t1;
+--echo #
+--echo # Bug #53034: Multiple-table DELETE statements not accepting
+--echo # "Access compatibility" syntax
+--echo #
+
+CREATE TABLE t1 (id INT);
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+
+DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a;
+
+DROP TABLE t1, t2, t3;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 62d11e35922..8a1f91086d2 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -11,9 +11,10 @@
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX
-mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst
-mysqlhotcopy_archive : bug#54129 2010-06-04 Horst
-plugin_load : Bug#42144 2009-12-21 alik plugin_load fails
partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings
+plugin : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5
+plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5
+plugin_not_embedded : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
+ctype_utf8mb4_ndb : Bug#55799, Bug#51907, disabled by Konstantin 2010-08-06
diff --git a/mysql-test/t/endspace.test b/mysql-test/t/endspace.test
index b223c683cde..7c71b05f687 100644
--- a/mysql-test/t/endspace.test
+++ b/mysql-test/t/endspace.test
@@ -27,7 +27,7 @@ alter table t1 modify text1 char(32) binary not null;
check table t1;
select * from t1 ignore key (key1) where text1='teststring' or
text1 like 'teststring_%' ORDER BY text1;
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select text1, length(text1) from t1 order by text1;
select text1, length(text1) from t1 order by binary text1;
@@ -44,14 +44,14 @@ select concat('|', text1, '|') from t1 where text1='teststring';
select concat('|', text1, '|') from t1 where text1='teststring ';
explain select concat('|', text1, '|') from t1 where text1='teststring ';
select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select concat('|', text1, '|') from t1 order by text1;
drop table t1;
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t';
drop table t1;
diff --git a/mysql-test/t/events_trans.test b/mysql-test/t/events_trans.test
index a94b75bb812..4cf2583ac96 100644
--- a/mysql-test/t/events_trans.test
+++ b/mysql-test/t/events_trans.test
@@ -121,3 +121,28 @@ let $wait_condition=
drop database events_test;
+
+--echo #
+--echo # Bug#54105 assert in MDL_context::release_locks_stored_before
+--echo #
+
+USE test;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP EVENT IF EXISTS e1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT);
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT A;
+--replace_regex /STARTS '[^']+'/STARTS '#'/
+SHOW CREATE EVENT e1;
+SELECT * FROM t2;
+ROLLBACK WORK TO SAVEPOINT A;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 0d406338394..d4c3533847d 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -318,6 +318,58 @@ insert into t2 (a) values (3);
--echo # --> connection default;
connection default;
unlock tables;
+--echo #
+--echo # Check that "FLUSH TABLES <list> WITH READ LOCK" is
+--echo # compatible with active "FLUSH TABLES WITH READ LOCK".
+--echo # Vice versa it is not true, since tables read-locked by
+--echo # "FLUSH TABLES <list> WITH READ LOCK" can't be flushed.
+flush tables with read lock;
+--echo # --> connection con1;
+connection con1;
+flush table t1 with read lock;
+select * from t1;
+unlock tables;
+--echo # --> connection default;
+connection default;
+unlock tables;
+--echo #
+--echo # Check that FLUSH TABLES t1 WITH READ LOCK
+--echo # does not conflict with an existing FLUSH TABLES t2
+--echo # WITH READ LOCK.
+--echo #
+flush table t1 with read lock;
+--echo # --> connection con1
+connection con1;
+flush table t2 with read lock;
+unlock tables;
+--echo # --> connection default
+connection default;
+unlock tables;
+--echo #
+--echo # Check that FLUSH TABLES t1 WITH READ LOCK
+--echo # does not conflict with SET GLOBAL read_only=1.
+--echo #
+set global read_only=1;
+--echo # connection con1
+connection con1;
+flush table t1 with read lock;
+unlock tables;
+--echo # connection default
+connection default;
+set global read_only=0;
+--echo #
+--echo # Check that it's possible to read-lock
+--echo # tables locked with FLUSH TABLE <list> WITH READ LOCK.
+--echo #
+flush tables t1, t2 with read lock;
+--echo # connection con1
+connection con1;
+lock table t1 read, t2 read;
+unlock tables;
+--echo # connection default
+connection default;
+unlock tables;
+
--echo # --> connection con1
connection con1;
disconnect con1;
@@ -355,3 +407,142 @@ drop temporary table v1;
unlock tables;
drop view v2, v3;
drop table t1, v1;
+
+
+--echo #
+--echo # FLUSH TABLES <list> WITH READ LOCK and HANDLER
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int, key a (a));
+insert into t1 (a) values (1), (2), (3);
+handler t1 open;
+handler t1 read a next;
+handler t1 read a next;
+flush tables t1 with read lock;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+handler t1 read a next;
+unlock tables;
+--echo #
+--echo # Sic: lost handler position.
+--echo #
+handler t1 read a next;
+handler t1 close;
+drop table t1;
+
+--echo #
+--echo # Bug#52117 Pending FLUSH TALBES <list> aborts
+--echo # transactions unnecessarily.
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+--echo # --> conection default
+connection default;
+
+create table t1 (a int);
+begin;
+select * from t1;
+--echo # --> connection con1
+connection con1;
+--echo #
+--echo # Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN
+--echo # or a long-running select -- anything that
+--echo # prevents FLUSH TABLE t1 from immediate completion would do.
+--echo #
+lock table t1 read;
+--echo # --> connection con2
+connection con2;
+--echo #
+--echo # FLUSH TABLE expels the table definition from the cache.
+--echo # Sending 'flush table t1'...
+send flush table t1;
+--echo # --> connection default
+connection default;
+--echo # Let flush table sync in.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "flush table t1";
+--source include/wait_condition.inc
+send select * from t1;
+--echo # --> connection con1
+connection con1;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "select * from t1";
+select * from t1;
+unlock tables;
+--echo # --> connection con2
+connection con2;
+--echo # Reaping 'flush table t1'...
+reap;
+--echo # --> connection default
+connection default;
+--echo # Reaping 'select * from t1'...
+reap;
+commit;
+
+--echo #
+--echo # Repeat the same test but with FLUSH TABLES
+--echo #
+
+begin;
+select * from t1;
+--echo # --> connection con1
+connection con1;
+--echo #
+--echo # Issue a LOCK TABLE t1 READ.
+--echo #
+lock table t1 read;
+--echo # --> connection con2
+connection con2;
+--echo #
+--echo # FLUSH TABLES expels the table definition from the cache.
+--echo # Sending 'flush tables'...
+send flush tables;
+--echo # --> connection default
+connection default;
+--echo # Let flush table sync in.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "flush tables";
+--source include/wait_condition.inc
+send select * from t1;
+--echo # --> connection con1
+connection con1;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush"
+ and info = "select * from t1";
+select * from t1;
+unlock tables;
+--echo # --> connection con2
+connection con2;
+--echo # Reaping 'flush tables'...
+reap;
+--echo # --> connection default
+connection default;
+--echo # Reaping 'select * from t1'...
+reap;
+commit;
+
+--echo # Cleanup
+
+--echo # --> connection con1
+connection con1;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+--echo # --> connection con2
+connection con2;
+disconnect con2;
+--source include/wait_until_disconnected.inc
+--echo # --> connection default
+connection default;
+drop table t1;
+
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index e191b9750e3..36a8542f9eb 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -708,6 +708,7 @@ SELECT 1 FROM
DROP TABLE t1;
+--echo End of 5.0 tests
--echo #
--echo # Bug #52397: another crash with explain extended and group_concat
@@ -722,6 +723,26 @@ DROP TABLE t1;
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+
+--echo End of 5.1 tests
+
+
+
#
# Bug#36785: Wrong error message when group_concat() exceeds max length
#
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 2914bb15d18..6d128be7f34 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1082,11 +1082,25 @@ select a.f1 as a, b.f4 as b, a.f1 > b.f4 as gt,
from t1 a, t1 b;
select *, f1 = f2 from t1;
drop table t1;
+
+--echo #
+--echo # Bug #54465: assert: field_types == 0 || field_types[field_pos] ==
+--echo # MYSQL_TYPE_LONGLONG
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+
+SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1
+ ORDER BY t1.a;
+
+DROP TABLE t1;
+
--echo #
--echo End of 5.1 tests
--echo #
---echo # Bug#55648: Server crash on MIX/MAX on maximum time value
+--echo # Bug#55648: Server crash on MIN/MAX on maximum time value
--echo #
CREATE TABLE t1(c1 TIME NOT NULL);
INSERT INTO t1 VALUES('837:59:59');
@@ -1095,3 +1109,12 @@ SELECT MAX(c1) FROM t1;
DROP TABLE t1;
--echo # End of the bug#55648
+--echo #
+--echo # Bug#56120: Failed assertion on MIN/MAX on negative time value
+--echo #
+CREATE TABLE t1(c1 TIME NOT NULL);
+INSERT INTO t1 VALUES('-00:00:01');
+SELECT MAX(c1),MIN(c1) FROM t1;
+DROP TABLE t1;
+--echo # End of the bug#56120
+
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
index 4efea8e195e..91f70bb98d7 100644
--- a/mysql-test/t/func_if.test
+++ b/mysql-test/t/func_if.test
@@ -165,3 +165,15 @@ DROP TABLE t1;
--echo End of 5.0 tests
+
+
+--echo #
+--echo # Bug#55077: Assertion failed: width > 0 && to != ((void *)0), file .\dtoa.c
+--echo #
+
+CREATE TABLE t1 (a LONGBLOB, b DOUBLE);
+INSERT INTO t1 VALUES (NULL, 0), (NULL, 1);
+
+SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index a60eb9cf845..f6dd6478a93 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -468,6 +468,19 @@ select NAME_CONST('_id',1234) as id;
select connection_id() > 0;
--echo #
+--echo # Bug #54461: crash with longblob and union or update with subquery
+--echo #
+
+CREATE TABLE t1 (a INT, b LONGBLOB);
+INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
+
+SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+
+DROP TABLE t1;
+
+
+--echo #
--echo # Bug #52165: Assertion failed: file .\dtoa.c, line 465
--echo #
@@ -478,4 +491,5 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1;
DROP TABLE t1;
+
--echo End of tests
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 10d35b16315..7b7bffd0bbc 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1404,3 +1404,20 @@ SELECT format(123, 1, 'Non-existent-locale');
--echo End of 5.4 tests
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # Bug#55912 FORMAT with locale set fails for numbers < 1000
+--echo #
+SELECT FORMAT(123.33, 2, 'no_NO'), FORMAT(1123.33, 2, 'no_NO');
+SELECT FORMAT(12333e-2, 2, 'no_NO'), FORMAT(112333e-2, 2, 'no_NO');
+CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 219a857a597..1f6001219a3 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -821,4 +821,15 @@ select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND);
select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
+#
+# Bug #55565: debug assertion when ordering by expressions with user
+# variable assignments
+#
+
+CREATE TABLE t1(a DOUBLE NOT NULL);
+INSERT INTO t1 VALUES (0),(9.216e-096);
+--echo # should not crash
+SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index f46a20b2db4..2fb73af0c99 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1222,6 +1222,20 @@ DROP TABLE t1, t2;
--echo #
+--echo # Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results
+--echo #
+
+CREATE TABLE t1 (a text, b varchar(10));
+INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two');
+
+query_vertical EXPLAIN
+SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
+SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
+query_vertical EXPLAIN
+SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
+SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
+DROP TABLE t1;
+
--echo # End of 5.1 tests
diff --git a/mysql-test/t/handler_read_last.test b/mysql-test/t/handler_read_last.test
new file mode 100644
index 00000000000..376829b9baf
--- /dev/null
+++ b/mysql-test/t/handler_read_last.test
@@ -0,0 +1,40 @@
+# Copyright (c) 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
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT, INDEX (a));
+INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
+
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 1;
+SHOW STATUS LIKE 'HANDLER_READ%';
+
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 1;
+SHOW STATUS LIKE 'HANDLER_READ%';
+
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 3;
+SHOW STATUS LIKE 'HANDLER_READ%';
+
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 3;
+SHOW STATUS LIKE 'HANDLER_READ%';
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 87022d65fcc..f5fab966bdd 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1470,7 +1470,8 @@ connection con3726_2;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info like "rename table t2 to t3";
+ where state = "Waiting for table metadata lock" and
+ info like "rename table t2 to t3";
--source include/wait_condition.inc
--echo # These statements should not be blocked by pending lock requests
select table_name, column_name, data_type from information_schema.columns
diff --git a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test
index 1a537d740b7..657d0effd7e 100644
--- a/mysql-test/t/information_schema_inno.test
+++ b/mysql-test/t/information_schema_inno.test
@@ -89,3 +89,23 @@ from information_schema.referential_constraints
where constraint_schema = schema();
drop table t2;
set foreign_key_checks = 1;
+
+
+--echo #
+--echo # Bug#55973 Assertion `thd->transaction.stmt.is_empty()'
+--echo # on CREATE TABLE .. SELECT I_S.PART
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+CREATE VIEW v1 AS SELECT 1;
+# This used to case an assert.
+CREATE TABLE t1 engine = InnoDB AS
+ SELECT * FROM information_schema.partitions
+ WHERE table_schema= 'test' AND table_name= 'v1';
+
+DROP TABLE t1;
+DROP VIEW v1;
diff --git a/mysql-test/t/innodb_mysql_lock.test b/mysql-test/t/innodb_mysql_lock.test
index c8ece729b19..975444a44b1 100644
--- a/mysql-test/t/innodb_mysql_lock.test
+++ b/mysql-test/t/innodb_mysql_lock.test
@@ -42,7 +42,7 @@ let $wait_condition=
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = "DROP TABLE t1" and
- state = "Waiting for table";
+ state = "Waiting for table metadata lock";
--source include/wait_condition.inc
--echo # Connection 1 is now holding the lock.
--echo # Issuing insert from connection 1 while connection 2&3
@@ -97,7 +97,8 @@ connection default;
--echo # connection holds SW metadata lock on table to be altered.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column c4 int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column c4 int";
--source include/wait_condition.inc
--echo # The below statement should succeed. It should not
@@ -196,7 +197,7 @@ connection default;
--echo # Connection con1
connection con1;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='OPTIMIZE TABLE t1';
+ WHERE state='Waiting for table metadata lock' AND info='OPTIMIZE TABLE t1';
--source include/wait_condition.inc
SELECT * FROM t1;
COMMIT;
@@ -241,7 +242,7 @@ connection con2;
--echo # Waiting for 'SELECT * FROM v1' to sync in.
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table" AND info = "SELECT * FROM v1";
+ WHERE state = "Waiting for table metadata lock" AND info = "SELECT * FROM v1";
--source include/wait_condition.inc
# This should block due to v1 being locked.
--echo # Sending:
@@ -252,7 +253,8 @@ connection con3;
--echo # Waiting for 'ALTER VIEW v1 AS SELECT 2 FROM t2' to sync in.
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table" AND info = "ALTER VIEW v1 AS SELECT 2 FROM t2";
+ WHERE state = "Waiting for table metadata lock" AND
+ info = "ALTER VIEW v1 AS SELECT 2 FROM t2";
--source include/wait_condition.inc
# Unlock t1 allowing SELECT * FROM v1 to proceed.
UNLOCK TABLES;
diff --git a/mysql-test/t/innodb_mysql_lock2.test b/mysql-test/t/innodb_mysql_lock2.test
index 4ad30b9f25b..b7259e771ae 100644
--- a/mysql-test/t/innodb_mysql_lock2.test
+++ b/mysql-test/t/innodb_mysql_lock2.test
@@ -799,8 +799,9 @@ connection default;
--echo # table as it acquires LOCK_S locks on rows of old version, which
--echo # are compatible with locks acquired by connection 'con1'.
let $wait_condition=
- select count(*) = 1 from information_schema.processlist where state =
- "Waiting for table" and info = "alter table t1 add column j int";
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column j int";
--source include/wait_condition.inc
--echo # The below statement will deadlock because it will try to acquire
@@ -844,7 +845,8 @@ connection default;
--echo # Wait until ALTER is blocked because of active SR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 rebuild partition p0";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 rebuild partition p0";
--source include/wait_condition.inc
--echo # The below statement should succeed as transaction
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index 4f918504597..2bf543511ac 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -525,3 +525,28 @@ drop table t1;
--echo #
--echo # End of 5.4 tests
--echo #
+
+--echo #
+--echo # Bug#54106 assert in Protocol::end_statement,
+--echo # INSERT IGNORE ... SELECT ... UNION SELECT ...
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+
+--error ER_FIELD_SPECIFIED_TWICE
+INSERT INTO t1 (a, a) VALUES (1, 1);
+# Verify that ER_FIELD_SPECIFIED_TWICE is not ignorable
+--error ER_FIELD_SPECIFIED_TWICE
+INSERT IGNORE t1 (a, a) VALUES (1, 1);
+
+--error ER_FIELD_SPECIFIED_TWICE
+INSERT IGNORE t1 (a, a) SELECT 1,1;
+# Used to cause an assert
+--error ER_FIELD_SPECIFIED_TWICE
+INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/insert_notembedded.test b/mysql-test/t/insert_notembedded.test
index 510dc56e8f7..4e5fe6f6755 100644
--- a/mysql-test/t/insert_notembedded.test
+++ b/mysql-test/t/insert_notembedded.test
@@ -174,7 +174,7 @@ connection default;
# we must wait till the insert opens and locks the table
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and id = $ID;
+ where state = "Waiting for table level lock" and id = $ID;
--source include/wait_condition.inc
connect (select,localhost,root,,);
--echo connection: select
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index b91feb3a1d5..706c2514d92 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -357,7 +357,8 @@ let $ID= `select connection_id()`;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--replace_result $ID ID
eval kill query $ID;
@@ -372,7 +373,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "drop table t1";
--source include/wait_condition.inc
--replace_result $ID ID
@@ -388,7 +389,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "create trigger t1_bi before insert on t1 for each row set @a:=1";
--source include/wait_condition.inc
--replace_result $ID ID
@@ -407,7 +408,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "alter table t1 add column j int";
--source include/wait_condition.inc
--replace_result $ID ID
@@ -423,7 +424,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "alter table t1 rename to t2";
--source include/wait_condition.inc
--replace_result $ID ID
@@ -437,7 +438,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "alter table t1 disable keys";
--source include/wait_condition.inc
--replace_result $ID ID
@@ -452,7 +453,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "alter table t1 alter column i set default 100";
--source include/wait_condition.inc
--replace_result $ID ID
@@ -474,7 +475,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "alter table t2 alter column i set default 100";
--source include/wait_condition.inc
--replace_result $ID ID
@@ -499,7 +500,7 @@ connection ddl;
connection dml;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "rename tables t1 to t3, t2 to t1";
--source include/wait_condition.inc
let $ID2= `select connection_id()`;
@@ -508,7 +509,7 @@ let $ID2= `select connection_id()`;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info = "insert into t2 values (1)";
--source include/wait_condition.inc
--replace_result $ID2 ID2
@@ -536,7 +537,7 @@ connection ddl;
connection dml;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Flushing tables" and
+ where state = "Waiting for table flush" and
info = "flush tables";
--source include/wait_condition.inc
--send select * from t1
@@ -544,7 +545,7 @@ let $wait_condition=
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table flush" and
info = "select * from t1";
--source include/wait_condition.inc
--replace_result $ID2 ID2
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index 6983947d1c4..6bdb235903d 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -32,7 +32,8 @@ connection reader;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "update low_priority t1 set n = 4";
+ where state = "Waiting for table level lock" and
+ info = "update low_priority t1 set n = 4";
--source include/wait_condition.inc
send
select n from t1;
@@ -40,7 +41,8 @@ connection locker2;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "select n from t1";
+ where state = "Waiting for table level lock" and
+ info = "select n from t1";
--source include/wait_condition.inc
select release_lock("mysqltest_lock");
connection locker;
@@ -72,7 +74,8 @@ connection reader;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "update low_priority t1 set n = 4";
+ where state = "Waiting for table level lock" and
+ info = "update low_priority t1 set n = 4";
--source include/wait_condition.inc
select n from t1;
connection locker2;
@@ -120,7 +123,8 @@ insert t1 select * from t2;
connection locker;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "insert t1 select * from t2";
+ where state = "Waiting for table metadata lock" and
+ info = "insert t1 select * from t2";
--source include/wait_condition.inc
drop table t2;
unlock tables;
@@ -145,7 +149,8 @@ connection locker;
# Sleep a bit till the insert of connection reader is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "insert t1 select * from t2";
+ where state = "Waiting for table metadata lock" and
+ info = "insert t1 select * from t2";
--source include/wait_condition.inc
drop table t2;
unlock tables;
@@ -191,7 +196,7 @@ connection locker;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table" AND info =
+ WHERE state = "Waiting for table metadata lock" AND info =
"SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1";
--source include/wait_condition.inc
# Make test case independent from earlier grants.
@@ -223,7 +228,8 @@ connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "FLUSH TABLES WITH READ LOCK";
+ where state = "Waiting for global metadata lock" and
+ info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc
# This must not block.
--error ER_TABLE_NOT_LOCKED
@@ -254,7 +260,8 @@ connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "FLUSH TABLES WITH READ LOCK";
+ where state = "Waiting for global metadata lock" and
+ info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc
--error ER_TABLE_NOT_LOCKED
CREATE TABLE t2 AS SELECT * FROM t1;
@@ -326,7 +333,8 @@ connection reader;
# Wait till connection writer is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 auto_increment=0";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 auto_increment=0";
--source include/wait_condition.inc
send
alter table t1 auto_increment=0;
@@ -334,7 +342,8 @@ connection locker;
# Wait till connection reader is blocked
let $wait_condition=
select count(*) = 2 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 auto_increment=0";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 auto_increment=0";
--source include/wait_condition.inc
unlock tables;
connection writer;
@@ -367,7 +376,8 @@ connection con5;
--echo # con5
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "flush tables with read lock";
+ where state = "Waiting for global metadata lock" and
+ info = "flush tables with read lock";
--source include/wait_condition.inc
--echo # global read lock is taken
connection con3;
@@ -489,16 +499,20 @@ update t1 set i= 10;
connection reader;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "update t1 set i= 10";
+ where state = "Waiting for table level lock" and
+ info = "update t1 set i= 10";
--source include/wait_condition.inc
send
select * from t1;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "select * from t1";
+ where state = "Waiting for table level lock" and
+ info = "select * from t1";
--source include/wait_condition.inc
-let $ID= `select id from information_schema.processlist where state = "Table lock" and info = "update t1 set i= 10"`;
+let $ID= `select id from information_schema.processlist
+ where state = "Waiting for table level lock" and
+ info = "update t1 set i= 10"`;
--replace_result $ID ID
eval kill query $ID;
connection reader;
@@ -557,7 +571,7 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table";
+ where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
alter table t1 add column j int;
connect (insert,localhost,root,,test,,);
@@ -565,7 +579,7 @@ connection insert;
--echo connection: insert
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table";
+ where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
--send insert into t1 values (1,2);
--echo connection: default
@@ -615,12 +629,12 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table";
+ where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table";
+ where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
unlock tables;
connection flush;
@@ -646,7 +660,8 @@ send insert into t1 values(1);
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "insert into t1 values(1)";
+ where state = "Waiting for table level lock" and
+ info = "insert into t1 values(1)";
--source include/wait_condition.inc
let $tlwb= `show status like 'Table_locks_waited'`;
unlock tables;
@@ -683,12 +698,12 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table";
+ where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table";
+ where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
drop table t1;
connection flush;
@@ -725,7 +740,8 @@ connection default;
--echo # connection holds SW metadata lock on table to be altered.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column c4 int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column c4 int";
--source include/wait_condition.inc
--echo # The below statement should succeed. It should not
@@ -825,7 +841,8 @@ connection default;
--echo # Wait until ALTER TABLE gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column j int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column j int";
--source include/wait_condition.inc
--echo # The below statement should try to acquire SW lock on 't1'
--echo # and therefore should get ER_LOCK_DEADLOCK error. Before
@@ -855,7 +872,8 @@ connection default;
--echo # Wait until ALTER TABLE gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 drop column j";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 drop column j";
--source include/wait_condition.inc
--echo # The below statement should try to acquire SW lock on 't1'
--echo # and therefore should get ER_LOCK_DEADLOCK error. Before
@@ -982,7 +1000,7 @@ connection con3;
connection con2;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Flushing tables" AND info = "FLUSH TABLES";
+ WHERE state = "Waiting for table flush" AND info = "FLUSH TABLES";
--source include/wait_condition.inc
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
@@ -1014,7 +1032,8 @@ connection con3;
connection con2;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table" AND info = "DROP TABLE t1, t2";
+ WHERE state = "Waiting for table metadata lock" AND
+ info = "DROP TABLE t1, t2";
--source include/wait_condition.inc
# Note: This query causes two timeouts.
# 1: try_acquire_high_prio_shared_mdl_lock on t1
@@ -1069,7 +1088,8 @@ connection default;
--echo # Wait until RENAME TABLE is blocked on table 't3'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename tables t1 to t2, t2 to t3";
+ where state = "Waiting for table metadata lock" and
+ info = "rename tables t1 to t2, t2 to t3";
--source include/wait_condition.inc
--echo # Kill RENAME TABLE.
--replace_result $ID ID
diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test
index 2f35da9d1ee..49f8f59ec5a 100644
--- a/mysql-test/t/lock_sync.test
+++ b/mysql-test/t/lock_sync.test
@@ -898,7 +898,7 @@ set debug_sync= 'now WAIT_FOR parked';
connection default;
--echo # Wait until this LOCK TABLES statement starts waiting for table lock.
let $wait_condition= select count(*)= 1 from information_schema.processlist
- where state= 'Table lock' and
+ where state= 'Waiting for table level lock' and
info='lock table v1 write';
--source include/wait_condition.inc
--echo # Allow SELECT ... FOR UPDATE to resume.
@@ -972,7 +972,7 @@ connection default;
connection con2;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table"
+ WHERE state = "Waiting for table metadata lock"
AND info = "ALTER TABLE t1 ADD COLUMN j INT";
--source include/wait_condition.inc
diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test
index 6b721ace07f..55c04d7870b 100644
--- a/mysql-test/t/mdl_sync.test
+++ b/mysql-test/t/mdl_sync.test
@@ -128,7 +128,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of S lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
@@ -158,7 +159,8 @@ connection mdl_con2;
--echo # Check that the above ALTER TABLE is blocked because of S lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column c2 int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
@@ -190,7 +192,8 @@ connection mdl_con2;
--echo # because of S lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column c2 int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
@@ -245,7 +248,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of SH lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
@@ -280,7 +284,8 @@ connection mdl_con2;
--echo # Check that the above ALTER TABLE is blocked because of SH lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column c2 int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
@@ -316,7 +321,8 @@ connection mdl_con2;
--echo # because of S lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column c2 int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
@@ -367,7 +373,8 @@ connection default;
--echo # Check that the above LOCK TABLES is blocked because of SR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "lock table t1 write";
+ where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock LOCK TABLES.
commit;
@@ -395,7 +402,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of SR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
@@ -426,7 +434,8 @@ connection mdl_con2;
--echo # Check that the above ALTER TABLE is blocked because of SR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column c2 int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
@@ -479,7 +488,8 @@ connection default;
--echo # Check that the above ALTER TABLE is blocked because of SW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
commit;
@@ -506,7 +516,8 @@ connection default;
--echo # Check that the above LOCK TABLES is blocked because of SW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "lock table t1 write";
+ where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock LOCK TABLES.
commit;
@@ -534,7 +545,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of SW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
@@ -583,7 +595,8 @@ connection mdl_con2;
--echo # Check that the above DELETE is blocked because of SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "delete from t1 limit 2";
+ where state = "Waiting for table metadata lock" and
+ info = "delete from t1 limit 2";
--source include/wait_condition.inc
--echo # Unblock ALTER and thus DELETE.
set debug_sync= 'now SIGNAL finish';
@@ -617,7 +630,8 @@ connection mdl_con2;
--echo # Check that the above ALTER is blocked because of SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock ALTERs.
set debug_sync= 'now SIGNAL finish';
@@ -652,7 +666,8 @@ connection mdl_con2;
--echo # Check that the above LOCK TABLES is blocked because of SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "lock table t1 write";
+ where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock ALTER and thus LOCK TABLES.
set debug_sync= 'now SIGNAL finish';
@@ -688,7 +703,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Unblock ALTER and thus RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
@@ -735,7 +751,8 @@ connection default;
--echo # Check that the above SELECT is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "select count(*) from t1";
+ where state = "Waiting for table metadata lock" and
+ info = "select count(*) from t1";
--source include/wait_condition.inc
--echo # Unblock SELECT.
unlock tables;
@@ -760,7 +777,8 @@ connection default;
--echo # Check that the above DELETE is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "delete from t1 limit 1";
+ where state = "Waiting for table metadata lock" and
+ info = "delete from t1 limit 1";
--source include/wait_condition.inc
--echo # Unblock DELETE.
unlock tables;
@@ -785,7 +803,8 @@ connection default;
--echo # Check that the above ALTER is blocked because of UNWR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock ALTER.
unlock tables;
@@ -811,7 +830,8 @@ connection default;
--echo # Check that the above LOCK TABLES is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "lock table t1 write";
+ where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock waiting LOCK TABLES.
unlock tables;
@@ -838,7 +858,8 @@ connection default;
--echo # Check that the above RENAME is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
@@ -879,7 +900,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that S lock in incompatible with X lock.
--echo # Sending:
@@ -890,7 +912,8 @@ connection mdl_con2;
--echo # Check that the above HANDLER statement is blocked because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "handler t1 open";
+where state = "Waiting for table metadata lock" and
+ info = "handler t1 open";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
@@ -922,7 +945,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SH lock in incompatible with X lock.
--echo # Sending:
@@ -934,7 +958,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info like "select column_name from information_schema.columns%";
+where state = "Waiting for table metadata lock" and
+ info like "select column_name from information_schema.columns%";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
@@ -965,7 +990,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SR lock in incompatible with X lock.
--echo # Sending:
@@ -977,7 +1003,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "select count(*) from t1";
+where state = "Waiting for table metadata lock" and
+ info = "select count(*) from t1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
@@ -1008,7 +1035,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SW lock in incompatible with X lock.
--echo # Sending:
@@ -1020,7 +1048,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "delete from t1 limit 1";
+where state = "Waiting for table metadata lock" and
+ info = "delete from t1 limit 1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
@@ -1051,7 +1080,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SNW lock is incompatible with X lock.
--echo # Sending:
@@ -1063,7 +1093,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
+where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
@@ -1095,7 +1126,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SNRW lock is incompatible with X lock.
--echo # Sending:
@@ -1107,7 +1139,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "lock table t1 write";
+where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
@@ -1139,7 +1172,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that X lock is incompatible with X lock.
--echo # Sending:
@@ -1151,7 +1185,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t3";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t3";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
@@ -1195,7 +1230,8 @@ connection mdl_con1;
--echo # Check that ALTER TABLE is waiting with pending SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
+where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Check that S, SH and SR locks are compatible with pending SNW
handler t1 open t;
@@ -1212,7 +1248,8 @@ connection mdl_con2;
--echo # Check that the above DELETE is blocked because of pending SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "delete from t1 limit 1";
+where state = "Waiting for table metadata lock" and
+ info = "delete from t1 limit 1";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
commit;
@@ -1252,7 +1289,8 @@ connection mdl_con1;
--echo # Check that LOCK TABLE is waiting with pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "lock table t1 write";
+where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that S and SH locks are compatible with pending SNRW
handler t1 open t;
@@ -1268,7 +1306,8 @@ connection mdl_con2;
--echo # Check that the above SELECT is blocked because of pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "select count(*) from t1";
+where state = "Waiting for table metadata lock" and
+ info = "select count(*) from t1";
--source include/wait_condition.inc
--echo # Unblock LOCK TABLE.
commit;
@@ -1300,7 +1339,8 @@ connection mdl_con1;
--echo # Check that LOCK TABLE is waiting with pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "lock table t1 write";
+where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that SW is incompatible with pending SNRW
--echo # Sending:
@@ -1311,7 +1351,8 @@ connection mdl_con2;
--echo # Check that the above INSERT is blocked because of pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "insert into t1 values (1)";
+where state = "Waiting for table metadata lock" and
+ info = "insert into t1 values (1)";
--source include/wait_condition.inc
--echo # Unblock LOCK TABLE.
commit;
@@ -1343,7 +1384,8 @@ connection mdl_con1;
--echo # Check that LOCK TABLE is waiting with pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "lock table t1 write";
+where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that SNW is compatible with pending SNRW
--echo # So ALTER TABLE statements are not starved by LOCK TABLEs.
@@ -1385,7 +1427,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SH locks are compatible with pending X
select column_name from information_schema.columns where
@@ -1399,7 +1442,8 @@ connection mdl_con2;
--echo # Check that the above HANDLER OPEN is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "handler t1 open";
+where state = "Waiting for table metadata lock" and
+ info = "handler t1 open";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
@@ -1433,7 +1477,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SR is incompatible with pending X
--echo # Sending:
@@ -1444,7 +1489,8 @@ connection mdl_con2;
--echo # Check that the above SELECT is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "select count(*) from t1";
+where state = "Waiting for table metadata lock" and
+ info = "select count(*) from t1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
@@ -1477,7 +1523,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SW is incompatible with pending X
--echo # Sending:
@@ -1488,7 +1535,8 @@ connection mdl_con2;
--echo # Check that the above DELETE is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "delete from t1 limit 1";
+where state = "Waiting for table metadata lock" and
+ info = "delete from t1 limit 1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
@@ -1521,7 +1569,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SNW is incompatible with pending X
--echo # Sending:
@@ -1532,7 +1581,8 @@ connection mdl_con2;
--echo # Check that the above ALTER TABLE is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
+where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
@@ -1565,7 +1615,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SNRW is incompatible with pending X
--echo # Sending:
@@ -1576,7 +1627,8 @@ connection mdl_con3;
--echo # Check that the above LOCK TABLES is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "lock table t1 write";
+where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'mdl_con2'.
@@ -1642,7 +1694,8 @@ connection mdl_con2;
--echo # Check that the above INSERT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "insert into t2 values (1)";
+where state = "Waiting for table metadata lock" and
+ info = "insert into t2 values (1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE and thus INSERT.
set debug_sync= 'now SIGNAL finish';
@@ -1691,7 +1744,8 @@ connection mdl_con2;
--echo # Check that the above INSERT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "insert into t1 values (1)";
+where state = "Waiting for table metadata lock" and
+ info = "insert into t1 values (1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE and thus INSERT.
set debug_sync= 'now SIGNAL finish';
@@ -1726,7 +1780,8 @@ connection default;
--echo # Wait until ALTER TABLE starts waiting for SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
+where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # We should still be able to get both SW and SR locks without waiting.
select count(*) from t1;
@@ -1769,7 +1824,8 @@ connection default;
--echo # Wait until ALTER TABLE starts waiting X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "alter table t2 add column c2 int";
+where state = "Waiting for table metadata lock" and
+ info = "alter table t2 add column c2 int";
--source include/wait_condition.inc
--echo # Check that attempt to acquire SR lock on t2 causes waiting.
--echo # Sending:
@@ -1780,7 +1836,8 @@ connection mdl_con2;
--echo # Check that the above SELECT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "select count(*) from t2";
+where state = "Waiting for table metadata lock" and
+ info = "select count(*) from t2";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
commit;
@@ -1817,7 +1874,8 @@ connection default;
--echo # Wait until ALTER TABLE starts waiting X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "alter table t2 drop column c2";
+where state = "Waiting for table metadata lock" and
+ info = "alter table t2 drop column c2";
--source include/wait_condition.inc
--echo # Check that attempt to acquire SW lock on t2 causes waiting.
--echo # Sending:
@@ -1828,7 +1886,8 @@ connection mdl_con2;
--echo # Check that the above INSERT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "insert into t2 values (1)";
+where state = "Waiting for table metadata lock" and
+ info = "insert into t2 values (1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
commit;
@@ -1861,7 +1920,8 @@ connection default;
--echo # Wait until ALTER TABLE starts waiting X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "alter table t1 add column c2 int";
+where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo # Check that transaction is still able to acquire SR lock.
select count(*) from t1;
@@ -1904,7 +1964,8 @@ connection mdl_con1;
--echo # Check that the above SELECT is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "select count(*) from t2";
+where state = "Waiting for table metadata lock" and
+ info = "select count(*) from t2";
--source include/wait_condition.inc
--echo # Unblock SELECT.
unlock tables;
@@ -1934,7 +1995,8 @@ connection mdl_con1;
--echo # Check that the above DELETE is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "delete from t2 limit 1";
+where state = "Waiting for table metadata lock" and
+ info = "delete from t2 limit 1";
--source include/wait_condition.inc
--echo # Unblock DELETE.
unlock tables;
@@ -1964,7 +2026,8 @@ connection default;
--echo # Wait until LOCK TABLE is blocked creating pending request for X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "lock table t1 write";
+where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that another instance of SR lock is granted without waiting.
select count(*) from t1;
@@ -1999,7 +2062,8 @@ connection default;
--echo # Wait until LOCK TABLE is blocked creating pending request for X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "lock table t1 write";
+where state = "Waiting for table metadata lock" and
+ info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that both SR and SW locks are granted without waiting
--echo # and errors.
@@ -2043,7 +2107,8 @@ connection default;
--echo # Wait until RENAME TABLE starts waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t2 to t3";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t2 to t3";
--source include/wait_condition.inc
--echo # Check that attempt to acquire SR lock on t2 causes waiting.
--echo # Sending:
@@ -2054,7 +2119,8 @@ connection mdl_con2;
--echo # Check that the above SELECT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "select count(*) from t2";
+where state = "Waiting for table metadata lock" and
+ info = "select count(*) from t2";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
@@ -2093,7 +2159,8 @@ connection default;
--echo # Wait until RENAME TABLE starts waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t2 to t3";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t2 to t3";
--source include/wait_condition.inc
--echo # Check that attempt to acquire SW lock on t2 causes waiting.
--echo # Sending:
@@ -2104,7 +2171,8 @@ connection mdl_con2;
--echo # Check that the above DELETE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "delete from t2 limit 1";
+where state = "Waiting for table metadata lock" and
+ info = "delete from t2 limit 1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
@@ -2141,7 +2209,8 @@ connection default;
--echo # Wait until RENAME TABLE is blocked creating pending request for X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that another instance of SR lock is granted without waiting.
select count(*) from t1;
@@ -2176,7 +2245,8 @@ connection default;
--echo # Wait until RENAME TABLE is blocked creating pending request for X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table" and info = "rename table t1 to t2";
+where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that both SR and SW locks are granted without waiting
--echo # and errors.
@@ -2236,7 +2306,8 @@ connection handler_con2;
--echo # Wait until ALTER is blocked during upgrade.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column j int";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column j int";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
@@ -2279,7 +2350,8 @@ connection handler_con1;
--echo # Wait until INSERT is blocked on table-level lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "insert into t2 values (1)";
+ where state = "Waiting for table level lock" and
+ info = "insert into t2 values (1)";
--source include/wait_condition.inc
--echo # Sending 'alter table t1 drop column j'. It should not cause
--echo # deadlock.
@@ -2289,7 +2361,8 @@ connection handler_con2;
--echo # Wait until ALTER is blocked during upgrade.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 drop column j";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 drop column j";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
@@ -2328,7 +2401,8 @@ connection handler_con1;
--echo # Wait until INSERT is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "insert into t1 values (1)";
+ where state = "Waiting for table metadata lock" and
+ info = "insert into t1 values (1)";
--source include/wait_condition.inc
--echo # The below ALTER TABLE will be blocked because of presence of HANDLER.
--echo # Sending:
@@ -2374,7 +2448,8 @@ connection handler_con1;
--echo # Wait until INSERT is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "insert into t2 values (1)";
+ where state = "Waiting for table metadata lock" and
+ info = "insert into t2 values (1)";
--source include/wait_condition.inc
--echo # The below ALTER TABLE will be blocked because of presence of HANDLER.
--echo # Sending:
@@ -2451,7 +2526,8 @@ connection deadlock_con1;
--echo # for 'deadlock_con2' which holds shared metadata lock on 't2'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t2 to t0, t3 to t2, t0 to t3";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t2 to t0, t3 to t2, t0 to t3";
--source include/wait_condition.inc
--echo # The below statement should wait for exclusive metadata lock
--echo # on 't2' to go away and should not produce ER_LOCK_DEADLOCK
@@ -2466,7 +2542,8 @@ connection deadlock_con2;
--echo # for an exclusive metadata lock to go away.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "select * from t2";
+ where state = "Waiting for table metadata lock" and
+ info = "select * from t2";
--source include/wait_condition.inc
--echo #
--echo # Unblock RENAME TABLE by releasing shared metadata lock on t2.
@@ -2502,7 +2579,8 @@ connection deadlock_con1;
--echo # table 't1'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t0, t3 to t1, t0 to t3";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t0, t3 to t1, t0 to t3";
--source include/wait_condition.inc
--echo # Commit transaction to unblock RENAME TABLE.
commit;
@@ -2536,7 +2614,8 @@ connection deadlock_con1;
--echo # for 'deadlock_con1' which holds shared metadata lock on 't2'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t2 to t0, t1 to t2, t0 to t1";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t2 to t0, t1 to t2, t0 to t1";
--source include/wait_condition.inc
--echo #
--echo # The below statement should not wait as doing so will cause deadlock.
@@ -2549,7 +2628,8 @@ select * from t1;
--echo # metadata lock on table 't1', i.e. that RENAME TABLE is still blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t2 to t0, t1 to t2, t0 to t1";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t2 to t0, t1 to t2, t0 to t1";
--source include/wait_condition.inc
--echo # Commit transaction to unblock RENAME TABLE.
commit;
@@ -2590,7 +2670,7 @@ connection deadlock_con2;
--echo # for an UNRW metadata lock to go away.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "select * from t1";
+ where state = "Waiting for table metadata lock" and info = "select * from t1";
--source include/wait_condition.inc
--echo # Send RENAME TABLE statement that will deadlock with the
@@ -2604,7 +2684,8 @@ connection default;
--echo # pending X lock on t1.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t0, t2 to t1, t0 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t0, t2 to t1, t0 to t2";
--source include/wait_condition.inc
--echo # Allow the above RENAME TABLE to acquire lock on t1 and
--echo # create pending lock on t2 thus creating deadlock.
@@ -2626,7 +2707,8 @@ connection deadlock_con1;
--echo # is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "rename table t1 to t0, t2 to t1, t0 to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t0, t2 to t1, t0 to t2";
--source include/wait_condition.inc
--echo # Commit transaction to unblock this RENAME TABLE.
commit;
@@ -2674,7 +2756,8 @@ connection deadlock_con1;
--echo # 'deadlock_con1' which holds shared lock on 't1'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column j int, rename to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column j int, rename to t2";
--source include/wait_condition.inc
--echo # The below statement should not wait as it will cause deadlock.
@@ -2687,7 +2770,8 @@ select * from t2;
--echo # so ALTER TABLE ... RENAME is still blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column j int, rename to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column j int, rename to t2";
--source include/wait_condition.inc
--echo # Commit transaction to unblock ALTER TABLE ... RENAME.
@@ -2732,7 +2816,8 @@ connection deadlock_con2;
--echo # while trying to acquire SNRW lock on 't1'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "lock tables t1 write, t2 write";
+ where state = "Waiting for table metadata lock" and
+ info = "lock tables t1 write, t2 write";
--source include/wait_condition.inc
--echo # Resume SELECT execution, this should eventually unblock LOCK TABLES.
set debug_sync= 'now SIGNAL finish';
@@ -2801,7 +2886,8 @@ connection deadlock_con2;
--echo # Wait until ALTER is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 drop column j";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 drop column j";
--source include/wait_condition.inc
--echo # Resume INSERT so it can start deadlock detection.
--echo #
@@ -2829,6 +2915,188 @@ connection default;
drop table t1;
+--echo #
+--echo # Now, test for a situation in which deadlock involves waiting not
+--echo # only in MDL subsystem but also for TDC. Such deadlocks should be
+--echo # successfully detected. If possible, they should be resolved without
+--echo # resorting to ER_LOCK_DEADLOCK error.
+--echo #
+create table t1(i int);
+create table t2(j int);
+
+--echo #
+--echo # First, let us check how we handle a simple scenario involving
+--echo # waits in MDL and TDC.
+--echo #
+set debug_sync= 'RESET';
+
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Start a statement, which will acquire SR metadata lock on t1, open it
+--echo # and then stop, before trying to acquire SW lock on t2 and opening it.
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+--echo # Sending:
+--send select * from t1 where i in (select j from t2 for update)
+
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+--echo # Wait till the above SELECT stops.
+set debug_sync='now WAIT_FOR parked';
+--echo # The below FLUSH TABLES WITH READ LOCK should acquire
+--echo # SNW locks on t1 and t2 and wait till SELECT closes t1.
+--echo # Sending:
+send flush tables t1, t2 with read lock;
+
+--echo # Switching to connection 'deadlock_con3'.
+connection deadlock_con3;
+--echo # Wait until FLUSH TABLES WITH t1, t2 READ LOCK starts waiting
+--echo # for SELECT to close t1.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush" and
+ info = "flush tables t1, t2 with read lock";
+--source include/wait_condition.inc
+
+--echo # Resume SELECT, so it tries to acquire SW lock on t1 and blocks,
+--echo # creating a deadlock. This deadlock should be detected and resolved
+--echo # by backing-off SELECT. As a result FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+--echo # Reap FLUSH TABLES WITH READ LOCK.
+reap;
+unlock tables;
+
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Reap SELECT.
+reap;
+
+--echo #
+--echo # The same scenario with a slightly different order of events
+--echo # which emphasizes that setting correct deadlock detector weights
+--echo # for flush waits is important.
+--echo #
+set debug_sync= 'RESET';
+
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go';
+
+--echo # The below FLUSH TABLES WITH READ LOCK should acquire
+--echo # SNW locks on t1 and t2 and wait on debug sync point.
+--echo # Sending:
+send flush tables t1, t2 with read lock;
+
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Wait till FLUSH TABLE WITH READ LOCK stops.
+set debug_sync='now WAIT_FOR parked';
+
+--echo # Start statement which will acquire SR metadata lock on t1, open
+--echo # it and then will block while trying to acquire SW lock on t2.
+--echo # Sending:
+send select * from t1 where i in (select j from t2 for update);
+
+--echo # Switching to connection 'deadlock_con3'.
+connection deadlock_con3;
+--echo # Wait till the above SELECT blocks.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "select * from t1 where i in (select j from t2 for update)";
+--source include/wait_condition.inc
+
+--echo # Resume FLUSH TABLES, so it tries to flush t1, thus creating
+--echo # a deadlock. This deadlock should be detected and resolved by
+--echo # backing-off SELECT. As a result FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+--echo # Reap FLUSH TABLES WITH READ LOCK.
+reap;
+unlock tables;
+
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Reap SELECT.
+reap;
+
+--echo #
+--echo # Now a more complex scenario involving two connections
+--echo # waiting for MDL and one for TDC.
+--echo #
+set debug_sync= 'RESET';
+
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Start a statement which will acquire SR metadata lock on t2, open it
+--echo # and then stop, before trying to acquire SR on t1 and opening it.
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+--echo # Sending:
+send select * from t2, t1;
+
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+--echo # Wait till the above SELECT stops.
+set debug_sync='now WAIT_FOR parked';
+--echo # The below FLUSH TABLES WITH READ LOCK should acquire
+--echo # SNW locks on t2 and wait till SELECT closes t2.
+--echo # Sending:
+send flush tables t2 with read lock;
+
+--echo # Switching to connection 'deadlock_con3'.
+connection deadlock_con3;
+--echo # Wait until FLUSH TABLES WITH READ LOCK starts waiting
+--echo # for SELECT to close t2.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush" and
+ info = "flush tables t2 with read lock";
+--source include/wait_condition.inc
+
+--echo # The below DROP TABLES should acquire X lock on t1 and start
+--echo # waiting for X lock on t2.
+--echo # Sending:
+send drop tables t1, t2;
+
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Wait until DROP TABLES starts waiting for X lock on t2.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "drop tables t1, t2";
+--source include/wait_condition.inc
+
+--echo # Resume SELECT, so it tries to acquire SR lock on t1 and blocks,
+--echo # creating a deadlock. This deadlock should be detected and resolved
+--echo # by backing-off SELECT. As a result, FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+--echo # Reap FLUSH TABLES WITH READ LOCK.
+reap;
+--echo # Unblock DROP TABLES.
+unlock tables;
+
+--echo # Switching to connection 'deadlock_con3'.
+connection deadlock_con3;
+--echo # Reap DROP TABLES.
+reap;
+
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Reap SELECT. It should emit error about missing table.
+--error ER_NO_SUCH_TABLE
+reap;
+
+--echo # Switching to connection 'default'.
+connection default;
+
set debug_sync= 'RESET';
disconnect deadlock_con1;
@@ -2837,6 +3105,75 @@ disconnect deadlock_con3;
--echo #
+--echo # Test for a scenario in which FLUSH TABLES <list> WITH READ LOCK
+--echo # used to erroneously release metadata locks.
+--echo #
+connect(con1,localhost,root,,);
+connect(con2,localhost,root,,);
+connection default;
+--disable_warnings
+drop tables if exists t1, t2;
+--enable_warnings
+set debug_sync= 'RESET';
+create table t1(i int);
+create table t2(j int);
+
+--echo # Switching to connection 'con2'.
+connection con2;
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+
+--echo # The below FLUSH TABLES <list> WITH READ LOCK should acquire
+--echo # SNW locks on t1 and t2, open table t1 and block on the debug
+--echo # sync point.
+--echo # Sending:
+send flush tables t1, t2 with read lock;
+
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # Wait till FLUSH TABLES <list> WITH READ LOCK stops.
+set debug_sync='now WAIT_FOR parked';
+
+--echo # Start a statement which will flush all tables and thus
+--echo # invalidate table t1 open by FLUSH TABLES <list> WITH READ LOCK.
+--echo # Sending:
+send flush tables;
+
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Wait till the above FLUSH TABLES blocks.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table flush" and
+ info = "flush tables";
+--source include/wait_condition.inc
+
+--echo # Resume FLUSH TABLES <list> WITH READ LOCK, so it tries to open t2
+--echo # discovers that its t1 is obsolete and tries to reopen all tables.
+--echo # Such reopen should not cause releasing of SNW metadata locks
+--echo # which would result in assertion failures.
+set debug_sync='now SIGNAL go';
+
+--echo # Switching to connection 'con2'.
+connection con2;
+--echo # Reap FLUSH TABLES <list> WITH READ LOCK.
+reap;
+unlock tables;
+
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # Reap FLUSH TABLES.
+reap;
+
+--echo # Clean-up.
+--echo # Switching to connection 'default'.
+connection default;
+drop tables t1, t2;
+set debug_sync= 'RESET';
+disconnect con1;
+disconnect con2;
+
+
+--echo #
--echo # Test for bug #46748 "Assertion in MDL_context::wait_for_locks()
--echo # on INSERT + CREATE TRIGGER".
--echo #
@@ -2873,7 +3210,7 @@ connection default;
--echo # metadata lock on its tables and blocks due to 't4' being used by LOCK
--echo # TABLES.
let $wait_condition= select count(*)= 1 from information_schema.processlist
- where state= 'Waiting for table' and
+ where state= 'Waiting for table metadata lock' and
info='rename table t3 to t5, t4 to t3';
--source include/wait_condition.inc
--echo # Send :
@@ -2884,7 +3221,7 @@ connection con1root;
--echo # Wait until INSERT statement waits due to encountering pending
--echo # exclusive metadata lock on 't3'.
let $wait_condition= select count(*)= 1 from information_schema.processlist
- where state= 'Waiting for table' and
+ where state= 'Waiting for table metadata lock' and
info='insert into t1 values (1)';
--source include/wait_condition.inc
unlock tables;
@@ -3026,7 +3363,8 @@ connection default;
--echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "create table t2 select * from t1 for update";
+ where state = "Waiting for table level lock" and
+ info = "create table t2 select * from t1 for update";
--source include/wait_condition.inc
--echo # First let us check that SHOW FIELDS/DESCRIBE doesn't
@@ -3079,7 +3417,8 @@ connection default;
--echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "create table t2 select * from t1 for update";
+ where state = "Waiting for table level lock" and
+ info = "create table t2 select * from t1 for update";
--source include/wait_condition.inc
--echo # Let us check that SHOW FIELDS/DESCRIBE gets blocked.
@@ -3091,7 +3430,8 @@ connection con46044_2;
--echo # Wait until SHOW FIELDS gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "show fields from t2";
+ where state = "Waiting for table metadata lock" and
+ info = "show fields from t2";
--source include/wait_condition.inc
unlock tables;
@@ -3121,7 +3461,8 @@ connection default;
--echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "create table t2 select * from t1 for update";
+ where state = "Waiting for table level lock" and
+ info = "create table t2 select * from t1 for update";
--source include/wait_condition.inc
--echo # Check that I_S query which reads only .FRMs gets blocked.
@@ -3133,7 +3474,7 @@ connection con46044_2;
--echo # Wait until SELECT COLUMN_NAME FROM I_S.COLUMNS gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info like "select column_name from information_schema.columns%";
--source include/wait_condition.inc
@@ -3164,7 +3505,8 @@ connection default;
--echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "create table t2 select * from t1 for update";
+ where state = "Waiting for table level lock" and
+ info = "create table t2 select * from t1 for update";
--source include/wait_condition.inc
--echo # Finally, check that I_S query which does full-blown table open
@@ -3177,7 +3519,7 @@ connection con46044_2;
--echo # Wait until SELECT ... FROM I_S.TABLES gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and
+ where state = "Waiting for table metadata lock" and
info like "select table_name, table_type, auto_increment, table_comment from information_schema.tables%";
--source include/wait_condition.inc
@@ -3240,7 +3582,8 @@ update t1 set c3=c3+1 where c2 = 3;
--echo # metadata lock on table 't1', i.e. that ALTER TABLE is still blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "alter table t1 add column e int, rename to t2";
+ where state = "Waiting for table metadata lock" and
+ info = "alter table t1 add column e int, rename to t2";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE by commiting transaction and thus releasing
@@ -3425,7 +3768,7 @@ connection con1;
connection con3;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Table lock" and info = "SELECT 1";
+ WHERE state = "Waiting for table level lock" and info = "SELECT 1";
--source include/wait_condition.inc
# The ALTER below will try to abort the statement in connection con1,
# since the latter waits on a table-level lock while having a HANDLER
@@ -3495,7 +3838,8 @@ connection con50913_2;
--echo # Wait until TRUNCATE TABLE is blocked on MDL lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table" and info = "truncate table t1";
+ where state = "Waiting for table metadata lock" and
+ info = "truncate table t1";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
set debug_sync= 'now SIGNAL go';
@@ -3568,7 +3912,8 @@ connection con3;
--echo # SW lock on the table.
let $wait_condition=
select count(*) = 2 from information_schema.processlist
- where state = "Waiting for table" and info = "insert into t1 values (1)";
+ where state = "Waiting for table metadata lock" and
+ info = "insert into t1 values (1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE. Since it will try to upgrade SNW to X lock
--echo # deadlock with two loops in waiting graph will occur. Both loops
@@ -3738,7 +4083,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='CREATE DATABASE db1';
+ WHERE state='Waiting for schema metadata lock' AND info='CREATE DATABASE db1';
--source include/wait_condition.inc
# This should not block.
CREATE DATABASE db2;
@@ -3778,7 +4123,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table'
+ WHERE state='Waiting for schema metadata lock'
AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
--source include/wait_condition.inc
# This should not block.
@@ -3813,7 +4158,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='DROP DATABASE db1';
+ WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
@@ -3857,7 +4202,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table'
+ WHERE state='Waiting for schema metadata lock'
AND info='ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME';
--source include/wait_condition.inc
# This should not block.
@@ -3898,7 +4243,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='DROP DATABASE db1';
+ WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1';
--source include/wait_condition.inc
# This should not block.
CREATE DATABASE db2;
@@ -3934,7 +4279,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table'
+ WHERE state='Waiting for schema metadata lock'
AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
@@ -3947,7 +4292,9 @@ connection default;
--echo # Connection con2
connection con2;
--echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
---error 1,1 # Wrong error pending followup patch for bug#54360
+# Error 1 is from ALTER DATABASE when the database does not exist.
+# Listing the error twice to prevent result diffences based on filename.
+--error 1,1
--reap
@@ -3973,7 +4320,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='CREATE TABLE db1.t1 (a INT)';
+ WHERE state='Waiting for schema metadata lock' AND
+ info='CREATE TABLE db1.t1 (a INT)';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
@@ -4011,7 +4359,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='RENAME TABLE db1.t1 TO test.t1';
+ WHERE state='Waiting for schema metadata lock' AND
+ info='RENAME TABLE db1.t1 TO test.t1';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
@@ -4044,7 +4393,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='RENAME TABLE test.t2 TO db1.t2';
+ WHERE state='Waiting for schema metadata lock' AND
+ info='RENAME TABLE test.t2 TO db1.t2';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
@@ -4056,7 +4406,9 @@ connection default;
--echo # Connection con2
connection con2;
--echo # Reaping: RENAME TABLE test.t2 TO db1.t2
---error 7, 7 # Wrong error pending followup patch for bug#54360
+# Error 7 is from RENAME TABLE where the target database does not exist.
+# Listing the error twice to prevent result diffences based on filename.
+--error 7, 7
--reap
DROP TABLE test.t2;
@@ -4084,7 +4436,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='DROP TABLE db1.t1';
+ WHERE state='Waiting for schema metadata lock' AND info='DROP TABLE db1.t1';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
diff --git a/mysql-test/t/merge-big.test b/mysql-test/t/merge-big.test
index 509c7742dac..10d36bfe2a4 100644
--- a/mysql-test/t/merge-big.test
+++ b/mysql-test/t/merge-big.test
@@ -51,7 +51,7 @@ connection default;
#--sleep 8
#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $con1_id AND STATE = 'Waiting for table';
+ WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
#SELECT NOW();
--echo # Kick INSERT out of thr_multi_lock().
@@ -61,7 +61,7 @@ FLUSH TABLES;
#--sleep 8
#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $con1_id AND STATE = 'Waiting for table';
+ WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
#SELECT NOW();
--echo # Unlock and close table and wait for con1 to close too.
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 31bc8a5e881..b6ad3324d19 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -579,7 +579,7 @@ DROP TABLE tm1, t1, t2;
#
CREATE TABLE t1(c1 INT);
CREATE TABLE t2 (c1 INT) ENGINE=MERGE UNION=(t1) INSERT_METHOD=FIRST;
---error ER_UPDATE_TABLE_USED
+# After WL#5370, it just generates a warning that the table already exists
CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
DROP TABLE t1, t2;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 7a81ad496b4..166d36856a6 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -497,7 +497,7 @@ connection updater;
# Wait till "alter table t1 ..." of session changer is in work.
# = There is one session waiting.
let $wait_condition= select count(*)= 1 from information_schema.processlist
- where state= 'Waiting for table';
+ where state= 'Waiting for table metadata lock';
--source include/wait_condition.inc
send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
@@ -508,7 +508,7 @@ connection locker;
# are in work.
# = There are two session waiting.
let $wait_condition= select count(*)= 2 from information_schema.processlist
- where state= 'Waiting for table';
+ where state= 'Waiting for table metadata lock';
--source include/wait_condition.inc
unlock tables;
diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test
index c8c1fba04e1..2c19671d11b 100644
--- a/mysql-test/t/mysql_client_test.test
+++ b/mysql-test/t/mysql_client_test.test
@@ -2,6 +2,7 @@
-- source include/not_embedded.inc
SET @old_general_log= @@global.general_log;
+SET @old_slow_query_log= @@global.slow_query_log;
# We run with different binaries for normal and --embedded-server
#
@@ -24,3 +25,4 @@ echo ok;
--echo
SET @@global.general_log= @old_general_log;
+SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/t/mysql_not_windows.test b/mysql-test/t/mysql_not_windows.test
new file mode 100644
index 00000000000..66853677f7b
--- /dev/null
+++ b/mysql-test/t/mysql_not_windows.test
@@ -0,0 +1,15 @@
+-- source include/not_windows.inc
+# This test should work in embedded server after we fix mysqltest
+-- source include/not_embedded.inc
+#
+# Testing the MySQL command line client(mysql)
+#
+
+#
+# Bug #54466 client 5.5 built from source lacks "pager" support
+#
+--echo Bug #54466 client 5.5 built from source lacks "pager" support
+--exec $MYSQL --pager test -e "select 1 as a"
+
+--echo
+--echo End of tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index e375cb7299f..3a9dae35476 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -1,6 +1,6 @@
# We are using .opt file since we need small binlog size
# TODO: Need to look at making a row based version once the new row based client is completed. [jbm]
--- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/have_binlog_format_statement.inc
-- source include/have_log_bin.inc
diff --git a/mysql-test/t/not_partition.test b/mysql-test/t/not_partition.test
index 78ca44acf18..38b88c00ba3 100644
--- a/mysql-test/t/not_partition.test
+++ b/mysql-test/t/not_partition.test
@@ -27,6 +27,7 @@ ALTER TABLE t1 CHECK PARTITION ALL;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
ALTER TABLE t1 ANALYZE PARTITION ALL;
ALTER TABLE t1 REBUILD PARTITION ALL;
+ALTER TABLE t1 TRUNCATE PARTITION ALL;
ALTER TABLE t1 ENGINE Memory;
ALTER TABLE t1 ADD (new INT);
DROP TABLE t1;
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 30f5894716c..3e9ac2ce2b5 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -9,6 +9,107 @@ drop table if exists t1, t2;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
+--echo # Bug#54747: Deadlock between REORGANIZE PARTITION and
+--echo # SELECT is not detected
+--echo #
+
+SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency;
+SET GLOBAL innodb_thread_concurrency = 1;
+
+CREATE TABLE t1
+(user_num BIGINT,
+ hours SMALLINT,
+ KEY user_num (user_num))
+ENGINE = InnoDB
+PARTITION BY RANGE COLUMNS (hours)
+(PARTITION hour_003 VALUES LESS THAN (3),
+ PARTITION hour_004 VALUES LESS THAN (4),
+ PARTITION hour_005 VALUES LESS THAN (5),
+ PARTITION hour_last VALUES LESS THAN (MAXVALUE));
+
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+
+BEGIN;
+SELECT COUNT(*) FROM t1;
+
+--echo # con1
+--connect (con1,localhost,root,,)
+--echo # SEND a ALTER PARTITION which waits on the ongoing transaction.
+--send
+ALTER TABLE t1
+REORGANIZE PARTITION hour_003, hour_004 INTO
+(PARTITION oldest VALUES LESS THAN (4));
+
+--echo # Connection default wait until the ALTER is in 'waiting for table...'
+--echo # state and then continue the transaction by trying a SELECT
+--connection default
+let $wait_condition =
+SELECT COUNT(*) = 1
+FROM information_schema.processlist
+WHERE INFO like 'ALTER TABLE t1%REORGANIZE PARTITION hour_003, hour_004%'
+AND STATE = 'Waiting for table metadata lock';
+--source include/wait_condition.inc
+SELECT COUNT(*) FROM t1;
+COMMIT;
+
+--echo # con1, reaping ALTER.
+--connection con1
+--reap
+
+--echo # Disconnecting con1 and switching to default. Cleaning up.
+--disconnect con1
+
+--connection default
+
+SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#50418: DROP PARTITION does not interact with transactions
+--echo #
+CREATE TABLE t1 (
+ id INT AUTO_INCREMENT NOT NULL,
+ name CHAR(50) NOT NULL,
+ myDate DATE NOT NULL,
+ PRIMARY KEY (id, myDate),
+ INDEX idx_date (myDate)
+ ) ENGINE=InnoDB
+PARTITION BY RANGE ( TO_DAYS(myDate) ) (
+ PARTITION p0 VALUES LESS THAN (734028),
+ PARTITION p1 VALUES LESS THAN (734029),
+ PARTITION p2 VALUES LESS THAN (734030),
+ PARTITION p3 VALUES LESS THAN MAXVALUE
+ ) ;
+INSERT INTO t1 VALUES
+(NULL, 'Lachlan', '2009-09-13'),
+ (NULL, 'Clint', '2009-09-13'),
+ (NULL, 'John', '2009-09-14'),
+ (NULL, 'Dave', '2009-09-14'),
+ (NULL, 'Jeremy', '2009-09-15'),
+ (NULL, 'Scott', '2009-09-15'),
+ (NULL, 'Jeff', '2009-09-16'),
+ (NULL, 'Joe', '2009-09-16');
+SET AUTOCOMMIT=0;
+SELECT * FROM t1 FOR UPDATE;
+UPDATE t1 SET name = 'Mattias' WHERE id = 7;
+SELECT * FROM t1 WHERE id = 7;
+--connect (con1, localhost, root,,)
+--echo # Connection con1
+SET lock_wait_timeout = 1;
+--echo # After the patch it will wait and fail on timeout.
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 DROP PARTITION p3;
+SHOW WARNINGS;
+--disconnect con1
+--connection default
+--echo # Connection default
+SELECT * FROM t1;
+--echo # No changes.
+COMMIT;
+DROP TABLE t1;
+
+--echo #
--echo # Bug#51830: Incorrect partition pruning on range partition (regression)
--echo #
CREATE TABLE t1 (a INT NOT NULL)
diff --git a/mysql-test/t/partition_not_blackhole-master.opt b/mysql-test/t/partition_not_blackhole-master.opt
new file mode 100644
index 00000000000..1e47be930bc
--- /dev/null
+++ b/mysql-test/t/partition_not_blackhole-master.opt
@@ -0,0 +1 @@
+--loose-skip-blackhole
diff --git a/mysql-test/t/partition_not_blackhole.test b/mysql-test/t/partition_not_blackhole.test
new file mode 100644
index 00000000000..7352aeaa230
--- /dev/null
+++ b/mysql-test/t/partition_not_blackhole.test
@@ -0,0 +1,26 @@
+--source include/have_partition.inc
+--source include/not_blackhole.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+--echo #
+--echo # Bug#46086: crash when dropping a partitioned table and
+--echo # the original engine is disabled
+--echo # Copy a .frm and .par file which was created with:
+--echo # create table `t1` (`id` int primary key) engine=blackhole
+--echo # partition by key () partitions 1;
+--copy_file std_data/parts/t1_blackhole.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par
+SHOW TABLES;
+--replace_result $MYSQLD_DATADIR ./
+--error ER_NOT_FORM_FILE
+SHOW CREATE TABLE t1;
+--error ER_BAD_TABLE_ERROR
+DROP TABLE t1;
+--list_files $MYSQLD_DATADIR/test t1*
+--remove_file $MYSQLD_DATADIR/test/t1.frm
+--remove_file $MYSQLD_DATADIR/test/t1.par
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test
index 673d05532eb..4e2c1b98a70 100644
--- a/mysql-test/t/partition_range.test
+++ b/mysql-test/t/partition_range.test
@@ -931,3 +931,44 @@ insert into t2 values(52, 20070322, 456, 'filler') ;
select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 20070320 and 20070401 group by defid;
drop table t1, t2;
+
+--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/t/partition_truncate.test b/mysql-test/t/partition_truncate.test
index 93b9cf62d14..165213d204c 100644
--- a/mysql-test/t/partition_truncate.test
+++ b/mysql-test/t/partition_truncate.test
@@ -24,3 +24,10 @@ subpartitions 1
--error ER_WRONG_PARTITION_NAME
alter table t1 truncate partition sp1;
drop table t1;
+
+create table t1 (a int);
+insert into t1 values (1), (3), (8);
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+alter table t1 truncate partition p0;
+select count(*) from t1;
+drop table t1;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index ce49ca89eca..51e362d4916 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -498,12 +498,20 @@ drop table t1,t2,t3,t4;
set query_cache_wlock_invalidate=1;
create table t1 (a int not null);
create table t2 (a int not null);
+create view v1 as select * from t1;
select * from t1;
select * from t2;
show status like "Qcache_queries_in_cache";
lock table t1 write, t2 read;
show status like "Qcache_queries_in_cache";
unlock table;
+select * from t1;
+# Implicit locking of t1 does not invalidate QC
+show status like "Qcache_queries_in_cache";
+lock table v1 write;
+show status like "Qcache_queries_in_cache";
+unlock table;
+drop view v1;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
diff --git a/mysql-test/t/query_cache_28249.test b/mysql-test/t/query_cache_28249.test
index c95d7553988..21768b27c2e 100644
--- a/mysql-test/t/query_cache_28249.test
+++ b/mysql-test/t/query_cache_28249.test
@@ -58,18 +58,18 @@ connection user3;
# Typical information_schema.processlist content after sufficient sleep time
# ID USER COMMAND TIME STATE INFO
# ....
-# 2 root Query 5 Table lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
+# 2 root Query 5 Waiting for table level lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
# ....
# XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# The values marked with 'X' must be reached.
--echo # Poll till the select of connection user1 is blocked by the write lock on t1.
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
-WHERE state = 'Table lock'
+WHERE state = 'Waiting for table level lock'
AND info = '$select_for_qc';
--source include/wait_condition.inc
eval
SELECT user,command,state,info FROM information_schema.processlist
-WHERE state = 'Table lock'
+WHERE state = 'Waiting for table level lock'
AND info = '$select_for_qc';
INSERT INTO t1 VALUES (4);
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 2d2a6f75d73..0ad3d3e8504 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1314,44 +1314,15 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY)
DROP TABLE t1;
--echo #
---echo # Bug#50939: Loose Index Scan unduly relies on engine to remember range
---echo # endpoints
+--echo # Bug #54802: 'NOT BETWEEN' evaluation is incorrect
--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;
+CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key));
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
-INSERT INTO t2 SELECT * FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
+SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
---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;
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/schema.test b/mysql-test/t/schema.test
index ed3b98ec2f7..6af7ee20b02 100644
--- a/mysql-test/t/schema.test
+++ b/mysql-test/t/schema.test
@@ -23,7 +23,6 @@ drop schema foo;
--disable_warnings
DROP SCHEMA IF EXISTS schema1;
-DROP SCHEMA IF EXISTS schema2;
--enable_warnings
connect(con2, localhost, root);
@@ -32,7 +31,6 @@ connect(con2, localhost, root);
connection default;
CREATE SCHEMA schema1;
-CREATE SCHEMA schema2;
CREATE TABLE schema1.t1 (a INT);
SET autocommit= FALSE;
@@ -45,10 +43,13 @@ connection con2;
--echo # Connection default
connection default;
let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for table'
+ WHERE state= 'Waiting for table metadata lock'
AND info='DROP SCHEMA schema1';
--source include/wait_condition.inc
-ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
+# Error 1 is from ALTER DATABASE when the database does not exist.
+# Listing the error twice to prevent result diffences based on filename.
+--error 1,1
+ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
SET autocommit= TRUE;
--echo # Connection 2
@@ -57,7 +58,6 @@ connection con2;
--echo # Connection default
connection default;
-DROP SCHEMA schema2;
disconnect con2;
@@ -84,7 +84,7 @@ connection con2;
--echo # Connection default
connection default;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' and info='DROP SCHEMA schema1';
+ WHERE state='Waiting for schema metadata lock' and info='DROP SCHEMA schema1';
--source include/wait_condition.inc
--echo # CREATE SCHEMA used to give a deadlock.
@@ -124,7 +124,7 @@ connection default;
--echo # Connection con2
connect (con2, localhost, root);
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' AND info='DROP DATABASE db1';
+ WHERE state='Waiting for table metadata lock' AND info='DROP DATABASE db1';
--source include/wait_condition.inc
--echo # Connection con1
@@ -172,7 +172,7 @@ connection con2;
--echo # Connection 3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table' and info='DROP DATABASE db1';
+ WHERE state='Waiting for table metadata lock' and info='DROP DATABASE db1';
--source include/wait_condition.inc
--echo # But it should still be possible to CREATE/ALTER/DROP other databases.
CREATE DATABASE db2;
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index b7090c01f1e..a5c287e44a8 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -222,3 +222,33 @@ SHOW WARNINGS;
--echo # Restore the procs_priv table
RENAME TABLE procs_priv_backup TO mysql.procs_priv;
FLUSH TABLE mysql.procs_priv;
+
+
+--echo #
+--echo # Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from
+--echo # 5.1.50 to 5.5.6".
+--echo #
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+--echo # Backup mysql.proc.
+flush table mysql.proc;
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
+
+create database mysqltest;
+--echo # Corrupt mysql.proc to make it unusable by current version of server.
+alter table mysql.proc drop column type;
+--echo # The below statement should not cause assertion failure.
+drop database mysqltest;
+
+--echo # Restore mysql.proc.
+drop table mysql.proc;
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
diff --git a/mysql-test/t/sp-lock.test b/mysql-test/t/sp-lock.test
index 7297790a886..be8369d6994 100644
--- a/mysql-test/t/sp-lock.test
+++ b/mysql-test/t/sp-lock.test
@@ -183,18 +183,19 @@ connection con1;
send drop procedure p1;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'drop procedure t1' to get blocked on MDL lock...
+--echo # Waiting for 'drop procedure t1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop procedure p1';
+where state='Waiting for stored procedure metadata lock' and
+info='drop procedure p1';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
+--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='select f1()';
+where state='Waiting for stored procedure metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
@@ -222,18 +223,19 @@ connection con1;
send create procedure p1() begin end;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'create procedure t1' to get blocked on MDL lock...
+--echo # Waiting for 'create procedure t1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='create procedure p1() begin end';
+where state='Waiting for stored procedure metadata lock' and
+info='create procedure p1() begin end';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
+--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='select f1()';
+where state='Waiting for stored procedure metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
@@ -259,18 +261,19 @@ connection con1;
send alter procedure p1 contains sql;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'alter procedure t1' to get blocked on MDL lock...
+--echo # Waiting for 'alter procedure t1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='alter procedure p1 contains sql';
+where state='Waiting for stored procedure metadata lock' and
+info='alter procedure p1 contains sql';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
+--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='select f1()';
+where state='Waiting for stored procedure metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
@@ -296,18 +299,19 @@ connection con1;
send drop function f1;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'drop function f1' to get blocked on MDL lock...
+--echo # Waiting for 'drop function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop function f1';
+where state='Waiting for stored function metadata lock' and
+info='drop function f1';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
+--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='select f1()';
+where state='Waiting for stored function metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
@@ -335,18 +339,19 @@ connection con1;
send create function f1() returns int return 2;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'create function f1' to get blocked on MDL lock...
+--echo # Waiting for 'create function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='create function f1() returns int return 2';
+where state='Waiting for stored function metadata lock' and
+info='create function f1() returns int return 2';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
+--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='select f1()';
+where state='Waiting for stored function metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
@@ -373,18 +378,19 @@ connection con1;
send alter function f1 contains sql;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'alter function f1' to get blocked on MDL lock...
+--echo # Waiting for 'alter function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='alter function f1 contains sql';
+where state='Waiting for stored function metadata lock' and
+info='alter function f1 contains sql';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
+--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='select f1()';
+where state='Waiting for stored function metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
@@ -471,9 +477,10 @@ connection con1;
send drop function f1;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'drop function f1' to get blocked on MDL lock...
+--echo # Waiting for 'drop function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop function f1';
+where state='Waiting for stored function metadata lock' and
+info='drop function f1';
--source include/wait_condition.inc
--echo # --> connnection default
connection default;
@@ -497,9 +504,10 @@ connection con1;
send drop function f1;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'drop function f1' to get blocked on MDL lock...
+--echo # Waiting for 'drop function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop function f1';
+where state='Waiting for stored function metadata lock' and
+info='drop function f1';
--source include/wait_condition.inc
--echo # --> connnection default
connection default;
@@ -530,9 +538,10 @@ connection con1;
send drop procedure p1;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'drop procedure p1' to get blocked on MDL lock...
+--echo # Waiting for 'drop procedure p1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop procedure p1';
+where state='Waiting for stored procedure metadata lock' and
+info='drop procedure p1';
--source include/wait_condition.inc
--echo # --> connnection default
connection default;
@@ -561,9 +570,10 @@ connection con1;
send drop function f2;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'drop function f2' to get blocked on MDL lock...
+--echo # Waiting for 'drop function f2' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop function f2';
+where state='Waiting for stored function metadata lock' and
+info='drop function f2';
--source include/wait_condition.inc
--echo # --> connnection default
connection default;
@@ -623,17 +633,19 @@ connection con1;
send drop function f1;
--echo # --> connection con2
connection con2;
---echo # Waitng for 'drop function f1' to get blocked on MDL lock...
+--echo # Waiting for 'drop function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop function f1';
+where state='Waiting for stored function metadata lock' and
+info='drop function f1';
--source include/wait_condition.inc
--echo # Sending 'drop function f2'...
send drop function f2;
--echo # --> connection default
connection default;
---echo # Waitng for 'drop function f2' to get blocked on MDL lock...
+--echo # Waiting for 'drop function f2' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='drop function f2';
+where state='Waiting for stored function metadata lock' and
+info='drop function f2';
--source include/wait_condition.inc
rollback to savepoint sv;
--echo # --> connection con2
@@ -699,16 +711,18 @@ connection con1;
send alter function f1 comment "comment";
--echo # --> connection con2
connection con2;
---echo # Waitng for 'alter function f1 ...' to get blocked on MDL lock...
+--echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info like 'alter function f1 comment%';
+where state='Waiting for stored function metadata lock' and
+info like 'alter function f1 comment%';
--source include/wait_condition.inc
--echo # Sending 'call p1()'...
send call p1();
connection default;
---echo # Waitng for 'call p1()' to get blocked on MDL lock on f1...
+--echo # Waiting for 'call p1()' to get blocked on MDL lock on f1...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='select f1() into @var';
+where state='Waiting for stored function metadata lock' and
+info='select f1() into @var';
--source include/wait_condition.inc
--echo # Let 'alter function f1 ...' go through...
commit;
@@ -746,9 +760,10 @@ connection con1;
send alter function f1 comment "comment";
--echo # --> connection con2
connection con2;
---echo # Waitng for 'alter function f1 ...' to get blocked on MDL lock...
+--echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info like 'alter function f1 comment%';
+where state='Waiting for stored function metadata lock' and
+info like 'alter function f1 comment%';
--source include/wait_condition.inc
delimiter |;
--echo #
@@ -774,9 +789,10 @@ delimiter ;|
--echo # Sending 'call p1()'...
send call p1();
connection default;
---echo # Waitng for 'call p1()' to get blocked on MDL lock on f1...
+--echo # Waiting for 'call p1()' to get blocked on MDL lock on f1...
let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for table' and info='select f1() into @var';
+where state='Waiting for stored function metadata lock' and
+info='select f1() into @var';
--source include/wait_condition.inc
--echo # Let 'alter function f1 ...' go through...
commit;
@@ -825,7 +841,7 @@ connection default;
send select f3();
--echo # --> connection con1
connection con1;
---echo # Waitng for 'select f3()' to get blocked on the user level lock...
+--echo # Waiting for 'select f3()' to get blocked on the user level lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='User lock' and info='select f1() into @var';
--source include/wait_condition.inc
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 83accecabb5..b15f6351e59 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -322,7 +322,7 @@ set session low_priority_updates=on;
connection rl_wait;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and
+ where state = "Waiting for table level lock" and
info = "update t1 set value='updated' where value='old'";
--source include/wait_condition.inc
diff --git a/mysql-test/t/sp_sync.test b/mysql-test/t/sp_sync.test
index 431db463b67..368a09eac8c 100644
--- a/mysql-test/t/sp_sync.test
+++ b/mysql-test/t/sp_sync.test
@@ -87,7 +87,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for table'
+ WHERE state= 'Waiting for stored function metadata lock'
AND info='SHOW OPEN TABLES WHERE f1()=0';
--source include/wait_condition.inc
--echo # Check that the IS query is blocked before releasing the x-lock
diff --git a/mysql-test/t/ssl_8k_key-master.opt b/mysql-test/t/ssl_8k_key-master.opt
new file mode 100644
index 00000000000..b58ca7f39f0
--- /dev/null
+++ b/mysql-test/t/ssl_8k_key-master.opt
@@ -0,0 +1 @@
+--loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem --loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index cca54f6c762..9965875af55 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -58,7 +58,8 @@ let $ID= `select connection_id()`;
connection con2;
--echo # Switched to connection: con2
# wait for the other query to start executing
-let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = "Table lock";
+let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST
+ where ID = $ID and STATE = "Waiting for table level lock";
--source include/wait_condition.inc
unlock tables;
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index fb0f58bf804..a2c71c664c4 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -64,6 +64,22 @@ DROP TABLE t1,t2,t3;
--echo End of 5.0 tests.
--echo #
+--echo # Bug#54568: create view cause Assertion failed: 0,
+--echo # file .\item_subselect.cc, line 836
+--echo #
+EXPLAIN SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
+DESCRIBE SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
+--echo # None of the below should crash
+CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
+CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
+DROP VIEW v1, v2;
+
+
+--echo #
+--echo # End of 5.1 tests.
+--echo #
+
+--echo #
--echo # Bug#53236 Segfault in DTCollation::set(DTCollation&)
--echo #
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 2eb086cace5..3e4c3660f88 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -1751,7 +1751,7 @@ create trigger t1_ai after insert on t1 for each row set @a := 7;
create table t2 (j int);
insert into t2 values (1), (2);
set @a:="";
-create table if not exists t1 select * from t2;
+insert into t1 select * from t2;
select * from t1;
select @a;
# Let us check that trigger that involves table also works ok.
@@ -1759,7 +1759,7 @@ drop trigger t1_bi;
drop trigger t1_ai;
create table t3 (isave int);
create trigger t1_bi before insert on t1 for each row insert into t3 values (new.i);
-create table if not exists t1 select * from t2;
+insert into t1 select * from t2;
select * from t1;
select * from t3;
drop table t1, t2, t3;
@@ -1975,7 +1975,7 @@ select * from t1_op_log;
truncate t1;
truncate t1_op_log;
-create table if not exists t1
+insert into t1
select NULL, "CREATE TABLE ... SELECT, inserting a new key";
set @id=last_insert_id();
@@ -1984,7 +1984,7 @@ select * from t1;
select * from t1_op_log;
truncate t1_op_log;
-create table if not exists t1 replace
+replace into t1
select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
select * from t1;
@@ -2114,7 +2114,7 @@ select * from t1_op_log;
truncate t1;
truncate t1_op_log;
-create table if not exists v1
+insert into v1
select NULL, "CREATE TABLE ... SELECT, inserting a new key";
set @id=last_insert_id();
@@ -2123,7 +2123,7 @@ select * from t1;
select * from t1_op_log;
truncate t1_op_log;
-create table if not exists v1 replace
+replace into v1
select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
select * from t1;
diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test
index 8a570a7e87d..9728ae9a4ae 100644
--- a/mysql-test/t/trigger_notembedded.test
+++ b/mysql-test/t/trigger_notembedded.test
@@ -896,7 +896,7 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table";
+ where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
create trigger t1_bi before insert on t1 for each row begin end;
unlock tables;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index ab2745ceeef..93dc4cad50c 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -253,7 +253,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
create temporary table t1 select a from t1 union select a from t2;
drop temporary table t1;
---error 1093
+--error ER_TABLE_EXISTS_ERROR
create table t1 select a from t1 union select a from t2;
--error 1054
select a from t1 union select a from t2 order by t2.a;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index c0564a82b23..236f2e84770 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4074,7 +4074,8 @@ connection default;
connection con2;
let $wait_condition=
SELECT COUNT(*) = 1 from information_schema.processlist
- WHERE state = "Table lock" AND info = "INSERT INTO t1 SELECT * FROM v1";
+ WHERE state = "Waiting for table level lock" AND
+ info = "INSERT INTO t1 SELECT * FROM v1";
--source include/wait_condition.inc
--echo # ... then try to drop the view. This should block.
--echo # Sending:
@@ -4084,7 +4085,7 @@ let $wait_condition=
connection con3;
let $wait_condition=
SELECT COUNT(*) = 1 from information_schema.processlist
- WHERE state = "Waiting for table" AND info = "DROP VIEW v1";
+ WHERE state = "Waiting for table metadata lock" AND info = "DROP VIEW v1";
--source include/wait_condition.inc
--echo # Now allow CALL p1() to complete
UNLOCK TABLES;
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index e4b199dab84..4faaadb3f70 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -98,6 +98,49 @@ void my_getopt_register_get_addr(my_getopt_value func_addr)
matches with one of the options in struct 'my_option'.
Check that option was given an argument if it requires one
Call the optional 'get_one_option()' function once for each option.
+
+ Note that handle_options() can be invoked multiple times to
+ parse a command line in several steps.
+ In this case, use the global flag @c my_getopt_skip_unknown to indicate
+ that options unknown in the current step should be preserved in the
+ command line for later parsing in subsequent steps.
+
+ For 'long' options (--a_long_option), @c my_getopt_skip_unknown is
+ fully supported. Command line parameters such as:
+ - "--a_long_option"
+ - "--a_long_option=value"
+ - "--a_long_option value"
+ will be preserved as is when the option is not known.
+
+ For 'short' options (-S), support for @c my_getopt_skip_unknown
+ comes with some limitation, because several short options
+ can also be specified together in the same command line argument,
+ as in "-XYZ".
+
+ The first use case supported is: all short options are declared.
+ handle_options() will be able to interpret "-XYZ" as one of:
+ - an unknown X option
+ - "-X -Y -Z", three short options with no arguments
+ - "-X -YZ", where Y is a short option with argument Z
+ - "-XYZ", where X is a short option with argument YZ
+ based on the full short options specifications.
+
+ The second use case supported is: no short option is declared.
+ handle_options() will reject "-XYZ" as unknown, to be parsed later.
+
+ The use case that is explicitly not supported is to provide
+ only a partial list of short options to handle_options().
+ This function can not be expected to extract some option Y
+ in the middle of the string "-XYZ" in these conditions,
+ without knowing if X will be declared an option later.
+
+ Note that this limitation only impacts parsing of several
+ short options from the same command line argument,
+ as in "mysqld -anW5".
+ When each short option is properly separated out in the command line
+ argument, for example in "mysqld -a -n -w5", the code would actually
+ work even with partial options specs given at each stage.
+
@param [in, out] argc command line options (count)
@param [in, out] argv command line options (values)
@param [in] longopts descriptor of all valid options
@@ -464,14 +507,40 @@ int handle_options(int *argc, char ***argv,
}
if (!opt_found)
{
- if (my_getopt_print_errors)
- my_getopt_error_reporter(ERROR_LEVEL,
- "%s: unknown option '-%c'",
- my_progname, *optend);
- return EXIT_UNKNOWN_OPTION;
+ if (my_getopt_skip_unknown)
+ {
+ /*
+ We are currently parsing a single argv[] argument
+ of the form "-XYZ".
+ One or the argument found (say Y) is not an option.
+ Hack the string "-XYZ" to make a "-YZ" substring in it,
+ and push that to the output as an unrecognized parameter.
+ */
+ DBUG_ASSERT(optend > *pos);
+ DBUG_ASSERT(optend >= cur_arg);
+ DBUG_ASSERT(optend <= *pos + strlen(*pos));
+ DBUG_ASSERT(*optend);
+ optend--;
+ optend[0]= '-'; /* replace 'X' or '-' by '-' */
+ (*argv)[argvpos++]= optend;
+ /*
+ Do not continue to parse at the current "-XYZ" argument,
+ skip to the next argv[] argument instead.
+ */
+ optend= (char*) " ";
+ }
+ else
+ {
+ if (my_getopt_print_errors)
+ my_getopt_error_reporter(ERROR_LEVEL,
+ "%s: unknown option '-%c'",
+ my_progname, *optend);
+ return EXIT_UNKNOWN_OPTION;
+ }
}
}
- (*argc)--; /* option handled (short), decrease argument count */
+ if (opt_found)
+ (*argc)--; /* option handled (short), decrease argument count */
continue;
}
if ((error= setval(optp, value, argument, set_maximum_value)))
@@ -479,7 +548,7 @@ int handle_options(int *argc, char ***argv,
if (get_one_option && get_one_option(optp->id, optp, argument))
return EXIT_UNSPECIFIED_ERROR;
- (*argc)--; /* option handled (short or long), decrease argument count */
+ (*argc)--; /* option handled (long), decrease argument count */
}
else /* non-option found */
(*argv)[argvpos++]= cur_arg;
@@ -603,18 +672,24 @@ static int setval(const struct my_option *opts, void *value, char *argument,
};
break;
case GET_ENUM:
- if (((*(uint*)value)=
- find_type(argument, opts->typelib, 2) - 1) == (uint)-1)
{
- /* Accept an integer representation of the enumerated item */
- char *endptr;
- uint arg= (uint) strtol(argument, &endptr, 10);
- if (*endptr || arg >= opts->typelib->count)
+ int type= find_type(argument, opts->typelib, 2);
+ if (type == 0)
{
- res= EXIT_ARGUMENT_INVALID;
- goto ret;
- };
- *(uint*)value= arg;
+ /*
+ Accept an integer representation of the enumerated item.
+ */
+ char *endptr;
+ ulong arg= strtoul(argument, &endptr, 10);
+ if (*endptr || arg >= opts->typelib->count)
+ {
+ res= EXIT_ARGUMENT_INVALID;
+ goto ret;
+ }
+ *(ulong*)value= arg;
+ }
+ else
+ *(ulong*)value= type - 1;
}
break;
case GET_SET:
@@ -1010,7 +1085,7 @@ static void init_one_value(const struct my_option *option, void *variable,
*((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
break;
case GET_ENUM:
- *((uint*) variable)= (uint) value;
+ *((ulong*) variable)= (ulong) value;
break;
case GET_UINT:
*((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
@@ -1286,7 +1361,7 @@ void my_print_variables(const struct my_option *options)
printf("\n");
break;
case GET_ENUM:
- printf("%s\n", get_type(optp->typelib, *(uint*) value));
+ printf("%s\n", get_type(optp->typelib, *(ulong*) value));
break;
case GET_STR:
case GET_STR_ALLOC: /* fall through */
diff --git a/mysys/my_init.c b/mysys/my_init.c
index d2371278b0c..e3b189c27bb 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -477,7 +477,7 @@ static my_bool win32_init_tcp_ip()
{
if (win32_have_tcpip())
{
- WORD wVersionRequested = MAKEWORD( 2, 0 );
+ WORD wVersionRequested = MAKEWORD( 2, 2 );
WSADATA wsaData;
/* Be a good citizen: maybe another lib has already initialised
sockets, so dont clobber them unless necessary */
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 236b694726f..045b56b11c2 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -302,6 +302,8 @@ void my_thread_global_end(void)
#ifndef HAVE_GETHOSTBYNAME_R
mysql_mutex_destroy(&LOCK_gethostbyname_r);
#endif
+
+ my_thread_basic_global_init_done= 0;
}
static my_thread_id thread_id= 0;
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index 675910d2b20..ba62062ebc0 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -83,7 +83,9 @@ 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_lock.c b/mysys/thr_lock.c
index 7ba0490cb29..d96d08ea0c3 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -91,6 +91,16 @@ enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE;
LIST *thr_lock_thread_list; /* List of threads in use */
ulong max_write_lock_count= ~(ulong) 0L;
+static void (*before_lock_wait)(void)= 0;
+static void (*after_lock_wait)(void)= 0;
+
+void thr_set_lock_wait_callback(void (*before_wait)(void),
+ void (*after_wait)(void))
+{
+ before_lock_wait= before_wait;
+ after_lock_wait= after_wait;
+}
+
static inline mysql_cond_t *get_cond(void)
{
return &my_thread_var->suspend;
@@ -428,9 +438,22 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
thread_var->current_cond= cond;
data->cond= cond;
- old_proc_info= proc_info_hook(NULL, "Table lock",
+ old_proc_info= proc_info_hook(NULL, "Waiting for table level lock",
__func__, __FILE__, __LINE__);
+ /*
+ Since before_lock_wait potentially can create more threads to
+ scheduler work for, we don't want to call the before_lock_wait
+ callback unless it will really start to wait.
+
+ For similar reasons, we do not want to call before_lock_wait and
+ after_lock_wait for each lap around the loop, so we restrict
+ ourselves to call it before_lock_wait once before starting to wait
+ and once after the thread has exited the wait loop.
+ */
+ if ((!thread_var->abort || in_wait_list) && before_lock_wait)
+ (*before_lock_wait)();
+
set_timespec(wait_timeout, lock_wait_timeout);
while (!thread_var->abort || in_wait_list)
{
@@ -462,6 +485,14 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
/* purecov: end */
}
}
+
+ /*
+ We call the after_lock_wait callback once the wait loop has
+ finished.
+ */
+ if (after_lock_wait)
+ (*after_lock_wait)();
+
DBUG_PRINT("thr_lock", ("aborted: %d in_wait_list: %d",
thread_var->abort, in_wait_list));
diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c
index 2ac4a00695e..ecd12849822 100644
--- a/mysys/thr_rwlock.c
+++ b/mysys/thr_rwlock.c
@@ -71,6 +71,9 @@ int my_rw_init(my_rw_lock_t *rwp, my_bool *prefer_readers_attr)
rwp->state = 0;
rwp->waiters = 0;
+#ifdef SAFE_MUTEX
+ rwp->write_thread = 0;
+#endif
/* If attribute argument is NULL use default value - prefer writers. */
rwp->prefer_readers= prefer_readers_attr ? *prefer_readers_attr : FALSE;
@@ -80,6 +83,7 @@ int my_rw_init(my_rw_lock_t *rwp, my_bool *prefer_readers_attr)
int my_rw_destroy(my_rw_lock_t *rwp)
{
+ DBUG_ASSERT(rwp->state == 0);
pthread_mutex_destroy( &rwp->lock );
pthread_cond_destroy( &rwp->readers );
pthread_cond_destroy( &rwp->writers );
@@ -123,10 +127,15 @@ int my_rw_wrlock(my_rw_lock_t *rwp)
pthread_mutex_lock(&rwp->lock);
rwp->waiters++; /* another writer queued */
+ my_rw_lock_assert_not_write_owner(rwp);
+
while (rwp->state)
pthread_cond_wait(&rwp->writers, &rwp->lock);
rwp->state = -1;
rwp->waiters--;
+#ifdef SAFE_MUTEX
+ rwp->write_thread= pthread_self();
+#endif
pthread_mutex_unlock(&rwp->lock);
return(0);
}
@@ -142,6 +151,9 @@ int my_rw_trywrlock(my_rw_lock_t *rwp)
{
res=0;
rwp->state = -1;
+#ifdef SAFE_MUTEX
+ rwp->write_thread= pthread_self();
+#endif
}
pthread_mutex_unlock(&rwp->lock);
return(res);
@@ -154,9 +166,15 @@ int my_rw_unlock(my_rw_lock_t *rwp)
("state: %d waiters: %d", rwp->state, rwp->waiters));
pthread_mutex_lock(&rwp->lock);
+ DBUG_ASSERT(rwp->state != 0);
+
if (rwp->state == -1) /* writer releasing */
{
+ my_rw_lock_assert_write_owner(rwp);
rwp->state= 0; /* mark as available */
+#ifdef SAFE_MUTEX
+ rwp->write_thread= 0;
+#endif
if ( rwp->waiters ) /* writers queued */
pthread_cond_signal( &rwp->writers );
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index c7eafac2781..0c9177c79c5 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -139,6 +139,7 @@ ELSE()
ENDIF()
SET(HOSTNAME "hostname")
+SET(MYSQLD_USER "mysql")
# Required for mysqlbug until autotools are deprecated, once done remove these
# and expand default cmake variables
@@ -344,6 +345,7 @@ ELSE()
MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file} in "
"${CMAKE_CURRENT_SOURCE_DIR}" )
ENDIF()
+ EXECUTE_PROCESS(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${file})
IF(NOT ${file}_COMPONENT)
SET(${file}_COMPONENT Server)
ENDIF()
diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist
index 4fb57b06d71..aa106a3dfc4 100755
--- a/scripts/make_win_bin_dist
+++ b/scripts/make_win_bin_dist
@@ -260,6 +260,7 @@ cp include/mysql.h \
include/keycache.h \
include/m_ctype.h \
include/my_attribute.h \
+ include/my_compiler.h \
include/mysqld_error.h \
include/sql_state.h \
include/mysqld_ername.h \
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index c7abf3d82a1..977907c9c14 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -242,26 +242,6 @@ EXECUTE stmt;
DROP PREPARE stmt;
--
--- TABLE EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
---
-
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(";
-SET @l2="EVENT_NAME VARCHAR(128) not null,";
-SET @l3="COUNT_STAR BIGINT unsigned not null,";
-SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
-SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
-SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
-SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE
--
@@ -304,6 +284,26 @@ EXECUTE stmt;
DROP PREPARE stmt;
--
+-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="COUNT_STAR BIGINT unsigned not null,";
+SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
-- TABLE FILE_INSTANCES
--
@@ -395,23 +395,6 @@ EXECUTE stmt;
DROP PREPARE stmt;
--
--- TABLE PROCESSLIST
---
-
-SET @l1="CREATE TABLE performance_schema.PROCESSLIST(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="ID INTEGER not null,";
-SET @l4="NAME VARCHAR(64) not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
-- TABLE RWLOCK_INSTANCES
--
@@ -463,19 +446,15 @@ EXECUTE stmt;
DROP PREPARE stmt;
--
--- TABLE SETUP_OBJECTS
+-- TABLE SETUP_TIMERS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_OBJECTS(";
-SET @l2="OBJECT_TYPE VARCHAR(64),";
-SET @l3="OBJECT_SCHEMA VARCHAR(64),";
-SET @l4="OBJECT_NAME VARCHAR(64),";
-SET @l5="ENABLED ENUM ('YES', 'NO') not null,";
-SET @l6="TIMED ENUM ('YES', 'NO') not null,";
-SET @l7="AGGREGATED ENUM ('YES', 'NO') not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS(";
+SET @l2="NAME VARCHAR(64) not null,";
+SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+SET @cmd=concat(@l1,@l2,@l3,@l4);
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
@@ -483,15 +462,16 @@ EXECUTE stmt;
DROP PREPARE stmt;
--
--- TABLE SETUP_TIMERS
+-- TABLE THREADS
--
-SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS(";
-SET @l2="NAME VARCHAR(64) not null,";
-SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
-SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+SET @l1="CREATE TABLE performance_schema.THREADS(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="ID INTEGER not null,";
+SET @l4="NAME VARCHAR(64) not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-SET @cmd=concat(@l1,@l2,@l3,@l4);
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
PREPARE stmt FROM @str;
diff --git a/scripts/mysqlaccess.conf b/scripts/mysqlaccess.conf
index faf47da5f6c..faf47da5f6c 100644..100755
--- a/scripts/mysqlaccess.conf
+++ b/scripts/mysqlaccess.conf
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 7a840ef6cad..0860adde652 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -71,10 +71,11 @@ SET (SQL_SOURCE
sql_tablespace.cc events.cc ../sql-common/my_user.c
partition_info.cc rpl_utility.cc rpl_injector.cc sql_locale.cc
rpl_rli.cc rpl_mi.cc sql_servers.cc sql_audit.cc
- sql_connect.cc scheduler.cc
- sql_profile.cc event_parse_data.cc
- sql_signal.cc rpl_handler.cc mdl.cc
+ sql_connect.cc scheduler.cc sql_partition_admin.cc
+ sql_profile.cc event_parse_data.cc sql_alter.cc
+ sql_signal.cc rpl_handler.cc mdl.cc sql_admin.cc
transaction.cc sys_vars.cc sql_truncate.cc datadict.cc
+ sql_reload.cc
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE})
@@ -271,8 +272,7 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
COMMAND ${CMAKE_COMMAND}
${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
- COMMAND ${CMAKE_COMMAND} -E touch initdb.dep
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
DEPENDS mysqld
)
ADD_CUSTOM_TARGET(initial_database
diff --git a/sql/Makefile.am b/sql/Makefile.am
index b31a6e3c3e0..b7c4bf44111 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -40,6 +40,7 @@ DTRACEFILES = filesort.o \
sql_cursor.o \
sql_delete.o \
sql_truncate.o \
+ sql_reload.o \
sql_insert.o \
datadict.o \
sql_parse.o \
@@ -59,6 +60,7 @@ DTRACEFILES_DEPEND = filesort.o \
sql_cursor.o \
sql_delete.o \
sql_truncate.o \
+ sql_reload.o \
sql_insert.o \
datadict.o \
sql_parse.o \
@@ -122,11 +124,11 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
sql_plugin.h authors.h event_parse_data.h \
event_data_objects.h event_scheduler.h \
sql_partition.h partition_info.h partition_element.h \
- sql_audit.h \
+ sql_audit.h sql_alter.h sql_partition_admin.h \
contributors.h sql_servers.h sql_signal.h records.h \
sql_prepare.h rpl_handler.h replication.h mdl.h \
sql_plist.h transaction.h sys_vars.h sql_truncate.h \
- datadict.h
+ sql_admin.h sql_reload.h datadict.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \
@@ -140,10 +142,11 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
sql_connect.cc scheduler.cc sql_parse.cc \
keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \
sql_base.cc table.cc sql_select.cc sql_insert.cc \
- datadict.cc sql_profile.cc \
+ sql_reload.cc datadict.cc sql_profile.cc \
sql_prepare.cc sql_error.cc sql_locale.cc \
sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
- procedure.cc sql_test.cc sql_truncate.cc \
+ procedure.cc sql_test.cc sql_admin.cc \
+ sql_truncate.cc \
log.cc init.cc derror.cc sql_acl.cc \
unireg.cc des_key_file.cc \
log_event.cc rpl_record.cc \
@@ -171,7 +174,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
sql_builtin.cc sql_tablespace.cc partition_info.cc \
sql_servers.cc event_parse_data.cc sql_signal.cc \
rpl_handler.cc mdl.cc transaction.cc sql_audit.cc \
- sha2.cc
+ sql_alter.cc sql_partition_admin.cc sha2.cc
nodist_mysqld_SOURCES = mini_client_errors.c pack.c client.c my_time.c my_user.c client_plugin.c
diff --git a/sql/authors.h b/sql/authors.h
index 5de2659f098..db0ab00fb86 100644
--- a/sql/authors.h
+++ b/sql/authors.h
@@ -93,6 +93,7 @@ struct show_table_authors_st show_table_authors[]= {
{ "Arjen Lentz", "Brisbane, Australia",
"Documentation (2001-2004), Dutch error messages, LOG2()" },
{ "Marc Liyanage", "", "Created Mac OS X packages" },
+ { "Kelly Long", "Denver, CO, USA", "Pool Of Threads" },
{ "Zarko Mocnik", "", "Sorting for Slovenian language" },
{ "Per-Erik Martin", "Uppsala, Sweden", "Stored Procedures (5.0)" },
{ "Alexis Mikhailov", "", "User-defined functions" },
diff --git a/sql/datadict.cc b/sql/datadict.cc
index 33c3b6bc700..e3f679cc7ec 100644
--- a/sql/datadict.cc
+++ b/sql/datadict.cc
@@ -22,7 +22,9 @@
/**
Check type of .frm if we are not going to parse it.
- @param path path to FRM file
+ @param[in] thd The current session.
+ @param[in] path path to FRM file.
+ @param[out] dbt db_type of the table if FRMTYPE_TABLE, otherwise undefined.
@retval FRMTYPE_ERROR error
@retval FRMTYPE_TABLE table
@@ -66,29 +68,28 @@ frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
/**
- Given a table name, check if the storage engine for the
- table referred by this name supports an option 'flag'.
- Return an error if the table does not exist or is not a
- base table.
+ Given a table name, check type of .frm and legacy table type.
- @pre Any metadata lock on the table.
+ @param[in] thd The current session.
+ @param[in] db Table schema.
+ @param[in] table_name Table database.
+ @param[out] table_type handlerton of the table if FRMTYPE_TABLE,
+ otherwise undefined.
- @param[in] thd The current session.
- @param[in] db Table schema.
- @param[in] table_name Table database.
- @param[in] flag The option to check.
- @param[out] yes_no The result. Undefined if error.
+ @return FALSE if FRMTYPE_TABLE and storage engine found. TRUE otherwise.
*/
-bool dd_check_storage_engine_flag(THD *thd,
- const char *db, const char *table_name,
- uint32 flag, bool *yes_no)
+bool dd_frm_storage_engine(THD *thd, const char *db, const char *table_name,
+ handlerton **table_type)
{
char path[FN_REFLEN + 1];
enum legacy_db_type db_type;
- handlerton *table_type;
LEX_STRING db_name = {(char *) db, strlen(db)};
+ /* There should be at least some lock on the table. */
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db,
+ table_name, MDL_SHARED));
+
if (check_db_name(&db_name))
{
my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
@@ -101,23 +102,47 @@ bool dd_check_storage_engine_flag(THD *thd,
return TRUE;
}
- /* There should be at least some lock on the table. */
- DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db,
- table_name, MDL_SHARED));
-
(void) build_table_filename(path, sizeof(path) - 1, db,
table_name, reg_ext, 0);
dd_frm_type(thd, path, &db_type);
/* Type is unknown if the object is not found or is not a table. */
- if (db_type == DB_TYPE_UNKNOWN)
+ if (db_type == DB_TYPE_UNKNOWN ||
+ !(*table_type= ha_resolve_by_legacy_type(thd, db_type)))
{
my_error(ER_NO_SUCH_TABLE, MYF(0), db, table_name);
return TRUE;
}
- table_type= ha_resolve_by_legacy_type(thd, db_type);
+ return FALSE;
+}
+
+
+/**
+ Given a table name, check if the storage engine for the
+ table referred by this name supports an option 'flag'.
+ Return an error if the table does not exist or is not a
+ base table.
+
+ @pre Any metadata lock on the table.
+
+ @param[in] thd The current session.
+ @param[in] db Table schema.
+ @param[in] table_name Table database.
+ @param[in] flag The option to check.
+ @param[out] yes_no The result. Undefined if error.
+*/
+
+bool dd_check_storage_engine_flag(THD *thd,
+ const char *db, const char *table_name,
+ uint32 flag, bool *yes_no)
+{
+ handlerton *table_type;
+
+ if (dd_frm_storage_engine(thd, db, table_name, &table_type))
+ return TRUE;
+
*yes_no= ha_check_storage_engine_flag(table_type, flag);
return FALSE;
@@ -152,9 +177,7 @@ bool dd_recreate_table(THD *thd, const char *db, const char *table_name)
build_table_filename(path, sizeof(path) - 1, db, table_name, "", 0);
/* Attempt to reconstruct the table. */
- mysql_mutex_lock(&LOCK_open);
error= ha_create_table(thd, path, db, table_name, &create_info, TRUE);
- mysql_mutex_unlock(&LOCK_open);
DBUG_RETURN(error);
}
diff --git a/sql/datadict.h b/sql/datadict.h
index 05b5a9bba4b..65e40998929 100644
--- a/sql/datadict.h
+++ b/sql/datadict.h
@@ -31,6 +31,8 @@ enum frm_type_enum
frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt);
+bool dd_frm_storage_engine(THD *thd, const char *db, const char *table_name,
+ handlerton **table_type);
bool dd_check_storage_engine_flag(THD *thd,
const char *db, const char *table_name,
uint32 flag,
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index d47f1641bb0..db508e4ea41 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -996,24 +996,33 @@ Event_db_repository::load_named_event(THD *thd, LEX_STRING dbname,
LEX_STRING name, Event_basic *etn)
{
bool ret;
- TABLE *table= NULL;
ulong saved_mode= thd->variables.sql_mode;
+ Open_tables_backup open_tables_backup;
+ TABLE_LIST event_table;
DBUG_ENTER("Event_db_repository::load_named_event");
DBUG_PRINT("enter",("thd: 0x%lx name: %*s", (long) thd,
(int) name.length, name.str));
+ event_table.init_one_table("mysql", 5, "event", 5, "event", TL_READ);
+
/* Reset sql_mode during data dictionary operations. */
thd->variables.sql_mode= 0;
- if (!(ret= open_event_table(thd, TL_READ, &table)))
+ /*
+ We don't use open_event_table() here to make sure that SHOW
+ CREATE EVENT works properly in transactional context, and
+ does not release transactional metadata locks when the
+ event table is closed.
+ */
+ if (!(ret= open_system_tables_for_read(thd, &event_table, &open_tables_backup)))
{
- if ((ret= find_named_event(dbname, name, table)))
+ if ((ret= find_named_event(dbname, name, event_table.table)))
my_error(ER_EVENT_DOES_NOT_EXIST, MYF(0), name.str);
- else if ((ret= etn->load_from_row(thd, table)))
+ else if ((ret= etn->load_from_row(thd, event_table.table)))
my_error(ER_CANNOT_LOAD_FROM_TABLE, MYF(0), "event");
- close_mysql_tables(thd);
+ close_system_tables(thd, &open_tables_backup);
}
thd->variables.sql_mode= saved_mode;
diff --git a/sql/events.cc b/sql/events.cc
index 5379ec2c9eb..10a7535425f 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -76,7 +76,7 @@
Event_queue *Events::event_queue;
Event_scheduler *Events::scheduler;
Event_db_repository *Events::db_repository;
-uint Events::opt_event_scheduler= Events::EVENTS_OFF;
+ulong Events::opt_event_scheduler= Events::EVENTS_OFF;
mysql_mutex_t Events::LOCK_event_metadata;
bool Events::check_system_tables_error= FALSE;
@@ -699,7 +699,6 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol)
bool
Events::show_create_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
{
- Open_tables_backup open_tables_backup;
Event_timed et;
bool ret;
@@ -722,9 +721,7 @@ Events::show_create_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
deadlock can occur please refer to the description of 'system table'
flag.
*/
- thd->reset_n_backup_open_tables_state(&open_tables_backup);
ret= db_repository->load_named_event(thd, dbname, name, &et);
- thd->restore_backup_open_tables_state(&open_tables_backup);
if (!ret)
ret= send_show_create_event(thd, &et, thd->protocol);
diff --git a/sql/events.h b/sql/events.h
index c84c37b881d..1482e736d29 100644
--- a/sql/events.h
+++ b/sql/events.h
@@ -91,7 +91,7 @@ public:
*/
enum enum_opt_event_scheduler { EVENTS_OFF, EVENTS_ON, EVENTS_DISABLED };
/* Protected using LOCK_global_system_variables only. */
- static uint opt_event_scheduler;
+ static ulong opt_event_scheduler;
static mysql_mutex_t LOCK_event_metadata;
static bool check_if_system_tables_error();
static bool start();
diff --git a/sql/field.cc b/sql/field.cc
index 3c93ffadac5..0e55b624633 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1329,7 +1329,7 @@ void Field::hash(ulong *nr, ulong *nr2)
else
{
uint len= pack_length();
- CHARSET_INFO *cs= charset();
+ CHARSET_INFO *cs= sort_charset();
cs->coll->hash_sort(cs, ptr, len, nr, nr2);
}
}
@@ -4189,6 +4189,7 @@ String *Field_float::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
ASSERT_COLUMN_MARKED_FOR_READ;
+ DBUG_ASSERT(field_length <= MAX_FIELD_CHARLENGTH);
float nr;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
@@ -4199,8 +4200,13 @@ String *Field_float::val_str(String *val_buffer,
#endif
memcpy(&nr, ptr, sizeof(nr));
- uint to_length=max(field_length,70);
- val_buffer->alloc(to_length);
+ uint to_length= 70;
+ if (val_buffer->alloc(to_length))
+ {
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ return val_buffer;
+ }
+
char *to=(char*) val_buffer->ptr();
size_t len;
@@ -4209,7 +4215,7 @@ String *Field_float::val_str(String *val_buffer,
else
{
/*
- We are safe here because the buffer length is >= 70, and
+ We are safe here because the buffer length is 70, and
fabs(float) < 10^39, dec < NOT_FIXED_DEC. So the resulting string
will be not longer than 69 chars + terminating '\0'.
*/
@@ -4506,6 +4512,7 @@ String *Field_double::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
ASSERT_COLUMN_MARKED_FOR_READ;
+ DBUG_ASSERT(field_length <= MAX_FIELD_CHARLENGTH);
double nr;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
@@ -4515,9 +4522,13 @@ String *Field_double::val_str(String *val_buffer,
else
#endif
doubleget(nr,ptr);
+ uint to_length= DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE;
+ if (val_buffer->alloc(to_length))
+ {
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ return val_buffer;
+ }
- uint to_length=max(field_length, DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE);
- val_buffer->alloc(to_length);
char *to=(char*) val_buffer->ptr();
size_t len;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 9d394d740a8..bc0f2258a0a 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -680,7 +680,7 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans)
bzero((char*) &table_list,sizeof(table_list));
table_list.db= m_dbname;
table_list.alias= table_list.table_name= m_tabname;
- close_cached_tables(thd, &table_list, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE, LONG_TIMEOUT);
break;
}
default:
@@ -5702,7 +5702,7 @@ int ha_ndbcluster::create(const char *name,
m_table->getObjectVersion(),
(is_truncate) ?
SOT_TRUNCATE_TABLE : SOT_CREATE_TABLE,
- 0, 0, 1);
+ 0, 0);
break;
}
}
@@ -6143,7 +6143,7 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
old_dbname, m_tabname,
ndb_table_id, ndb_table_version,
SOT_RENAME_TABLE,
- m_dbname, new_tabname, 1);
+ m_dbname, new_tabname);
}
// If we are moving tables between databases, we need to recreate
@@ -6337,7 +6337,7 @@ retry_temporary_error1:
thd->query(), thd->query_length(),
share->db, share->table_name,
ndb_table_id, ndb_table_version,
- SOT_DROP_TABLE, 0, 0, 1);
+ SOT_DROP_TABLE, 0, 0);
}
else if (table_dropped && share && share->op) /* ndbcluster_log_schema_op
will do a force GCP */
@@ -7019,7 +7019,6 @@ int ndbcluster_drop_database_impl(const char *path)
while ((tabname=it++))
{
tablename_to_filename(tabname, tmp, FN_REFLEN - (tmp - full_path)-1);
- mysql_mutex_lock(&LOCK_open);
if (ha_ndbcluster::delete_table(0, ndb, full_path, dbname, tabname))
{
const NdbError err= dict->getNdbError();
@@ -7029,7 +7028,6 @@ int ndbcluster_drop_database_impl(const char *path)
ret= ndb_to_mysql_error(&err);
}
}
- mysql_mutex_unlock(&LOCK_open);
}
DBUG_RETURN(ret);
}
@@ -7056,7 +7054,7 @@ static void ndbcluster_drop_database(handlerton *hton, char *path)
ha_ndbcluster::set_dbname(path, db);
ndbcluster_log_schema_op(thd, 0,
thd->query(), thd->query_length(),
- db, "", 0, 0, SOT_DROP_DB, 0, 0, 0);
+ db, "", 0, 0, SOT_DROP_DB, 0, 0);
#endif
DBUG_VOID_RETURN;
}
@@ -7181,7 +7179,6 @@ int ndbcluster_find_all_files(THD *thd)
my_free(data);
my_free(pack_data);
- mysql_mutex_lock(&LOCK_open);
if (discover)
{
/* ToDo 4.1 database needs to be created if missing */
@@ -7199,7 +7196,6 @@ int ndbcluster_find_all_files(THD *thd)
TRUE);
}
#endif
- mysql_mutex_unlock(&LOCK_open);
}
}
while (unhandled && retries);
@@ -7292,19 +7288,16 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
file_name->str, reg_ext, 0);
if (my_access(name, F_OK))
{
- mysql_mutex_lock(&LOCK_open);
DBUG_PRINT("info", ("Table %s listed and need discovery",
file_name->str));
if (ndb_create_table_from_engine(thd, db, file_name->str))
{
- mysql_mutex_unlock(&LOCK_open);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TABLE_EXISTS_ERROR,
"Discover of table %s.%s failed",
db, file_name->str);
continue;
}
- mysql_mutex_unlock(&LOCK_open);
}
DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name->str));
file_on_disk= TRUE;
@@ -7361,10 +7354,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
file_name_str= (char*)my_hash_element(&ok_tables, i);
end= end1 +
tablename_to_filename(file_name_str, end1, sizeof(name) - (end1 - name));
- mysql_mutex_lock(&LOCK_open);
ndbcluster_create_binlog_setup(ndb, name, end-name,
db, file_name_str, TRUE);
- mysql_mutex_unlock(&LOCK_open);
}
}
#endif
@@ -7426,7 +7417,6 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
}
/* Lock mutex before creating .FRM files. */
- mysql_mutex_lock(&LOCK_open);
/* Create new files. */
List_iterator_fast<char> it2(create_list);
while ((file_name_str=it2++))
@@ -7441,8 +7431,6 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
}
}
- mysql_mutex_unlock(&LOCK_open);
-
my_hash_free(&ok_tables);
my_hash_free(&ndb_tables);
@@ -8452,8 +8440,7 @@ int handle_trailing_share(NDB_SHARE *share)
bzero((char*) &table_list,sizeof(table_list));
table_list.db= share->db;
table_list.alias= table_list.table_name= share->table_name;
- mysql_mutex_assert_owner(&LOCK_open);
- close_cached_tables(thd, &table_list, TRUE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE, LONG_TIMEOUT);
mysql_mutex_lock(&ndbcluster_mutex);
/* ndb_share reference temporary free */
@@ -10612,13 +10599,13 @@ int ndbcluster_alter_tablespace(handlerton *hton,
thd->query(), thd->query_length(),
"", alter_info->tablespace_name,
0, 0,
- SOT_TABLESPACE, 0, 0, 0);
+ SOT_TABLESPACE, 0, 0);
else
ndbcluster_log_schema_op(thd, 0,
thd->query(), thd->query_length(),
"", alter_info->logfile_group_name,
0, 0,
- SOT_LOGFILE_GROUP, 0, 0, 0);
+ SOT_LOGFILE_GROUP, 0, 0);
#endif
DBUG_RETURN(FALSE);
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index 1f3b707be91..e46b6b25f9c 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -360,7 +360,6 @@ ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share,
int error;
DBUG_ENTER("ndbcluster_binlog_open_table");
- mysql_mutex_assert_owner(&LOCK_open);
init_tmp_table_share(thd, table_share, share->db, 0, share->table_name,
share->key);
if ((error= open_table_def(thd, table_share, 0)))
@@ -376,7 +375,9 @@ ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share,
free_table_share(table_share);
DBUG_RETURN(error);
}
+ mysql_mutex_lock(&LOCK_open);
assign_new_table_id(table_share);
+ mysql_mutex_unlock(&LOCK_open);
if (!reopen)
{
@@ -625,7 +626,7 @@ ndbcluster_binlog_log_query(handlerton *hton, THD *thd, enum_binlog_command binl
{
ndbcluster_log_schema_op(thd, 0, query, query_length,
db, table_name, 0, 0, type,
- 0, 0, 0);
+ 0, 0);
}
DBUG_VOID_RETURN;
}
@@ -908,9 +909,7 @@ int ndbcluster_setup_binlog_table_shares(THD *thd)
if (!ndb_schema_share &&
ndbcluster_check_ndb_schema_share() == 0)
{
- mysql_mutex_lock(&LOCK_open);
ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_SCHEMA_TABLE);
- mysql_mutex_unlock(&LOCK_open);
if (!ndb_schema_share)
{
ndbcluster_create_schema_table(thd);
@@ -922,9 +921,7 @@ int ndbcluster_setup_binlog_table_shares(THD *thd)
if (!ndb_apply_status_share &&
ndbcluster_check_ndb_apply_status_share() == 0)
{
- mysql_mutex_lock(&LOCK_open);
ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_APPLY_TABLE);
- mysql_mutex_unlock(&LOCK_open);
if (!ndb_apply_status_share)
{
ndbcluster_create_ndb_apply_status_table(thd);
@@ -934,12 +931,10 @@ int ndbcluster_setup_binlog_table_shares(THD *thd)
}
if (!ndbcluster_find_all_files(thd))
{
- mysql_mutex_lock(&LOCK_open);
ndb_binlog_tables_inited= TRUE;
if (opt_ndb_extra_logging)
sql_print_information("NDB Binlog: ndb tables writable");
- close_cached_tables(NULL, NULL, TRUE, FALSE);
- mysql_mutex_unlock(&LOCK_open);
+ close_cached_tables(NULL, NULL, FALSE, LONG_TIMEOUT);
/* Signal injector thread that all is setup */
mysql_cond_signal(&injector_cond);
}
@@ -1276,8 +1271,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
uint32 ndb_table_id,
uint32 ndb_table_version,
enum SCHEMA_OP_TYPE type,
- const char *new_db, const char *new_table_name,
- int have_lock_open)
+ const char *new_db, const char *new_table_name)
{
DBUG_ENTER("ndbcluster_log_schema_op");
Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -1580,11 +1574,6 @@ end:
int max_timeout= DEFAULT_SYNC_TIMEOUT;
mysql_mutex_lock(&ndb_schema_object->mutex);
- if (have_lock_open)
- {
- mysql_mutex_assert_owner(&LOCK_open);
- mysql_mutex_unlock(&LOCK_open);
- }
while (1)
{
struct timespec abstime;
@@ -1640,10 +1629,6 @@ end:
"distributing", ndb_schema_object->key);
}
}
- if (have_lock_open)
- {
- mysql_mutex_lock(&LOCK_open);
- }
mysql_mutex_unlock(&ndb_schema_object->mutex);
}
@@ -1726,7 +1711,6 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
{
DBUG_DUMP("frm", (uchar*) altered_table->getFrmData(),
altered_table->getFrmLength());
- mysql_mutex_lock(&LOCK_open);
Ndb_table_guard ndbtab_g(dict, tabname);
const NDBTAB *old= ndbtab_g.get_table();
if (!old &&
@@ -1752,7 +1736,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
bzero((char*) &table_list,sizeof(table_list));
table_list.db= (char *)dbname;
table_list.alias= table_list.table_name= (char *)tabname;
- close_cached_tables(thd, &table_list, TRUE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE, LONG_TIMEOUT);
if ((error= ndbcluster_binlog_open_table(thd, share,
table_share, table, 1)))
@@ -1763,8 +1747,6 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
table_share= share->table_share;
dbname= table_share->db.str;
tabname= table_share->table_name.str;
-
- mysql_mutex_unlock(&LOCK_open);
}
my_free(data);
my_free(pack_data);
@@ -1858,7 +1840,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
bzero((char*) &table_list,sizeof(table_list));
table_list.db= (char *)dbname;
table_list.alias= table_list.table_name= (char *)tabname;
- close_cached_tables(thd, &table_list, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE, LONG_TIMEOUT);
/* ndb_share reference create free */
DBUG_PRINT("NDB_SHARE", ("%s create free use_count: %u",
share->key, share->use_count));
@@ -1979,7 +1961,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
bzero((char*) &table_list,sizeof(table_list));
table_list.db= schema->db;
table_list.alias= table_list.table_name= schema->name;
- close_cached_tables(thd, &table_list, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE, LONG_TIMEOUT);
}
/* ndb_share reference temporary free */
if (share)
@@ -1991,7 +1973,6 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
}
// fall through
case SOT_CREATE_TABLE:
- mysql_mutex_lock(&LOCK_open);
if (ndbcluster_check_if_local_table(schema->db, schema->name))
{
DBUG_PRINT("info", ("NDB Binlog: Skipping locally defined table '%s.%s'",
@@ -2005,7 +1986,6 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
{
print_could_not_discover_error(thd, schema);
}
- mysql_mutex_unlock(&LOCK_open);
log_query= 1;
break;
case SOT_DROP_DB:
@@ -2096,7 +2076,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
mysql_mutex_unlock(&ndb_schema_share_mutex);
/* end protect ndb_schema_share */
- close_cached_tables(NULL, NULL, FALSE, FALSE);
+ close_cached_tables(NULL, NULL, FALSE, LONG_TIMEOUT);
// fall through
case NDBEVENT::TE_ALTER:
ndb_handle_schema_change(thd, ndb, pOp, tmp_share);
@@ -2253,7 +2233,7 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd,
bzero((char*) &table_list,sizeof(table_list));
table_list.db= schema->db;
table_list.alias= table_list.table_name= schema->name;
- close_cached_tables(thd, &table_list, FALSE, FALSE);
+ close_cached_tables(thd, &table_list, FALSE, LONG_TIMEOUT);
}
if (schema_type != SOT_ALTER_TABLE)
break;
@@ -2274,7 +2254,6 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd,
free_share(&share);
share= 0;
}
- mysql_mutex_lock(&LOCK_open);
if (ndbcluster_check_if_local_table(schema->db, schema->name))
{
DBUG_PRINT("info", ("NDB Binlog: Skipping locally defined table '%s.%s'",
@@ -2288,7 +2267,6 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd,
{
print_could_not_discover_error(thd, schema);
}
- mysql_mutex_unlock(&LOCK_open);
}
break;
default:
@@ -3154,8 +3132,6 @@ ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name,
#ifdef SYNC_DROP_
thd->proc_info= "Syncing ndb table schema operation and binlog";
mysql_mutex_lock(&share->mutex);
- mysql_mutex_assert_owner(&LOCK_open);
- mysql_mutex_unlock(&LOCK_open);
int max_timeout= DEFAULT_SYNC_TIMEOUT;
while (share->op)
{
@@ -3181,7 +3157,6 @@ ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name,
type_str, share->key);
}
}
- mysql_mutex_lock(&LOCK_open);
mysql_mutex_unlock(&share->mutex);
#else
mysql_mutex_lock(&share->mutex);
@@ -3963,9 +3938,9 @@ restart:
!ndb_binlog_running))
break; /* Shutting down server */
- if (ndb_binlog_index && ndb_binlog_index->s->needs_reopen())
+ if (ndb_binlog_index && ndb_binlog_index->s->has_old_version())
{
- if (ndb_binlog_index->s->needs_reopen())
+ if (ndb_binlog_index->s->has_old_version())
{
trans_commit_stmt(thd);
close_thread_tables(thd);
diff --git a/sql/ha_ndbcluster_binlog.h b/sql/ha_ndbcluster_binlog.h
index 4d2a49588b4..5dbcf0fa43f 100644
--- a/sql/ha_ndbcluster_binlog.h
+++ b/sql/ha_ndbcluster_binlog.h
@@ -158,8 +158,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
uint32 ndb_table_version,
enum SCHEMA_OP_TYPE type,
const char *new_db,
- const char *new_table_name,
- int have_lock_open);
+ const char *new_table_name);
int ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name,
NDB_SHARE *share,
const char *type_str);
diff --git a/sql/ha_ndbcluster_cond.cc b/sql/ha_ndbcluster_cond.cc
index 6df1f4881c3..8a96ae41453 100644
--- a/sql/ha_ndbcluster_cond.cc
+++ b/sql/ha_ndbcluster_cond.cc
@@ -35,6 +35,110 @@
typedef NdbDictionary::Column NDBCOL;
typedef NdbDictionary::Table NDBTAB;
+
+/**
+ Serialize a constant item into a Ndb_cond node.
+
+ @param const_type item's result type
+ @param item item to be serialized
+ @param curr_cond Ndb_cond node the item to be serialized into
+ @param context Traverse context
+*/
+
+static void ndb_serialize_const(Item_result const_type, const Item *item,
+ Ndb_cond *curr_cond,
+ Ndb_cond_traverse_context *context)
+{
+ DBUG_ASSERT(item->const_item());
+ switch (const_type) {
+ case STRING_RESULT:
+ {
+ NDB_ITEM_QUALIFICATION q;
+ q.value_type= Item::STRING_ITEM;
+ curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
+ if (! context->expecting_no_field_result())
+ {
+ // We have not seen the field argument yet
+ context->expect_only(Item::FIELD_ITEM);
+ context->expect_only_field_result(STRING_RESULT);
+ context->expect_collation(item->collation.collation);
+ }
+ else
+ {
+ // Expect another logical expression
+ context->expect_only(Item::FUNC_ITEM);
+ context->expect(Item::COND_ITEM);
+ // Check that string result have correct collation
+ if (!context->expecting_collation(item->collation.collation))
+ {
+ DBUG_PRINT("info", ("Found non-matching collation %s",
+ item->collation.collation->name));
+ context->supported= FALSE;
+ }
+ }
+ break;
+ }
+ case REAL_RESULT:
+ {
+ NDB_ITEM_QUALIFICATION q;
+ q.value_type= Item::REAL_ITEM;
+ curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
+ if (! context->expecting_no_field_result())
+ {
+ // We have not seen the field argument yet
+ context->expect_only(Item::FIELD_ITEM);
+ context->expect_only_field_result(REAL_RESULT);
+ }
+ else
+ {
+ // Expect another logical expression
+ context->expect_only(Item::FUNC_ITEM);
+ context->expect(Item::COND_ITEM);
+ }
+ break;
+ }
+ case INT_RESULT:
+ {
+ NDB_ITEM_QUALIFICATION q;
+ q.value_type= Item::INT_ITEM;
+ curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
+ if (! context->expecting_no_field_result())
+ {
+ // We have not seen the field argument yet
+ context->expect_only(Item::FIELD_ITEM);
+ context->expect_only_field_result(INT_RESULT);
+ }
+ else
+ {
+ // Expect another logical expression
+ context->expect_only(Item::FUNC_ITEM);
+ context->expect(Item::COND_ITEM);
+ }
+ break;
+ }
+ case DECIMAL_RESULT:
+ {
+ NDB_ITEM_QUALIFICATION q;
+ q.value_type= Item::DECIMAL_ITEM;
+ curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
+ if (! context->expecting_no_field_result())
+ {
+ // We have not seen the field argument yet
+ context->expect_only(Item::FIELD_ITEM);
+ context->expect_only_field_result(DECIMAL_RESULT);
+ }
+ else
+ {
+ // Expect another logical expression
+ context->expect_only(Item::FUNC_ITEM);
+ context->expect(Item::COND_ITEM);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+}
/*
Serialize the item tree into a linked list represented by Ndb_cond
for fast generation of NbdScanFilter. Adds information such as
@@ -113,7 +217,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
to ndb_serialize_cond and end of rewrite statement
is wrapped in end of ndb_serialize_cond
*/
- if (context->expecting(item->type()))
+ if (context->expecting(item->type()) || item->const_item())
{
// This is the <field>|<const> item, save it in the rewrite context
rewrite_context2->left_hand_item= item;
@@ -597,108 +701,12 @@ void ndb_serialize_cond(const Item *item, void *arg)
DBUG_PRINT("info", ("result type %d", func_item->result_type()));
if (func_item->const_item())
{
- switch (func_item->result_type()) {
- case STRING_RESULT:
- {
- NDB_ITEM_QUALIFICATION q;
- q.value_type= Item::STRING_ITEM;
- curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
- if (! context->expecting_no_field_result())
- {
- // We have not seen the field argument yet
- context->expect_only(Item::FIELD_ITEM);
- context->expect_only_field_result(STRING_RESULT);
- context->expect_collation(func_item->collation.collation);
- }
- else
- {
- // Expect another logical expression
- context->expect_only(Item::FUNC_ITEM);
- context->expect(Item::COND_ITEM);
- // Check that string result have correct collation
- if (!context->expecting_collation(item->collation.collation))
- {
- DBUG_PRINT("info", ("Found non-matching collation %s",
- item->collation.collation->name));
- context->supported= FALSE;
- }
- }
- // Skip any arguments since we will evaluate function instead
- DBUG_PRINT("info", ("Skip until end of arguments marker"));
- context->skip= func_item->argument_count();
- break;
- }
- case REAL_RESULT:
- {
- NDB_ITEM_QUALIFICATION q;
- q.value_type= Item::REAL_ITEM;
- curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
- if (! context->expecting_no_field_result())
- {
- // We have not seen the field argument yet
- context->expect_only(Item::FIELD_ITEM);
- context->expect_only_field_result(REAL_RESULT);
- }
- else
- {
- // Expect another logical expression
- context->expect_only(Item::FUNC_ITEM);
- context->expect(Item::COND_ITEM);
- }
-
- // Skip any arguments since we will evaluate function instead
- DBUG_PRINT("info", ("Skip until end of arguments marker"));
- context->skip= func_item->argument_count();
- break;
- }
- case INT_RESULT:
- {
- NDB_ITEM_QUALIFICATION q;
- q.value_type= Item::INT_ITEM;
- curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
- if (! context->expecting_no_field_result())
- {
- // We have not seen the field argument yet
- context->expect_only(Item::FIELD_ITEM);
- context->expect_only_field_result(INT_RESULT);
- }
- else
- {
- // Expect another logical expression
- context->expect_only(Item::FUNC_ITEM);
- context->expect(Item::COND_ITEM);
- }
-
- // Skip any arguments since we will evaluate function instead
- DBUG_PRINT("info", ("Skip until end of arguments marker"));
- context->skip= func_item->argument_count();
- break;
- }
- case DECIMAL_RESULT:
- {
- NDB_ITEM_QUALIFICATION q;
- q.value_type= Item::DECIMAL_ITEM;
- curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
- if (! context->expecting_no_field_result())
- {
- // We have not seen the field argument yet
- context->expect_only(Item::FIELD_ITEM);
- context->expect_only_field_result(DECIMAL_RESULT);
- }
- else
- {
- // Expect another logical expression
- context->expect_only(Item::FUNC_ITEM);
- context->expect(Item::COND_ITEM);
- }
- // Skip any arguments since we will evaluate function instead
- DBUG_PRINT("info", ("Skip until end of arguments marker"));
- context->skip= func_item->argument_count();
- break;
- }
- default:
- break;
- }
+ ndb_serialize_const(func_item->result_type(), item, curr_cond,
+ context);
+
+ // Skip any arguments since we will evaluate function instead
+ DBUG_PRINT("info", ("Skip until end of arguments marker"));
+ context->skip= func_item->argument_count();
}
else
// Function does not return constant expression
@@ -883,6 +891,19 @@ void ndb_serialize_cond(const Item *item, void *arg)
}
break;
}
+ case Item::CACHE_ITEM:
+ {
+ DBUG_PRINT("info", ("CACHE_ITEM"));
+ if (item->const_item())
+ {
+ ndb_serialize_const(((Item_cache*)item)->result_type(), item,
+ curr_cond, context);
+ }
+ else
+ context->supported= FALSE;
+
+ break;
+ }
default:
{
DBUG_PRINT("info", ("Found item of type %d", item->type()));
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 7891f658f45..e6915b45a97 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2446,9 +2446,14 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
tot_partition_words= (m_tot_parts + 3) / 4;
engine_array= (handlerton **) my_alloca(m_tot_parts * sizeof(handlerton*));
for (i= 0; i < m_tot_parts; i++)
+ {
engine_array[i]= ha_resolve_by_legacy_type(ha_thd(),
(enum legacy_db_type)
- *(uchar *) ((file_buffer) + 12 + i));
+ *(uchar *) ((file_buffer) +
+ 12 + i));
+ if (!engine_array[i])
+ goto err3;
+ }
address_tot_name_len= file_buffer + 12 + 4 * tot_partition_words;
tot_name_words= (uint4korr(address_tot_name_len) + 3) / 4;
if (len_words != (tot_partition_words + tot_name_words + 4))
diff --git a/sql/handler.cc b/sql/handler.cc
index 9893b3cac16..567dbe6ea49 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -3670,6 +3670,34 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
DBUG_RETURN(error != 0);
}
+
+/**
+ Try to find a table in a storage engine.
+
+ @param db Normalized table schema name
+ @param name Normalized table name.
+ @param[out] exists Only valid if the function succeeded.
+
+ @retval TRUE An error is found
+ @retval FALSE Success, check *exists
+*/
+
+bool
+ha_check_if_table_exists(THD* thd, const char *db, const char *name,
+ bool *exists)
+{
+ uchar *frmblob= NULL;
+ size_t frmlen;
+ DBUG_ENTER("ha_check_if_table_exists");
+
+ *exists= ! ha_discover(thd, db, name, &frmblob, &frmlen);
+ if (*exists)
+ my_free(frmblob);
+
+ DBUG_RETURN(FALSE);
+}
+
+
void st_ha_check_opt::init()
{
flags= sql_flags= 0;
diff --git a/sql/handler.h b/sql/handler.h
index cad97c1f751..b1d64a1114b 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1001,7 +1001,6 @@ typedef struct st_ha_create_information
uint merge_insert_method;
uint extra_size; /* length of extra data segment */
enum enum_ha_unused unused1;
- bool table_existed; /* 1 in create if table existed */
bool frm_only; /* 1 if no ha_create_table() */
bool varchar; /* 1 if table has a VARCHAR */
enum ha_storage_media storage_media; /* DEFAULT, DISK or MEMORY */
@@ -2120,6 +2119,8 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat);
/* discovery */
int ha_create_table_from_engine(THD* thd, const char *db, const char *name);
+bool ha_check_if_table_exists(THD* thd, const char *db, const char *name,
+ bool *exists);
int ha_discover(THD* thd, const char* dbname, const char* name,
uchar** frmblob, size_t* frmlen);
int ha_find_files(THD *thd,const char *db,const char *path,
diff --git a/sql/item.cc b/sql/item.cc
index 1decb5ec426..427146e11dc 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5931,7 +5931,8 @@ bool Item::cache_const_expr_analyzer(uchar **arg)
a subselect (they use their own cache).
*/
if (const_item() &&
- !(item->basic_const_item() || item->type() == Item::FIELD_ITEM ||
+ !(basic_const_item() || item->basic_const_item() ||
+ item->type() == Item::FIELD_ITEM ||
item->type() == SUBSELECT_ITEM ||
/*
Do not cache GET_USER_VAR() function as its const_item() may
@@ -7509,9 +7510,14 @@ String *Item_cache_datetime::val_str(String *str)
return NULL;
if (cached_field_type == MYSQL_TYPE_TIME)
{
- ulonglong time= int_value;
- DBUG_ASSERT(time <= TIME_MAX_VALUE);
+ longlong time= int_value;
set_zero_time(&ltime, MYSQL_TIMESTAMP_TIME);
+ if (time < 0)
+ {
+ time= -time;
+ ltime.neg= TRUE;
+ }
+ DBUG_ASSERT(time <= TIME_MAX_VALUE);
ltime.second= time % 100;
time/= 100;
ltime.minute= time % 100;
diff --git a/sql/item.h b/sql/item.h
index c7a97ca716a..8e8199ecac8 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -547,7 +547,7 @@ public:
@see Query_arena::free_list
*/
Item *next;
- uint32 max_length;
+ uint32 max_length; /* Maximum length, in bytes */
uint name_length; /* Length of name */
int8 marker;
uint8 decimals;
@@ -1221,6 +1221,18 @@ public:
max_length= char_to_byte_length_safe(max_char_length_arg,
collation.collation->mbmaxlen);
}
+ void fix_char_length_ulonglong(ulonglong max_char_length_arg)
+ {
+ ulonglong max_result_length= max_char_length_arg *
+ collation.collation->mbmaxlen;
+ if (max_result_length >= MAX_BLOB_WIDTH)
+ {
+ max_length= MAX_BLOB_WIDTH;
+ maybe_null= 1;
+ }
+ else
+ max_length= max_result_length;
+ }
void fix_length_and_charset_datetime(uint32 max_char_length_arg)
{
collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII);
@@ -2825,6 +2837,7 @@ protected:
cached_result_type= item->result_type();
unsigned_flag= item->unsigned_flag;
fixed= item->fixed;
+ collation.set(item->collation);
}
public:
@@ -2982,6 +2995,7 @@ public:
class Cached_item_str :public Cached_item
{
Item *item;
+ uint32 value_max_length;
String value,tmp_value;
public:
Cached_item_str(THD *thd, Item *arg);
@@ -3266,6 +3280,12 @@ public:
bool basic_const_item() const
{ return test(example && example->basic_const_item());}
virtual void clear() { null_value= TRUE; value_cached= FALSE; }
+ Item_result result_type() const
+ {
+ if (!example)
+ return INT_RESULT;
+ return Field::result_merge_type(example->field_type());
+ }
};
@@ -3335,7 +3355,9 @@ public:
is_varbinary(item->type() == FIELD_ITEM &&
cached_field_type == MYSQL_TYPE_VARCHAR &&
!((const Item_field *) item)->field->has_charset())
- {}
+ {
+ collation.set(const_cast<DTCollation&>(item->collation));
+ }
double val_real();
longlong val_int();
String* val_str(String *);
diff --git a/sql/item_buff.cc b/sql/item_buff.cc
index a1bbd95c2c6..87197c7d9b6 100644
--- a/sql/item_buff.cc
+++ b/sql/item_buff.cc
@@ -65,7 +65,9 @@ Cached_item::~Cached_item() {}
*/
Cached_item_str::Cached_item_str(THD *thd, Item *arg)
- :item(arg), value(min(arg->max_length, thd->variables.max_sort_length))
+ :item(arg),
+ value_max_length(min(arg->max_length, thd->variables.max_sort_length)),
+ value(value_max_length)
{}
bool Cached_item_str::cmp(void)
@@ -74,7 +76,7 @@ bool Cached_item_str::cmp(void)
bool tmp;
if ((res=item->val_str(&tmp_value)))
- res->length(min(res->length(), value.alloced_length()));
+ res->length(min(res->length(), value_max_length));
if (null_value != item->null_value)
{
if ((null_value= item->null_value))
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 85565b735d4..8c0f22b0947 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2374,6 +2374,7 @@ void Item_func_between::print(String *str, enum_query_type query_type)
void
Item_func_ifnull::fix_length_and_dec()
{
+ uint32 char_length;
agg_result_type(&hybrid_type, args, 2);
maybe_null=args[1]->maybe_null;
decimals= max(args[0]->decimals, args[1]->decimals);
@@ -2381,20 +2382,21 @@ Item_func_ifnull::fix_length_and_dec()
if (hybrid_type == DECIMAL_RESULT || hybrid_type == INT_RESULT)
{
- int len0= args[0]->max_length - args[0]->decimals
+ int len0= args[0]->max_char_length() - args[0]->decimals
- (args[0]->unsigned_flag ? 0 : 1);
- int len1= args[1]->max_length - args[1]->decimals
+ int len1= args[1]->max_char_length() - args[1]->decimals
- (args[1]->unsigned_flag ? 0 : 1);
- max_length= max(len0, len1) + decimals + (unsigned_flag ? 0 : 1);
+ char_length= max(len0, len1) + decimals + (unsigned_flag ? 0 : 1);
}
else
- max_length= max(args[0]->max_length, args[1]->max_length);
+ char_length= max(args[0]->max_char_length(), args[1]->max_char_length());
switch (hybrid_type) {
case STRING_RESULT:
- agg_arg_charsets_for_comparison(collation, args, arg_count);
+ if (agg_arg_charsets_for_comparison(collation, args, arg_count))
+ return;
break;
case DECIMAL_RESULT:
case REAL_RESULT:
@@ -2406,6 +2408,7 @@ Item_func_ifnull::fix_length_and_dec()
default:
DBUG_ASSERT(0);
}
+ fix_char_length(char_length);
cached_field_type= agg_field_type(args, 2);
}
@@ -2557,28 +2560,32 @@ Item_func_if::fix_length_and_dec()
cached_result_type= arg2_type;
collation.set(args[2]->collation.collation);
cached_field_type= args[2]->field_type();
+ max_length= args[2]->max_length;
+ return;
}
- else if (null2)
+
+ if (null2)
{
cached_result_type= arg1_type;
collation.set(args[1]->collation.collation);
cached_field_type= args[1]->field_type();
+ max_length= args[1]->max_length;
+ return;
+ }
+
+ agg_result_type(&cached_result_type, args + 1, 2);
+ if (cached_result_type == STRING_RESULT)
+ {
+ if (agg_arg_charsets_for_string_result(collation, args + 1, 2))
+ return;
}
else
{
- agg_result_type(&cached_result_type, args+1, 2);
- if (cached_result_type == STRING_RESULT)
- {
- if (agg_arg_charsets_for_string_result(collation, args + 1, 2))
- return;
- }
- else
- {
- collation.set_numeric(); // Number
- }
- cached_field_type= agg_field_type(args + 1, 2);
+ collation.set_numeric(); // Number
}
+ cached_field_type= agg_field_type(args + 1, 2);
+ uint32 char_length;
if ((cached_result_type == DECIMAL_RESULT )
|| (cached_result_type == INT_RESULT))
{
@@ -2588,10 +2595,11 @@ Item_func_if::fix_length_and_dec()
int len2= args[2]->max_length - args[2]->decimals
- (args[2]->unsigned_flag ? 0 : 1);
- max_length=max(len1, len2) + decimals + (unsigned_flag ? 0 : 1);
+ char_length= max(len1, len2) + decimals + (unsigned_flag ? 0 : 1);
}
else
- max_length= max(args[1]->max_length, args[2]->max_length);
+ char_length= max(args[1]->max_char_length(), args[2]->max_char_length());
+ fix_char_length(char_length);
}
@@ -2901,7 +2909,7 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref)
void Item_func_case::agg_str_lengths(Item* arg)
{
- set_if_bigger(max_length, arg->max_length);
+ fix_char_length(max(max_char_length(), arg->max_char_length()));
set_if_bigger(decimals, arg->decimals);
unsigned_flag= unsigned_flag && arg->unsigned_flag;
}
@@ -3129,9 +3137,10 @@ void Item_func_coalesce::fix_length_and_dec()
agg_result_type(&hybrid_type, args, arg_count);
switch (hybrid_type) {
case STRING_RESULT:
- count_only_length();
decimals= NOT_FIXED_DEC;
- agg_arg_charsets_for_string_result(collation, args, arg_count);
+ if (agg_arg_charsets_for_string_result(collation, args, arg_count))
+ return;
+ count_only_length();
break;
case DECIMAL_RESULT:
count_decimal_length();
@@ -4617,7 +4626,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
return TRUE;
}
- if (escape_item->const_item())
+ if (escape_item->const_item() && !thd->lex->view_prepare_mode)
{
/* If we are on execution stage */
String *escape_str= escape_item->val_str(&cmp.value1);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 833eac6893b..6699b2820e6 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -564,8 +564,9 @@ void Item_func::count_decimal_length()
set_if_smaller(unsigned_flag, args[i]->unsigned_flag);
}
int precision= min(max_int_part + decimals, DECIMAL_MAX_PRECISION);
- max_length= my_decimal_precision_to_length_no_truncation(precision, decimals,
- unsigned_flag);
+ fix_char_length(my_decimal_precision_to_length_no_truncation(precision,
+ decimals,
+ unsigned_flag));
}
@@ -575,13 +576,14 @@ void Item_func::count_decimal_length()
void Item_func::count_only_length()
{
- max_length= 0;
+ uint32 char_length= 0;
unsigned_flag= 0;
for (uint i=0 ; i < arg_count ; i++)
{
- set_if_bigger(max_length, args[i]->max_length);
+ set_if_bigger(char_length, args[i]->max_char_length());
set_if_bigger(unsigned_flag, args[i]->unsigned_flag);
}
+ fix_char_length(char_length);
}
@@ -2531,6 +2533,8 @@ void Item_func_min_max::fix_length_and_dec()
decimals,
unsigned_flag));
}
+ else if (cmp_type == REAL_RESULT)
+ fix_char_length(float_length(decimals));
cached_field_type= agg_field_type(args, arg_count);
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 851d0e07a7e..6d3514bf356 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -605,27 +605,15 @@ null:
void Item_func_concat::fix_length_and_dec()
{
- ulonglong max_result_length= 0;
+ ulonglong char_length= 0;
if (agg_arg_charsets_for_string_result(collation, args, arg_count))
return;
for (uint i=0 ; i < arg_count ; i++)
- {
- if (args[i]->collation.collation->mbmaxlen != collation.collation->mbmaxlen)
- max_result_length+= (args[i]->max_length /
- args[i]->collation.collation->mbmaxlen) *
- collation.collation->mbmaxlen;
- else
- max_result_length+= args[i]->max_length;
- }
+ char_length+= args[i]->max_char_length();
- if (max_result_length >= MAX_BLOB_WIDTH)
- {
- max_result_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- }
- max_length= (ulong) max_result_length;
+ fix_char_length_ulonglong(char_length);
}
/**
@@ -962,7 +950,7 @@ null:
void Item_func_concat_ws::fix_length_and_dec()
{
- ulonglong max_result_length;
+ ulonglong char_length;
if (agg_arg_charsets_for_string_result(collation, args, arg_count))
return;
@@ -972,16 +960,11 @@ void Item_func_concat_ws::fix_length_and_dec()
it is done on parser level in sql_yacc.yy
so, (arg_count - 2) is safe here.
*/
- max_result_length= (ulonglong) args[0]->max_length * (arg_count - 2);
+ char_length= (ulonglong) args[0]->max_char_length() * (arg_count - 2);
for (uint i=1 ; i < arg_count ; i++)
- max_result_length+=args[i]->max_length;
+ char_length+= args[i]->max_char_length();
- if (max_result_length >= MAX_BLOB_WIDTH)
- {
- max_result_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- }
- max_length= (ulong) max_result_length;
+ fix_char_length_ulonglong(char_length);
}
@@ -1036,6 +1019,7 @@ String *Item_func_reverse::val_str(String *str)
void Item_func_reverse::fix_length_and_dec()
{
agg_arg_charsets_for_string_result(collation, args, 1);
+ DBUG_ASSERT(collation.collation != NULL);
fix_char_length(args[0]->max_char_length());
}
@@ -1165,22 +1149,17 @@ null:
void Item_func_replace::fix_length_and_dec()
{
- ulonglong max_result_length= args[0]->max_length;
- int diff=(int) (args[2]->max_length - args[1]->max_length);
- if (diff > 0 && args[1]->max_length)
+ ulonglong char_length= (ulonglong) args[0]->max_char_length();
+ int diff=(int) (args[2]->max_char_length() - args[1]->max_char_length());
+ if (diff > 0 && args[1]->max_char_length())
{ // Calculate of maxreplaces
- ulonglong max_substrs= max_result_length/args[1]->max_length;
- max_result_length+= max_substrs * (uint) diff;
- }
- if (max_result_length >= MAX_BLOB_WIDTH)
- {
- max_result_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
+ ulonglong max_substrs= char_length / args[1]->max_char_length();
+ char_length+= max_substrs * (uint) diff;
}
- max_length= (ulong) max_result_length;
-
+
if (agg_arg_charsets_for_comparison(collation, args, 3))
return;
+ fix_char_length_ulonglong(char_length);
}
@@ -1235,19 +1214,14 @@ null:
void Item_func_insert::fix_length_and_dec()
{
- ulonglong max_result_length;
+ ulonglong char_length;
// Handle character set for args[0] and args[3].
if (agg_arg_charsets_for_string_result(collation, args, 2, 3))
return;
- max_result_length= ((ulonglong) args[0]->max_length+
- (ulonglong) args[3]->max_length);
- if (max_result_length >= MAX_BLOB_WIDTH)
- {
- max_result_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- }
- max_length= (ulong) max_result_length;
+ char_length= ((ulonglong) args[0]->max_char_length() +
+ (ulonglong) args[3]->max_char_length());
+ fix_char_length_ulonglong(char_length);
}
@@ -1287,17 +1261,19 @@ String *Item_str_conv::val_str(String *str)
void Item_func_lcase::fix_length_and_dec()
{
agg_arg_charsets_for_string_result(collation, args, 1);
+ DBUG_ASSERT(collation.collation != NULL);
multiply= collation.collation->casedn_multiply;
converter= collation.collation->cset->casedn;
- max_length= args[0]->max_length * multiply;
+ fix_char_length_ulonglong((ulonglong) args[0]->max_char_length() * multiply);
}
void Item_func_ucase::fix_length_and_dec()
{
agg_arg_charsets_for_string_result(collation, args, 1);
+ DBUG_ASSERT(collation.collation != NULL);
multiply= collation.collation->caseup_multiply;
converter= collation.collation->cset->caseup;
- max_length= args[0]->max_length * multiply;
+ fix_char_length_ulonglong((ulonglong) args[0]->max_char_length() * multiply);
}
@@ -1328,21 +1304,23 @@ String *Item_func_left::val_str(String *str)
void Item_str_func::left_right_max_length()
{
- max_length=args[0]->max_length;
+ uint32 char_length= args[0]->max_char_length();
if (args[1]->const_item())
{
- int length=(int) args[1]->val_int()*collation.collation->mbmaxlen;
+ int length= (int) args[1]->val_int();
if (length <= 0)
- max_length=0;
+ char_length=0;
else
- set_if_smaller(max_length,(uint) length);
+ set_if_smaller(char_length, (uint) length);
}
+ fix_char_length(char_length);
}
void Item_func_left::fix_length_and_dec()
{
agg_arg_charsets_for_string_result(collation, args, 1);
+ DBUG_ASSERT(collation.collation != NULL);
left_right_max_length();
}
@@ -1376,6 +1354,7 @@ String *Item_func_right::val_str(String *str)
void Item_func_right::fix_length_and_dec()
{
agg_arg_charsets_for_string_result(collation, args, 1);
+ DBUG_ASSERT(collation.collation != NULL);
left_right_max_length();
}
@@ -1432,6 +1411,7 @@ void Item_func_substr::fix_length_and_dec()
max_length=args[0]->max_length;
agg_arg_charsets_for_string_result(collation, args, 1);
+ DBUG_ASSERT(collation.collation != NULL);
if (args[1]->const_item())
{
int32 start= (int32) args[1]->val_int();
@@ -1454,10 +1434,9 @@ void Item_func_substr::fix_length_and_dec()
void Item_func_substr_index::fix_length_and_dec()
{
- max_length= args[0]->max_length;
-
if (agg_arg_charsets_for_comparison(collation, args, 2))
return;
+ fix_char_length(args[0]->max_char_length());
}
@@ -1783,10 +1762,10 @@ String *Item_func_trim::val_str(String *str)
void Item_func_trim::fix_length_and_dec()
{
- max_length= args[0]->max_length;
if (arg_count == 1)
{
agg_arg_charsets_for_string_result(collation, args, 1);
+ DBUG_ASSERT(collation.collation != NULL);
remove.set_charset(collation.collation);
remove.set_ascii(" ",1);
}
@@ -1797,6 +1776,7 @@ void Item_func_trim::fix_length_and_dec()
if (agg_arg_charsets_for_comparison(collation, &args[1], 2, -1))
return;
}
+ fix_char_length(args[0]->max_char_length());
}
void Item_func_trim::print(String *str, enum_query_type query_type)
@@ -2072,9 +2052,11 @@ bool Item_func_current_user::fix_fields(THD *thd, Item **ref)
void Item_func_soundex::fix_length_and_dec()
{
+ uint32 char_length= args[0]->max_char_length();
agg_arg_charsets_for_string_result(collation, args, 1);
- max_length=args[0]->max_length;
- set_if_bigger(max_length, 4 * collation.collation->mbminlen);
+ DBUG_ASSERT(collation.collation != NULL);
+ set_if_bigger(char_length, 4);
+ fix_char_length(char_length);
tmp_value.set_charset(collation.collation);
}
@@ -2235,7 +2217,7 @@ const int FORMAT_MAX_DECIMALS= 30;
MY_LOCALE *Item_func_format::get_locale(Item *item)
{
DBUG_ASSERT(arg_count == 3);
- String tmp, *locale_name= args[2]->val_str(&tmp);
+ String tmp, *locale_name= args[2]->val_str_ascii(&tmp);
MY_LOCALE *lc;
if (!locale_name ||
!(lc= my_locale_by_name(locale_name->c_ptr_safe())))
@@ -2251,11 +2233,10 @@ MY_LOCALE *Item_func_format::get_locale(Item *item)
void Item_func_format::fix_length_and_dec()
{
- uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen;
- uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1;
+ uint32 char_length= args[0]->max_char_length();
+ uint32 max_sep_count= (char_length / 3) + (decimals ? 1 : 0) + /*sign*/1;
collation.set(default_charset());
- max_length= (char_length + max_sep_count + decimals) *
- collation.collation->mbmaxlen;
+ fix_char_length(char_length + max_sep_count + decimals);
if (arg_count == 3)
locale= args[2]->basic_const_item() ? get_locale(args[2]) : NULL;
else
@@ -2269,7 +2250,7 @@ void Item_func_format::fix_length_and_dec()
are stored in more than one byte
*/
-String *Item_func_format::val_str(String *str)
+String *Item_func_format::val_str_ascii(String *str)
{
uint32 str_length;
/* Number of decimal digits */
@@ -2309,8 +2290,7 @@ String *Item_func_format::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
nr= my_double_round(nr, (longlong) dec, FALSE, FALSE);
- /* Here default_charset() is right as this is not an automatic conversion */
- str->set_real(nr, dec, default_charset());
+ str->set_real(nr, dec, &my_charset_numeric);
if (isnan(nr))
return str;
str_length=str->length();
@@ -2360,6 +2340,14 @@ String *Item_func_format::val_str(String *str)
/* Put the rest of the integer part without grouping */
str->copy(dst, buf + sizeof(buf) - dst, &my_charset_latin1);
}
+ else if (dec_length && lc->decimal_point != '.')
+ {
+ /*
+ For short values without thousands (<1000)
+ replace decimal point to localized value.
+ */
+ ((char*) str->ptr())[str_length - dec_length]= lc->decimal_point;
+ }
return str;
}
@@ -2375,7 +2363,7 @@ void Item_func_format::print(String *str, enum_query_type query_type)
void Item_func_elt::fix_length_and_dec()
{
- max_length=0;
+ uint32 char_length= 0;
decimals=0;
if (agg_arg_charsets_for_string_result(collation, args + 1, arg_count - 1))
@@ -2383,9 +2371,10 @@ void Item_func_elt::fix_length_and_dec()
for (uint i= 1 ; i < arg_count ; i++)
{
- set_if_bigger(max_length,args[i]->max_length);
+ set_if_bigger(char_length, args[i]->max_char_length());
set_if_bigger(decimals,args[i]->decimals);
}
+ fix_char_length(char_length);
maybe_null=1; // NULL if wrong first arg
}
@@ -2443,14 +2432,14 @@ void Item_func_make_set::split_sum_func(THD *thd, Item **ref_pointer_array,
void Item_func_make_set::fix_length_and_dec()
{
- max_length=arg_count-1;
+ uint32 char_length= arg_count - 1; /* Separators */
if (agg_arg_charsets_for_string_result(collation, args, arg_count))
return;
for (uint i=0 ; i < arg_count ; i++)
- max_length+=args[i]->max_length;
-
+ char_length+= args[i]->max_char_length();
+ fix_char_length(char_length);
used_tables_cache|= item->used_tables();
not_null_tables_cache&= item->not_null_tables();
const_item_cache&= item->const_item();
@@ -2616,6 +2605,7 @@ inline String* alloc_buffer(String *res,String *str,String *tmp_value,
void Item_func_repeat::fix_length_and_dec()
{
agg_arg_charsets_for_string_result(collation, args, 1);
+ DBUG_ASSERT(collation.collation != NULL);
if (args[1]->const_item())
{
/* must be longlong to avoid truncation */
@@ -2626,13 +2616,8 @@ void Item_func_repeat::fix_length_and_dec()
if (count > INT_MAX32)
count= INT_MAX32;
- ulonglong max_result_length= (ulonglong) args[0]->max_length * count;
- if (max_result_length >= MAX_BLOB_WIDTH)
- {
- max_result_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- }
- max_length= (ulong) max_result_length;
+ ulonglong char_length= (ulonglong) args[0]->max_char_length() * count;
+ fix_char_length_ulonglong(char_length);
}
else
{
@@ -2703,26 +2688,13 @@ void Item_func_rpad::fix_length_and_dec()
return;
if (args[1]->const_item())
{
- ulonglong length= 0;
-
- if (collation.collation->mbmaxlen > 0)
- {
- ulonglong temp= (ulonglong) args[1]->val_int();
-
- /* Assumes that the maximum length of a String is < INT_MAX32. */
- /* Set here so that rest of code sees out-of-bound value as such. */
- if (temp > INT_MAX32)
- temp = INT_MAX32;
-
- length= temp * collation.collation->mbmaxlen;
- }
-
- if (length >= MAX_BLOB_WIDTH)
- {
- length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- }
- max_length= (ulong) length;
+ ulonglong char_length= (ulonglong) args[1]->val_int();
+ DBUG_ASSERT(collation.collation->mbmaxlen > 0);
+ /* Assumes that the maximum length of a String is < INT_MAX32. */
+ /* Set here so that rest of code sees out-of-bound value as such. */
+ if (char_length > INT_MAX32)
+ char_length= INT_MAX32;
+ fix_char_length_ulonglong(char_length);
}
else
{
@@ -2806,26 +2778,13 @@ void Item_func_lpad::fix_length_and_dec()
if (args[1]->const_item())
{
- ulonglong length= 0;
-
- if (collation.collation->mbmaxlen > 0)
- {
- ulonglong temp= (ulonglong) args[1]->val_int();
-
- /* Assumes that the maximum length of a String is < INT_MAX32. */
- /* Set here so that rest of code sees out-of-bound value as such. */
- if (temp > INT_MAX32)
- temp= INT_MAX32;
-
- length= temp * collation.collation->mbmaxlen;
- }
-
- if (length >= MAX_BLOB_WIDTH)
- {
- length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- }
- max_length= (ulong) length;
+ ulonglong char_length= (ulonglong) args[1]->val_int();
+ DBUG_ASSERT(collation.collation->mbmaxlen > 0);
+ /* Assumes that the maximum length of a String is < INT_MAX32. */
+ /* Set here so that rest of code sees out-of-bound value as such. */
+ if (char_length > INT_MAX32)
+ char_length= INT_MAX32;
+ fix_char_length_ulonglong(char_length);
}
else
{
@@ -3081,7 +3040,7 @@ String *Item_func_collation::val_str(String *str)
}
-String *Item_func_hex::val_str(String *str)
+String *Item_func_hex::val_str_ascii(String *str)
{
String *res;
DBUG_ASSERT(fixed == 1);
@@ -3120,6 +3079,7 @@ String *Item_func_hex::val_str(String *str)
}
null_value=0;
tmp_value.length(res->length()*2);
+ tmp_value.set_charset(&my_charset_latin1);
octet2hex((char*) tmp_value.ptr(), res->ptr(), res->length());
return &tmp_value;
@@ -3308,8 +3268,8 @@ String* Item_func_export_set::val_str(String* str)
void Item_func_export_set::fix_length_and_dec()
{
- uint length=max(args[1]->max_length,args[2]->max_length);
- uint sep_length=(arg_count > 3 ? args[3]->max_length : 1);
+ uint32 length= max(args[1]->max_char_length(), args[2]->max_char_length());
+ uint32 sep_length= (arg_count > 3 ? args[3]->max_char_length() : 1);
if (agg_arg_charsets_for_string_result(collation,
args + 1, min(4, arg_count) - 1))
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index df794ecaaf4..5dcef2e671f 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -539,17 +539,17 @@ public:
};
-class Item_func_format :public Item_str_func
+class Item_func_format :public Item_str_ascii_func
{
String tmp_str;
MY_LOCALE *locale;
public:
- Item_func_format(Item *org, Item *dec): Item_str_func(org, dec) {}
+ Item_func_format(Item *org, Item *dec): Item_str_ascii_func(org, dec) {}
Item_func_format(Item *org, Item *dec, Item *lang):
- Item_str_func(org, dec, lang) {}
+ Item_str_ascii_func(org, dec, lang) {}
MY_LOCALE *get_locale(Item *item);
- String *val_str(String *);
+ String *val_str_ascii(String *);
void fix_length_and_dec();
const char *func_name() const { return "format"; }
virtual void print(String *str, enum_query_type query_type);
@@ -622,18 +622,18 @@ public:
};
-class Item_func_hex :public Item_str_func
+class Item_func_hex :public Item_str_ascii_func
{
String tmp_value;
public:
- Item_func_hex(Item *a) :Item_str_func(a) {}
+ Item_func_hex(Item *a) :Item_str_ascii_func(a) {}
const char *func_name() const { return "hex"; }
- String *val_str(String *);
+ String *val_str_ascii(String *);
void fix_length_and_dec()
{
collation.set(default_charset());
decimals=0;
- max_length=args[0]->max_length*2*collation.collation->mbmaxlen;
+ fix_char_length(args[0]->max_length * 2);
}
};
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index b05d845dead..b6e5d6d3182 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -434,26 +434,6 @@ void Item_sum::mark_as_sum_func()
}
-void Item_sum::make_field(Send_field *tmp_field)
-{
- if (args[0]->type() == Item::FIELD_ITEM && keep_field_type())
- {
- ((Item_field*) args[0])->field->make_field(tmp_field);
- /* For expressions only col_name should be non-empty string. */
- char *empty_string= (char*)"";
- tmp_field->db_name= empty_string;
- tmp_field->org_table_name= empty_string;
- tmp_field->table_name= empty_string;
- tmp_field->org_col_name= empty_string;
- tmp_field->col_name= name;
- if (maybe_null)
- tmp_field->flags&= ~NOT_NULL_FLAG;
- }
- else
- init_make_field(tmp_field, field_type());
-}
-
-
void Item_sum::print(String *str, enum_query_type query_type)
{
/* orig_args is not filled with valid values until fix_fields() */
@@ -984,7 +964,8 @@ bool Aggregator_distinct::add()
{
int error;
copy_fields(tmp_table_param);
- copy_funcs(tmp_table_param->items_to_copy);
+ if (copy_funcs(tmp_table_param->items_to_copy, table->in_use))
+ return TRUE;
for (Field **field=table->field ; *field ; field++)
if ((*field)->is_real_null(0))
@@ -3058,7 +3039,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
tree(item->tree),
unique_filter(item->unique_filter),
table(item->table),
- order(item->order),
context(item->context),
arg_count_order(item->arg_count_order),
arg_count_field(item->arg_count_field),
@@ -3071,6 +3051,24 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
{
quick_group= item->quick_group;
result.set_charset(collation.collation);
+
+ /*
+ Since the ORDER structures pointed to by the elements of the 'order' array
+ may be modified in find_order_in_list() called from
+ Item_func_group_concat::setup(), create a copy of those structures so that
+ such modifications done in this object would not have any effect on the
+ object being copied.
+ */
+ ORDER *tmp;
+ if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order +
+ sizeof(ORDER) * arg_count_order)))
+ return;
+ tmp= (ORDER *)(order + arg_count_order);
+ for (uint i= 0; i < arg_count_order; i++, tmp++)
+ {
+ memcpy(tmp, item->order[i], sizeof(ORDER));
+ order[i]= tmp;
+ }
}
@@ -3136,7 +3134,8 @@ bool Item_func_group_concat::add()
if (always_null)
return 0;
copy_fields(tmp_table_param);
- copy_funcs(tmp_table_param->items_to_copy);
+ if (copy_funcs(tmp_table_param->items_to_copy, table->in_use))
+ return TRUE;
for (uint i= 0; i < arg_count_field; i++)
{
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 2a722b93165..06a8c2c58a4 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -427,7 +427,6 @@ public:
forced_const= TRUE;
}
virtual bool const_item() const { return forced_const; }
- void make_field(Send_field *field);
virtual void print(String *str, enum_query_type query_type);
void fix_num_length_and_dec();
diff --git a/sql/lock.cc b/sql/lock.cc
index 1a77b576e67..0181a544824 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -1298,27 +1298,19 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd)
/**
- Broadcast COND_refresh and COND_global_read_lock.
-
- Due to a bug in a threading library it could happen that a signal
- did not reach its target. A condition for this was that the same
- condition variable was used with different mutexes in
- mysql_cond_wait(). Some time ago we changed LOCK_open to
- LOCK_global_read_lock in global read lock handling. So COND_refresh
- was used with LOCK_open and LOCK_global_read_lock.
-
- We did now also change from COND_refresh to COND_global_read_lock
- in global read lock handling. But now it is necessary to signal
- both conditions at the same time.
-
- @note
- When signalling COND_global_read_lock within the global read lock
- handling, it is not necessary to also signal COND_refresh.
+ Broadcast COND_global_read_lock.
+
+ TODO/FIXME: Dmitry thinks that we broadcast on COND_global_read_lock
+ when old instance of table is closed to avoid races
+ between incrementing refresh_version and
+ wait_if_global_read_lock(thd, TRUE, FALSE) call.
+ Once global read lock implementation starts using MDL
+ infrastructure this will became unnecessary and should
+ be removed.
*/
void broadcast_refresh(void)
{
- mysql_cond_broadcast(&COND_refresh);
mysql_cond_broadcast(&COND_global_read_lock);
}
diff --git a/sql/lock.h b/sql/lock.h
index 0083dd3ba18..c097c8d269e 100644
--- a/sql/lock.h
+++ b/sql/lock.h
@@ -9,48 +9,6 @@ struct TABLE_LIST;
class THD;
typedef struct st_mysql_lock MYSQL_LOCK;
-/* mysql_lock_tables() and open_table() flags bits */
-#define MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK 0x0001
-#define MYSQL_OPEN_IGNORE_FLUSH 0x0002
-#define MYSQL_OPEN_TEMPORARY_ONLY 0x0004
-#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008
-#define MYSQL_LOCK_LOG_TABLE 0x0010
-/**
- Do not try to acquire a metadata lock on the table: we
- already have one.
-*/
-#define MYSQL_OPEN_HAS_MDL_LOCK 0x0020
-/**
- If in locked tables mode, ignore the locked tables and get
- a new instance of the table.
-*/
-#define MYSQL_OPEN_GET_NEW_TABLE 0x0040
-/** Don't look up the table in the list of temporary tables. */
-#define MYSQL_OPEN_SKIP_TEMPORARY 0x0080
-/** Fail instead of waiting when conficting metadata lock is discovered. */
-#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0100
-/** Open tables using MDL_SHARED lock instead of one specified in parser. */
-#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0200
-/**
- Open tables using MDL_SHARED_HIGH_PRIO lock instead of one specified
- in parser.
-*/
-#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0400
-/**
- When opening or locking the table, use the maximum timeout
- (LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value.
-*/
-#define MYSQL_LOCK_IGNORE_TIMEOUT 0x0800
-
-/** Please refer to the internals manual. */
-#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
- MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |\
- MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |\
- MYSQL_LOCK_IGNORE_TIMEOUT |\
- MYSQL_OPEN_GET_NEW_TABLE |\
- MYSQL_OPEN_SKIP_TEMPORARY |\
- MYSQL_OPEN_HAS_MDL_LOCK)
-
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags);
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
diff --git a/sql/log.cc b/sql/log.cc
index 86f8100be07..88352706318 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -4272,7 +4272,7 @@ bool use_trans_cache(const THD* thd, bool is_transactional)
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
return
- ((thd->variables.binlog_format != BINLOG_FORMAT_STMT ||
+ ((thd->is_current_stmt_binlog_format_row() ||
thd->variables.binlog_direct_non_trans_update) ? is_transactional :
(is_transactional || !cache_mngr->trx_cache.empty()));
}
@@ -5447,70 +5447,93 @@ void sql_perror(const char *message)
}
+#ifdef __WIN__
+extern "C" my_bool reopen_fstreams(const char *filename,
+ FILE *outstream, FILE *errstream)
+{
+ int handle_fd;
+ int stream_fd;
+ HANDLE osfh;
+
+ DBUG_ASSERT(filename && (outstream || errstream));
+
+ if ((osfh= CreateFile(filename, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE |
+ FILE_SHARE_DELETE, NULL,
+ OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
+ NULL)) == INVALID_HANDLE_VALUE)
+ return TRUE;
+
+ if ((handle_fd= _open_osfhandle((intptr_t)osfh,
+ _O_APPEND | _O_TEXT)) == -1)
+ {
+ CloseHandle(osfh);
+ return TRUE;
+ }
+
+ if (outstream)
+ {
+ stream_fd= _fileno(outstream);
+ if (_dup2(handle_fd, stream_fd) < 0)
+ {
+ CloseHandle(osfh);
+ return TRUE;
+ }
+ }
+
+ if (errstream)
+ {
+ stream_fd= _fileno(errstream);
+ if (_dup2(handle_fd, stream_fd) < 0)
+ {
+ CloseHandle(osfh);
+ return TRUE;
+ }
+ }
+
+ _close(handle_fd);
+ return FALSE;
+}
+#else
+extern "C" my_bool reopen_fstreams(const char *filename,
+ FILE *outstream, FILE *errstream)
+{
+ if (outstream && !freopen(filename, "a+", outstream))
+ return TRUE;
+
+ if (errstream && !freopen(filename, "a+", errstream))
+ return TRUE;
+
+ return FALSE;
+}
+#endif
+
+
/*
Unfortunately, there seems to be no good way
to restore the original streams upon failure.
*/
static bool redirect_std_streams(const char *file)
{
- if (freopen(file, "a+", stdout) && freopen(file, "a+", stderr))
- {
- setbuf(stderr, NULL);
- return FALSE;
- }
+ if (reopen_fstreams(file, stdout, stderr))
+ return TRUE;
- return TRUE;
+ setbuf(stderr, NULL);
+ return FALSE;
}
bool flush_error_log()
{
- bool result=0;
+ bool result= 0;
if (opt_error_log)
{
- char err_renamed[FN_REFLEN], *end;
- end= strmake(err_renamed,log_error_file,FN_REFLEN-5);
- strmov(end, "-old");
mysql_mutex_lock(&LOCK_error_log);
-#ifdef __WIN__
- char err_temp[FN_REFLEN+5];
- /*
- On Windows is necessary a temporary file for to rename
- the current error file.
- */
- strxmov(err_temp, err_renamed,"-tmp",NullS);
- my_delete(err_temp, MYF(0));
- if (freopen(err_temp,"a+",stdout))
- {
- int fd;
- size_t bytes;
- uchar buf[IO_SIZE];
-
- freopen(err_temp,"a+",stderr);
- setbuf(stderr, NULL);
- my_delete(err_renamed, MYF(0));
- my_rename(log_error_file, err_renamed, MYF(0));
- redirect_std_streams(log_error_file);
-
- if ((fd= my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
- {
- while ((bytes= mysql_file_read(fd, buf, IO_SIZE, MYF(0))) &&
- bytes != MY_FILE_ERROR)
- my_fwrite(stderr, buf, bytes, MYF(0));
- mysql_file_close(fd, MYF(0));
- }
- my_delete(err_temp, MYF(0));
- }
- else
- result= 1;
-#else
- my_rename(log_error_file, err_renamed, MYF(0));
- if (redirect_std_streams(log_error_file))
- result= 1;
-#endif
+ if (redirect_std_streams(log_error_file))
+ result= 1;
mysql_mutex_unlock(&LOCK_error_log);
}
- return result;
+ return result;
}
void MYSQL_BIN_LOG::signal_update()
diff --git a/sql/log.h b/sql/log.h
index 6e87b6cbade..ebb23deda81 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -394,10 +394,10 @@ public:
/* Use this to start writing a new log file */
void new_file();
- bool write(Log_event* event_info);
+ bool write(Log_event* event_info); // binary log write
bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
- bool write_incident(THD *thd, bool lock);
+ bool write_incident(THD *thd, bool lock);
int write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
void set_write_error(THD *thd);
bool check_write_error(THD *thd);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index d224f555cf2..16290c58685 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -674,15 +674,16 @@ const char* Log_event::get_type_str()
#ifndef MYSQL_CLIENT
Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
- :log_pos(0), temp_buf(0), exec_time(0), flags(flags_arg), thd(thd_arg)
+ :log_pos(0), temp_buf(0), exec_time(0), flags(flags_arg),
+ cache_type(Log_event::EVENT_INVALID_CACHE), thd(thd_arg)
{
server_id= thd->server_id;
when= thd->start_time;
- cache_type= ((using_trans || stmt_has_updated_trans_table(thd) ||
- (thd->lex->stmt_accessed_temp_table() &&
- trans_has_updated_trans_table(thd)))
- ? Log_event::EVENT_TRANSACTIONAL_CACHE :
- Log_event::EVENT_STMT_CACHE);
+
+ if (using_trans)
+ cache_type= Log_event::EVENT_TRANSACTIONAL_CACHE;
+ else
+ cache_type= Log_event::EVENT_STMT_CACHE;
}
/**
@@ -2520,21 +2521,18 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
LEX *lex= thd->lex;
/*
- TRUE defines that either a trx-cache or stmt-cache must be used
- and wrapped by a BEGIN...COMMIT. Otherwise, the statement will
- be written directly to the binary log without being wrapped by
- a BEGIN...COMMIT.
+ Defines that the statement will be written directly to the binary log
+ without being wrapped by a BEGIN...COMMIT. Otherwise, the statement
+ will be written to either the trx-cache or stmt-cache.
- Note that a cache will not be used if the parameter direct is
- TRUE.
+ Note that a cache will not be used if the parameter direct is TRUE.
*/
bool use_cache= FALSE;
/*
- TRUE defines that the trx-cache must be used and by consequence
- the use_cache is TRUE.
+ TRUE defines that the trx-cache must be used and by consequence the
+ use_cache is TRUE.
- Note that a cache will not be used if the parameter direct is
- TRUE.
+ Note that a cache will not be used if the parameter direct is TRUE.
*/
bool trx_cache= FALSE;
cache_type= Log_event::EVENT_INVALID_CACHE;
@@ -2542,16 +2540,14 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
switch (lex->sql_command)
{
case SQLCOM_DROP_TABLE:
- use_cache= trx_cache= (lex->drop_temporary &&
- thd->in_multi_stmt_transaction_mode());
+ use_cache= (lex->drop_temporary && thd->in_multi_stmt_transaction_mode());
break;
case SQLCOM_CREATE_TABLE:
- use_cache= trx_cache=
- ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
- thd->in_multi_stmt_transaction_mode()) ||
- (lex->select_lex.item_list.elements &&
+ trx_cache= (lex->select_lex.item_list.elements &&
thd->is_current_stmt_binlog_format_row());
+ use_cache= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
+ thd->in_multi_stmt_transaction_mode()) || trx_cache;
break;
case SQLCOM_SET_OPTION:
use_cache= trx_cache= (lex->autocommit ? FALSE : TRUE);
@@ -2570,14 +2566,14 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
{
cache_type= Log_event::EVENT_NO_CACHE;
}
+ else if (using_trans || trx_cache || stmt_has_updated_trans_table(thd) ||
+ thd->lex->is_mixed_stmt_unsafe(thd->in_multi_stmt_transaction_mode(),
+ thd->variables.binlog_direct_non_trans_update,
+ trans_has_updated_trans_table(thd),
+ thd->tx_isolation))
+ cache_type= Log_event::EVENT_TRANSACTIONAL_CACHE;
else
- {
- cache_type= ((using_trans || stmt_has_updated_trans_table(thd) || trx_cache ||
- (thd->lex->stmt_accessed_temp_table() &&
- trans_has_updated_trans_table(thd)))
- ? Log_event::EVENT_TRANSACTIONAL_CACHE :
- Log_event::EVENT_STMT_CACHE);
- }
+ cache_type= Log_event::EVENT_STMT_CACHE;
DBUG_ASSERT(cache_type != Log_event::EVENT_INVALID_CACHE);
DBUG_PRINT("info",("Query_log_event has flags2: %lu sql_mode: %lu",
(ulong) flags2, sql_mode));
diff --git a/sql/mdl.cc b/sql/mdl.cc
index ca66799baed..aa7c2a4b7f2 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -71,6 +71,21 @@ static void init_mdl_psi_keys(void)
void notify_shared_lock(THD *thd, MDL_ticket *conflicting_ticket);
+/**
+ Thread state names to be used in case when we have to wait on resource
+ belonging to certain namespace.
+*/
+
+const char *MDL_key::m_namespace_to_wait_state_name[NAMESPACE_END]=
+{
+ "Waiting for global metadata lock",
+ "Waiting for schema metadata lock",
+ "Waiting for table metadata lock",
+ "Waiting for stored function metadata lock",
+ "Waiting for stored procedure metadata lock",
+ NULL
+};
+
static bool mdl_initialized= 0;
@@ -98,38 +113,33 @@ private:
};
-enum enum_deadlock_weight
-{
- MDL_DEADLOCK_WEIGHT_DML= 0,
- MDL_DEADLOCK_WEIGHT_DDL= 100
-};
-
-
/**
A context of the recursive traversal through all contexts
in all sessions in search for deadlock.
*/
-class Deadlock_detection_visitor
+class Deadlock_detection_visitor: public MDL_wait_for_graph_visitor
{
public:
Deadlock_detection_visitor(MDL_context *start_node_arg)
: m_start_node(start_node_arg),
m_victim(NULL),
- m_current_search_depth(0)
+ m_found_deadlock(FALSE)
{}
- bool enter_node(MDL_context * /* unused */);
- void leave_node(MDL_context * /* unused */);
+ virtual bool enter_node(MDL_context *node);
+ virtual void leave_node(MDL_context *node);
- bool inspect_edge(MDL_context *dest);
+ virtual bool inspect_edge(MDL_context *dest);
MDL_context *get_victim() const { return m_victim; }
+ void abort_traversal(MDL_context *node);
+private:
/**
Change the deadlock victim to a new one if it has lower deadlock
weight.
*/
- MDL_context *opt_change_victim_to(MDL_context *new_victim);
+ void opt_change_victim_to(MDL_context *new_victim);
private:
/**
The context which has initiated the search. There
@@ -138,13 +148,8 @@ private:
MDL_context *m_start_node;
/** If a deadlock is found, the context that identifies the victim. */
MDL_context *m_victim;
- /** Set to the 0 at start. Increased whenever
- we descend into another MDL context (aka traverse to the next
- wait-for graph node). When MAX_SEARCH_DEPTH is reached, we
- assume that a deadlock is found, even if we have not found a
- loop.
- */
- uint m_current_search_depth;
+ /** TRUE if we found a deadlock. */
+ bool m_found_deadlock;
/**
Maximum depth for deadlock searches. After this depth is
achieved we will unconditionally declare that there is a
@@ -167,29 +172,37 @@ private:
a node is entered, inspect_edge() will be called
for all wait-for destinations of this node. Then
leave_node() will be called.
- We call "enter_node()" for all nodes we inspect,
+ We call "enter_node()" for all nodes we inspect,
including the starting node.
@retval TRUE Maximum search depth exceeded.
@retval FALSE OK.
*/
-bool Deadlock_detection_visitor::enter_node(MDL_context * /* unused */)
+bool Deadlock_detection_visitor::enter_node(MDL_context *node)
{
- if (++m_current_search_depth >= MAX_SEARCH_DEPTH)
- return TRUE;
- return FALSE;
+ m_found_deadlock= m_current_search_depth >= MAX_SEARCH_DEPTH;
+ if (m_found_deadlock)
+ {
+ DBUG_ASSERT(! m_victim);
+ opt_change_victim_to(node);
+ }
+ return m_found_deadlock;
}
/**
Done inspecting this node. Decrease the search
- depth. Clear the node for debug safety.
+ depth. If a deadlock is found, and we are
+ backtracking to the start node, optionally
+ change the deadlock victim to one with lower
+ deadlock weight.
*/
-void Deadlock_detection_visitor::leave_node(MDL_context * /* unused */)
+void Deadlock_detection_visitor::leave_node(MDL_context *node)
{
- --m_current_search_depth;
+ if (m_found_deadlock)
+ opt_change_victim_to(node);
}
@@ -202,7 +215,8 @@ void Deadlock_detection_visitor::leave_node(MDL_context * /* unused */)
bool Deadlock_detection_visitor::inspect_edge(MDL_context *node)
{
- return node == m_start_node;
+ m_found_deadlock= node == m_start_node;
+ return m_found_deadlock;
}
@@ -214,7 +228,7 @@ bool Deadlock_detection_visitor::inspect_edge(MDL_context *node)
@retval !new_victim New victim became the current.
*/
-MDL_context *
+void
Deadlock_detection_visitor::opt_change_victim_to(MDL_context *new_victim)
{
if (m_victim == NULL ||
@@ -223,10 +237,25 @@ Deadlock_detection_visitor::opt_change_victim_to(MDL_context *new_victim)
/* Swap victims, unlock the old one. */
MDL_context *tmp= m_victim;
m_victim= new_victim;
- return tmp;
+ m_victim->lock_deadlock_victim();
+ if (tmp)
+ tmp->unlock_deadlock_victim();
}
- /* No change, unlock the current context. */
- return new_victim;
+}
+
+
+/**
+ Abort traversal of a wait-for graph and report a deadlock.
+
+ @param node Node which we were about to visit when abort
+ was initiated.
+*/
+
+void Deadlock_detection_visitor::abort_traversal(MDL_context *node)
+{
+ DBUG_ASSERT(! m_victim);
+ m_found_deadlock= TRUE;
+ opt_change_victim_to(node);
}
@@ -349,8 +378,8 @@ public:
void remove_ticket(Ticket_list MDL_lock::*queue, MDL_ticket *ticket);
- bool find_deadlock(MDL_ticket *waiting_ticket,
- Deadlock_detection_visitor *dvisitor);
+ bool visit_subgraph(MDL_ticket *waiting_ticket,
+ MDL_wait_for_graph_visitor *gvisitor);
/** List of granted tickets for this lock. */
Ticket_list m_granted;
@@ -479,14 +508,6 @@ mdl_locks_key(const uchar *record, size_t *length,
the associated condition variable: LOCK_mdl and COND_mdl.
These locking primitives are implementation details of the MDL
subsystem and are private to it.
-
- Note, that even though the new implementation adds acquisition
- of a new global mutex to the execution flow of almost every SQL
- statement, the design capitalizes on that to later save on
- look ups in the table definition cache. This leads to reduced
- contention overall and on LOCK_open in particular.
- Please see the description of MDL_context::acquire_lock()
- for details.
*/
void mdl_init()
@@ -876,8 +897,8 @@ void MDL_ticket::destroy(MDL_ticket *ticket)
uint MDL_ticket::get_deadlock_weight() const
{
return (m_lock->key.mdl_namespace() == MDL_key::GLOBAL ||
- m_type > MDL_SHARED_NO_WRITE ?
- MDL_DEADLOCK_WEIGHT_DDL : MDL_DEADLOCK_WEIGHT_DML);
+ m_type >= MDL_SHARED_NO_WRITE ?
+ DEADLOCK_WEIGHT_DDL : DEADLOCK_WEIGHT_DML);
}
@@ -946,17 +967,18 @@ void MDL_wait::reset_status()
Wait for the status to be assigned to this wait slot.
@param abs_timeout Absolute time after which waiting should stop.
- @param set_status_on_tiemout TRUE - If in case of timeout waiting
- context should close the wait slot by
- sending TIMEOUT to itself.
- FALSE - Otherwise.
+ @param set_status_on_timeout TRUE - If in case of timeout waiting
+ context should close the wait slot by
+ sending TIMEOUT to itself.
+ FALSE - Otherwise.
+ @param wait_state_name Thread state name to be set for duration of wait.
@returns Signal posted.
*/
MDL_wait::enum_wait_status
MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
- bool set_status_on_timeout)
+ bool set_status_on_timeout, const char *wait_state_name)
{
const char *old_msg;
enum_wait_status result;
@@ -965,7 +987,7 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
mysql_mutex_lock(&m_LOCK_wait_status);
old_msg= thd_enter_cond(thd, &m_COND_wait_status, &m_LOCK_wait_status,
- "Waiting for table");
+ wait_state_name);
while (!m_wait_status && !thd_killed(thd) &&
wait_result != ETIMEDOUT && wait_result != ETIME)
@@ -1380,6 +1402,15 @@ bool MDL_lock::has_pending_conflicting_lock(enum_mdl_type type)
}
+MDL_wait_for_graph_visitor::~MDL_wait_for_graph_visitor()
+{
+}
+
+
+MDL_wait_for_subgraph::~MDL_wait_for_subgraph()
+{
+}
+
/**
Check if ticket represents metadata lock of "stronger" or equal type
than specified one. I.e. if metadata lock represented by ticket won't
@@ -1528,9 +1559,8 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
MDL_ticket *ticket;
bool is_transactional;
- DBUG_ASSERT(mdl_request->type < MDL_SHARED_NO_WRITE ||
- (is_lock_owner(MDL_key::GLOBAL, "", "",
- MDL_INTENTION_EXCLUSIVE)));
+ DBUG_ASSERT(mdl_request->type != MDL_EXCLUSIVE ||
+ is_lock_owner(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE));
DBUG_ASSERT(mdl_request->ticket == NULL);
/* Don't take chances in production. */
@@ -1746,7 +1776,8 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
while (cmp_timespec(abs_shortwait, abs_timeout) <= 0)
{
/* abs_timeout is far away. Wait a short while and notify locks. */
- wait_status= m_wait.timed_wait(m_thd, &abs_shortwait, FALSE);
+ wait_status= m_wait.timed_wait(m_thd, &abs_shortwait, FALSE,
+ mdl_request->key.get_wait_state_name());
if (wait_status != MDL_wait::EMPTY)
break;
@@ -1757,10 +1788,12 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
set_timespec(abs_shortwait, 1);
}
if (wait_status == MDL_wait::EMPTY)
- wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE);
+ wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE,
+ mdl_request->key.get_wait_state_name());
}
else
- wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE);
+ wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE,
+ mdl_request->key.get_wait_state_name());
done_waiting_for();
@@ -1952,8 +1985,17 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
}
-bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
- Deadlock_detection_visitor *dvisitor)
+/**
+ A fragment of recursive traversal of the wait-for graph
+ in search for deadlocks. Direct the deadlock visitor to all
+ contexts that own the lock the current node in the wait-for
+ graph is waiting for.
+ As long as the initial node is remembered in the visitor,
+ a deadlock is found when the same node is seen twice.
+*/
+
+bool MDL_lock::visit_subgraph(MDL_ticket *waiting_ticket,
+ MDL_wait_for_graph_visitor *gvisitor)
{
MDL_ticket *ticket;
MDL_context *src_ctx= waiting_ticket->get_ctx();
@@ -2022,8 +2064,13 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
are visiting it but this is OK: in the worst case we might do some
extra work and one more context might be chosen as a victim.
*/
- if (dvisitor->enter_node(src_ctx))
+ ++gvisitor->m_current_search_depth;
+
+ if (gvisitor->enter_node(src_ctx))
+ {
+ --gvisitor->m_current_search_depth;
goto end;
+ }
/*
We do a breadth-first search first -- that is, inspect all
@@ -2036,7 +2083,7 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
/* Filter out edges that point to the same node. */
if (ticket->get_ctx() != src_ctx &&
ticket->is_incompatible_when_granted(waiting_ticket->get_type()) &&
- dvisitor->inspect_edge(ticket->get_ctx()))
+ gvisitor->inspect_edge(ticket->get_ctx()))
{
goto end_leave_node;
}
@@ -2047,7 +2094,7 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
/* Filter out edges that point to the same node. */
if (ticket->get_ctx() != src_ctx &&
ticket->is_incompatible_when_waiting(waiting_ticket->get_type()) &&
- dvisitor->inspect_edge(ticket->get_ctx()))
+ gvisitor->inspect_edge(ticket->get_ctx()))
{
goto end_leave_node;
}
@@ -2059,7 +2106,7 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
{
if (ticket->get_ctx() != src_ctx &&
ticket->is_incompatible_when_granted(waiting_ticket->get_type()) &&
- ticket->get_ctx()->find_deadlock(dvisitor))
+ ticket->get_ctx()->visit_subgraph(gvisitor))
{
goto end_leave_node;
}
@@ -2070,7 +2117,7 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
{
if (ticket->get_ctx() != src_ctx &&
ticket->is_incompatible_when_waiting(waiting_ticket->get_type()) &&
- ticket->get_ctx()->find_deadlock(dvisitor))
+ ticket->get_ctx()->visit_subgraph(gvisitor))
{
goto end_leave_node;
}
@@ -2079,7 +2126,8 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
result= FALSE;
end_leave_node:
- dvisitor->leave_node(src_ctx);
+ gvisitor->leave_node(src_ctx);
+ --gvisitor->m_current_search_depth;
end:
mysql_prlock_unlock(&m_rwlock);
@@ -2088,35 +2136,47 @@ end:
/**
- Recursively traverse the wait-for graph of MDL contexts
- in search for deadlocks.
+ Traverse a portion of wait-for graph which is reachable
+ through the edge represented by this ticket and search
+ for deadlocks.
+
+ @retval TRUE A deadlock is found. A pointer to deadlock
+ victim is saved in the visitor.
+ @retval FALSE
+*/
+
+bool MDL_ticket::accept_visitor(MDL_wait_for_graph_visitor *gvisitor)
+{
+ return m_lock->visit_subgraph(this, gvisitor);
+}
+
+
+/**
+ A fragment of recursive traversal of the wait-for graph of
+ MDL contexts in the server in search for deadlocks.
+ Assume this MDL context is a node in the wait-for graph,
+ and direct the visitor to all adjacent nodes. As long
+ as the starting node is remembered in the visitor, a
+ deadlock is found when the same node is visited twice.
+ One MDL context is connected to another in the wait-for
+ graph if it waits on a resource that is held by the other
+ context.
- @retval TRUE A deadlock is found. A victim is remembered
- by the visitor.
+ @retval TRUE A deadlock is found. A pointer to deadlock
+ victim is saved in the visitor.
@retval FALSE
*/
-bool MDL_context::find_deadlock(Deadlock_detection_visitor *dvisitor)
+bool MDL_context::visit_subgraph(MDL_wait_for_graph_visitor *gvisitor)
{
- MDL_context *m_unlock_ctx= this;
bool result= FALSE;
mysql_prlock_rdlock(&m_LOCK_waiting_for);
if (m_waiting_for)
- {
- result= m_waiting_for->m_lock->find_deadlock(m_waiting_for, dvisitor);
- if (result)
- m_unlock_ctx= dvisitor->opt_change_victim_to(this);
- }
- /*
- We may recurse into the same MDL_context more than once
- in case this is not the starting node. Make sure we release the
- read lock as it's been taken, except for 1 read lock for
- the deadlock victim.
- */
- if (m_unlock_ctx)
- mysql_prlock_unlock(&m_unlock_ctx->m_LOCK_waiting_for);
+ result= m_waiting_for->accept_visitor(gvisitor);
+
+ mysql_prlock_unlock(&m_LOCK_waiting_for);
return result;
}
@@ -2138,14 +2198,14 @@ void MDL_context::find_deadlock()
while (1)
{
/*
- The fact that we use fresh instance of dvisitor for each
+ The fact that we use fresh instance of gvisitor for each
search performed by find_deadlock() below is important,
the code responsible for victim selection relies on this.
*/
Deadlock_detection_visitor dvisitor(this);
MDL_context *victim;
- if (! find_deadlock(&dvisitor))
+ if (! visit_subgraph(&dvisitor))
{
/* No deadlocks are found! */
break;
@@ -2166,7 +2226,7 @@ void MDL_context::find_deadlock()
context was waiting is concurrently satisfied.
*/
(void) victim->m_wait.set_status(MDL_wait::VICTIM);
- mysql_prlock_unlock(&victim->m_LOCK_waiting_for);
+ victim->unlock_deadlock_victim();
if (victim == this)
break;
diff --git a/sql/mdl.h b/sql/mdl.h
index c8acd69c0f1..e1d4cf74dd6 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -34,7 +34,6 @@ class THD;
class MDL_context;
class MDL_lock;
class MDL_ticket;
-class Deadlock_detection_visitor;
/**
Type of metadata lock request.
@@ -184,7 +183,9 @@ public:
TABLE,
FUNCTION,
PROCEDURE,
- TRIGGER };
+ TRIGGER,
+ /* This should be the last ! */
+ NAMESPACE_END };
const uchar *ptr() const { return (uchar*) m_ptr; }
uint length() const { return m_length; }
@@ -251,10 +252,20 @@ public:
}
MDL_key() {} /* To use when part of MDL_request. */
+ /**
+ Get thread state name to be used in case when we have to
+ wait on resource identified by key.
+ */
+ const char * get_wait_state_name() const
+ {
+ return m_namespace_to_wait_state_name[(int)mdl_namespace()];
+ }
+
private:
uint16 m_length;
uint16 m_db_name_length;
char m_ptr[MAX_MDLKEY_LENGTH];
+ static const char * m_namespace_to_wait_state_name[NAMESPACE_END];
private:
MDL_key(const MDL_key &); /* not implemented */
MDL_key &operator=(const MDL_key &); /* not implemented */
@@ -360,6 +371,73 @@ public:
typedef void (*mdl_cached_object_release_hook)(void *);
+
+/**
+ An abstract class for inspection of a connected
+ subgraph of the wait-for graph.
+*/
+
+class MDL_wait_for_graph_visitor
+{
+public:
+ virtual bool enter_node(MDL_context *node) = 0;
+ virtual void leave_node(MDL_context *node) = 0;
+
+ virtual bool inspect_edge(MDL_context *dest) = 0;
+ virtual ~MDL_wait_for_graph_visitor();
+ MDL_wait_for_graph_visitor() :m_lock_open_count(0),
+ m_current_search_depth(0)
+ { }
+ virtual void abort_traversal(MDL_context *node) = 0;
+public:
+ /**
+ XXX, hack: During deadlock search, we may need to
+ inspect TABLE_SHAREs and acquire LOCK_open. Since
+ LOCK_open is not a recursive mutex, count here how many
+ times we "took" it (but only take and release once).
+ Not using a native recursive mutex or rwlock in 5.5 for
+ LOCK_open since it has significant performance impacts.
+ */
+ uint m_lock_open_count;
+ /**
+ Set to the 0 at start. Increased whenever
+ we descend into another MDL context (aka traverse to the next
+ wait-for graph node). When MAX_SEARCH_DEPTH is reached, we
+ assume that a deadlock is found, even if we have not found a
+ loop.
+
+ XXX: This member belongs to this class only temporarily until
+ bug #56405 is fixed.
+ */
+ uint m_current_search_depth;
+};
+
+/**
+ Abstract class representing an edge in the waiters graph
+ to be traversed by deadlock detection algorithm.
+*/
+
+class MDL_wait_for_subgraph
+{
+public:
+ virtual ~MDL_wait_for_subgraph();
+
+ /**
+ Accept a wait-for graph visitor to inspect the node
+ this edge is leading to.
+ */
+ virtual bool accept_visitor(MDL_wait_for_graph_visitor *gvisitor) = 0;
+
+ enum enum_deadlock_weight
+ {
+ DEADLOCK_WEIGHT_DML= 0,
+ DEADLOCK_WEIGHT_DDL= 100
+ };
+ /* A helper used to determine which lock request should be aborted. */
+ virtual uint get_deadlock_weight() const = 0;
+};
+
+
/**
A granted metadata lock.
@@ -380,7 +458,7 @@ typedef void (*mdl_cached_object_release_hook)(void *);
threads/contexts.
*/
-class MDL_ticket
+class MDL_ticket : public MDL_wait_for_subgraph
{
public:
/**
@@ -414,8 +492,9 @@ public:
bool is_incompatible_when_granted(enum_mdl_type type) const;
bool is_incompatible_when_waiting(enum_mdl_type type) const;
- /* A helper used to determine which lock request should be aborted. */
- uint get_deadlock_weight() const;
+ /** Implement MDL_wait_for_subgraph interface. */
+ virtual bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor);
+ virtual uint get_deadlock_weight() const;
private:
friend class MDL_context;
@@ -462,7 +541,7 @@ public:
enum_wait_status get_status();
void reset_status();
enum_wait_status timed_wait(THD *thd, struct timespec *abs_timeout,
- bool signal_timeout);
+ bool signal_timeout, const char *wait_state_name);
private:
/**
Condvar which is used for waiting until this context's pending
@@ -582,8 +661,6 @@ public:
{
return m_needs_thr_lock_abort;
}
-
- bool find_deadlock(Deadlock_detection_visitor *dvisitor);
public:
/**
If our request for a lock is scheduled, or aborted by the deadlock
@@ -675,12 +752,13 @@ private:
*/
mysql_prlock_t m_LOCK_waiting_for;
/**
- Tell the deadlock detector what lock this session is waiting for.
+ Tell the deadlock detector what metadata lock or table
+ definition cache entry this session is waiting for.
In principle, this is redundant, as information can be found
by inspecting waiting queues, but we'd very much like it to be
readily available to the wait-for graph iterator.
*/
- MDL_ticket *m_waiting_for;
+ MDL_wait_for_subgraph *m_waiting_for;
private:
MDL_ticket *find_ticket(MDL_request *mdl_req,
bool *is_transactional);
@@ -688,13 +766,16 @@ private:
bool try_acquire_lock_impl(MDL_request *mdl_request,
MDL_ticket **out_ticket);
+public:
void find_deadlock();
+ bool visit_subgraph(MDL_wait_for_graph_visitor *dvisitor);
+
/** Inform the deadlock detector there is an edge in the wait-for graph. */
- void will_wait_for(MDL_ticket *pending_ticket)
+ void will_wait_for(MDL_wait_for_subgraph *waiting_for_arg)
{
mysql_prlock_wrlock(&m_LOCK_waiting_for);
- m_waiting_for= pending_ticket;
+ m_waiting_for= waiting_for_arg;
mysql_prlock_unlock(&m_LOCK_waiting_for);
}
@@ -705,6 +786,14 @@ private:
m_waiting_for= NULL;
mysql_prlock_unlock(&m_LOCK_waiting_for);
}
+ void lock_deadlock_victim()
+ {
+ mysql_prlock_rdlock(&m_LOCK_waiting_for);
+ }
+ void unlock_deadlock_victim()
+ {
+ mysql_prlock_unlock(&m_LOCK_waiting_for);
+ }
private:
MDL_context(const MDL_context &rhs); /* not implemented */
MDL_context &operator=(MDL_context &rhs); /* not implemented */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5412a424c9c..baeeed20ffc 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -65,7 +65,9 @@
#include "events.h"
#include "sql_audit.h"
#include "probes_mysql.h"
+#include "scheduler.h"
#include "debug_sync.h"
+#include "sql_callback.h"
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
@@ -88,6 +90,7 @@
#include <errmsg.h>
#include "sp_rcontext.h"
#include "sp_cache.h"
+#include "sql_reload.h" // reload_acl_and_cache
#ifdef HAVE_POLL_H
#include <poll.h>
@@ -193,6 +196,9 @@ typedef fp_except fp_except_t;
# endif
#endif
+extern "C" my_bool reopen_fstreams(const char *filename,
+ FILE *outstream, FILE *errstream);
+
inline void setup_fpu()
{
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
@@ -440,10 +446,10 @@ static bool calling_initgroups= FALSE; /**< Used in SIGSEGV handler. */
#endif
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
uint mysqld_port_timeout;
-uint delay_key_write_options;
+ulong delay_key_write_options;
uint protocol_version;
uint lower_case_table_names;
-uint tc_heuristic_recover= 0;
+ulong tc_heuristic_recover= 0;
uint volatile thread_count;
int32 thread_running;
ulong thread_created;
@@ -454,9 +460,9 @@ ulong slow_launch_time, slave_open_temp_tables;
ulong open_files_limit, max_binlog_size, max_relay_log_size;
ulong slave_trans_retries;
uint slave_net_timeout;
-uint slave_exec_mode_options;
+ulong slave_exec_mode_options;
ulonglong slave_type_conversions_options;
-ulong thread_cache_size=0, thread_pool_size= 0;
+ulong thread_cache_size=0;
ulong binlog_cache_size=0;
ulonglong max_binlog_cache_size=0;
ulong query_cache_size=0;
@@ -553,7 +559,7 @@ char *mysql_data_home= const_cast<char*>(".");
const char *mysql_real_data_home_ptr= mysql_real_data_home;
char server_version[SERVER_VERSION_LENGTH];
char *mysqld_unix_port, *opt_mysql_tmpdir;
-uint thread_handling;
+ulong thread_handling;
/** name of reference on left expression in rewritten IN subquery */
const char *in_left_expr_name= "<left expr>";
@@ -602,7 +608,7 @@ SHOW_COMP_OPTION have_profiling;
pthread_key(MEM_ROOT**,THR_MALLOC);
pthread_key(THD*, THR_THD);
mysql_mutex_t LOCK_thread_count;
-mysql_mutex_t LOCK_open,
+mysql_mutex_t
LOCK_status, LOCK_global_read_lock,
LOCK_error_log, LOCK_uuid_generator,
LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create,
@@ -624,7 +630,7 @@ mysql_mutex_t LOCK_des_key_file;
mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
mysql_rwlock_t LOCK_system_variables_hash;
mysql_cond_t COND_thread_count;
-mysql_cond_t COND_refresh, COND_global_read_lock;
+mysql_cond_t COND_global_read_lock;
pthread_t signal_thread;
pthread_attr_t connection_attrib;
mysql_mutex_t LOCK_server_started;
@@ -898,8 +904,6 @@ my_bool opt_enable_shared_memory;
HANDLE smem_event_connect_request= 0;
#endif
-scheduler_functions thread_scheduler;
-
my_bool opt_use_ssl = 0;
char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL,
*opt_ssl_cipher= NULL, *opt_ssl_key= NULL;
@@ -1087,7 +1091,8 @@ static void close_connections(void)
continue;
tmp->killed= THD::KILL_CONNECTION;
- thread_scheduler.post_kill_notification(tmp);
+ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp));
+ mysql_mutex_lock(&tmp->LOCK_thd_data);
if (tmp->mysys_var)
{
tmp->mysys_var->abort=1;
@@ -1100,6 +1105,7 @@ static void close_connections(void)
}
mysql_mutex_unlock(&tmp->mysys_var->mutex);
}
+ mysql_mutex_unlock(&tmp->LOCK_thd_data);
}
mysql_mutex_unlock(&LOCK_thread_count); // For unlink from list
@@ -1479,7 +1485,7 @@ void clean_up(bool print_message)
if (print_message && my_default_lc_messages && server_start_time)
sql_print_information(ER_DEFAULT(ER_SHUTDOWN_COMPLETE),my_progname);
cleanup_errmsgs();
- thread_scheduler.end();
+ MYSQL_CALLBACK(thread_scheduler, end, ());
mysql_client_plugin_deinit();
finish_client_errs();
DBUG_PRINT("quit", ("Error messages freed"));
@@ -1528,7 +1534,6 @@ static void wait_for_signal_thread_to_end()
static void clean_up_mutexes()
{
mysql_rwlock_destroy(&LOCK_grant);
- mysql_mutex_destroy(&LOCK_open);
mysql_mutex_destroy(&LOCK_thread_count);
mysql_mutex_destroy(&LOCK_status);
mysql_mutex_destroy(&LOCK_delayed_insert);
@@ -1561,7 +1566,6 @@ static void clean_up_mutexes()
mysql_mutex_destroy(&LOCK_prepared_stmt_count);
mysql_mutex_destroy(&LOCK_error_messages);
mysql_cond_destroy(&COND_thread_count);
- mysql_cond_destroy(&COND_refresh);
mysql_cond_destroy(&COND_global_read_lock);
mysql_cond_destroy(&COND_thread_cache);
mysql_cond_destroy(&COND_flush_thread_cache);
@@ -1755,7 +1759,7 @@ static void network_init(void)
DBUG_ENTER("network_init");
LINT_INIT(ret);
- if (thread_scheduler.init())
+ if (MYSQL_CALLBACK_ELSE(thread_scheduler, init, (), 0))
unireg_abort(1); /* purecov: inspected */
set_ports();
@@ -2003,7 +2007,7 @@ extern "C" sig_handler end_thread_signal(int sig __attribute__((unused)))
if (thd && ! thd->bootstrap)
{
statistic_increment(killed_threads, &LOCK_status);
- thread_scheduler.end_thread(thd,0); /* purecov: inspected */
+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd,0)); /* purecov: inspected */
}
DBUG_VOID_RETURN; /* purecov: deadcode */
}
@@ -2399,7 +2403,7 @@ and this may fail.\n\n");
(ulong) dflt_key_cache->key_cache_mem_size);
fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
- fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
+ fprintf(stderr, "max_threads=%u\n", thread_scheduler->max_threads);
fprintf(stderr, "thread_count=%u\n", thread_count);
fprintf(stderr, "connection_count=%u\n", connection_count);
fprintf(stderr, "It is possible that mysqld could use up to \n\
@@ -2407,7 +2411,7 @@ key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\
bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
(global_system_variables.read_buff_size +
global_system_variables.sortbuff_size) *
- thread_scheduler.max_threads +
+ thread_scheduler->max_threads +
max_connections * sizeof(THD)) / 1024);
fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n");
@@ -2654,7 +2658,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
This should actually be '+ max_number_of_slaves' instead of +10,
but the +10 should be quite safe.
*/
- init_thr_alarm(thread_scheduler.max_threads +
+ init_thr_alarm(thread_scheduler->max_threads +
global_system_variables.max_insert_delayed_threads + 10);
if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT))
{
@@ -3503,7 +3507,6 @@ You should consider changing lower_case_table_names to 1 or 2",
static int init_thread_environment()
{
- mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_thread_count, &LOCK_thread_count, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_status, &LOCK_status, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_delayed_insert,
@@ -3550,7 +3553,6 @@ static int init_thread_environment()
mysql_rwlock_init(key_rwlock_LOCK_sys_init_slave, &LOCK_sys_init_slave);
mysql_rwlock_init(key_rwlock_LOCK_grant, &LOCK_grant);
mysql_cond_init(key_COND_thread_count, &COND_thread_count, NULL);
- mysql_cond_init(key_COND_refresh, &COND_refresh, NULL);
mysql_cond_init(key_COND_global_read_lock, &COND_global_read_lock, NULL);
mysql_cond_init(key_COND_thread_cache, &COND_thread_cache, NULL);
mysql_cond_init(key_COND_flush_thread_cache, &COND_flush_thread_cache, NULL);
@@ -3744,13 +3746,15 @@ static int init_server_components()
opt_error_log= 0; // Too long file name
else
{
+ my_bool res;
#ifndef EMBEDDED_LIBRARY
- if (freopen(log_error_file, "a+", stdout))
+ res= reopen_fstreams(log_error_file, stdout, stderr);
+#else
+ res= reopen_fstreams(log_error_file, NULL, stderr);
#endif
- {
- if (freopen(log_error_file, "a+", stderr))
- setbuf(stderr, NULL);
- }
+
+ if (!res)
+ setbuf(stderr, NULL);
}
}
@@ -4359,23 +4363,6 @@ int mysqld_main(int argc, char **argv)
}
#endif
-#ifdef __WIN__
- /*
- Before performing any socket operation (like retrieving hostname
- in init_common_variables we have to call WSAStartup
- */
- {
- WSADATA WsaData;
- if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData))
- {
- /* errors are not read yet, so we use english text here */
- my_message(ER_WSAS_FAILED, "WSAStartup Failed", MYF(0));
- /* Not enough initializations for unireg_abort() */
- return 1;
- }
- }
-#endif /* __WIN__ */
-
if (init_common_variables())
unireg_abort(1); // Will do exit
@@ -4463,8 +4450,8 @@ int mysqld_main(int argc, char **argv)
#ifdef __WIN__
if (!opt_console)
{
- freopen(log_error_file,"a+",stdout);
- freopen(log_error_file,"a+",stderr);
+ if (reopen_fstreams(log_error_file, stdout, stderr))
+ unireg_abort(1);
setbuf(stderr, NULL);
FreeConsole(); // Remove window
}
@@ -4516,6 +4503,8 @@ int mysqld_main(int argc, char **argv)
init_status_vars();
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
opt_skip_slave_start= 1;
+
+ binlog_unsafe_map_init();
/*
init_slave() must be called after the thread keys are created.
Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other
@@ -5032,7 +5021,7 @@ static void create_new_thread(THD *thd)
thread_count++;
- thread_scheduler.add_connection(thd);
+ MYSQL_CALLBACK(thread_scheduler, add_connection, (thd));
DBUG_VOID_RETURN;
}
@@ -6443,6 +6432,7 @@ SHOW_VAR status_vars[]= {
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
+ {"Handler_read_last", (char*) offsetof(STATUS_VAR, ha_read_last_count), SHOW_LONG_STATUS},
{"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS},
{"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS},
{"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS},
@@ -7347,14 +7337,12 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
return 1;
#ifdef EMBEDDED_LIBRARY
- one_thread_scheduler(&thread_scheduler);
+ one_thread_scheduler();
#else
if (thread_handling <= SCHEDULER_ONE_THREAD_PER_CONNECTION)
- one_thread_per_connection_scheduler(&thread_scheduler);
- else if (thread_handling == SCHEDULER_NO_THREADS)
- one_thread_scheduler(&thread_scheduler);
- else
- pool_of_threads_scheduler(&thread_scheduler); /* purecov: tested */
+ one_thread_per_connection_scheduler();
+ else /* thread_handling == SCHEDULER_NO_THREADS) */
+ one_thread_scheduler();
#endif
global_system_variables.engine_condition_pushdown=
@@ -7683,7 +7671,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables,
key_LOCK_manager,
- key_LOCK_open, key_LOCK_prepared_stmt_count,
+ key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status,
key_LOCK_system_variables_hash, key_LOCK_table_share, key_LOCK_thd_data,
key_LOCK_user_conn, key_LOCK_uuid_generator, key_LOG_LOCK_log,
@@ -7722,7 +7710,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_global_read_lock, "LOCK_global_read_lock", PSI_FLAG_GLOBAL},
{ &key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL},
{ &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL},
- { &key_LOCK_open, "LOCK_open", PSI_FLAG_GLOBAL},
{ &key_LOCK_prepared_stmt_count, "LOCK_prepared_stmt_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_rpl_status, "LOCK_rpl_status", PSI_FLAG_GLOBAL},
{ &key_LOCK_server_started, "LOCK_server_started", PSI_FLAG_GLOBAL},
@@ -7770,7 +7757,7 @@ PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
key_COND_cache_status_changed, key_COND_global_read_lock, key_COND_manager,
- key_COND_refresh, key_COND_rpl_status, key_COND_server_started,
+ key_COND_rpl_status, key_COND_server_started,
key_delayed_insert_cond, key_delayed_insert_cond_client,
key_item_func_sleep_cond, key_master_info_data_cond,
key_master_info_start_cond, key_master_info_stop_cond,
@@ -7794,7 +7781,6 @@ static PSI_cond_info all_server_conds[]=
{ &key_COND_cache_status_changed, "Query_cache::COND_cache_status_changed", 0},
{ &key_COND_global_read_lock, "COND_global_read_lock", PSI_FLAG_GLOBAL},
{ &key_COND_manager, "COND_manager", PSI_FLAG_GLOBAL},
- { &key_COND_refresh, "COND_refresh", PSI_FLAG_GLOBAL},
{ &key_COND_rpl_status, "COND_rpl_status", PSI_FLAG_GLOBAL},
{ &key_COND_server_started, "COND_server_started", PSI_FLAG_GLOBAL},
{ &key_delayed_insert_cond, "Delayed_insert::cond", 0},
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 22e757e6e8a..6e81c240f7d 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -28,7 +28,7 @@ class THD;
struct handlerton;
class Time_zone;
-class scheduler_functions;
+struct scheduler_functions;
typedef struct st_mysql_const_lex_string LEX_CSTRING;
typedef struct st_mysql_show_var SHOW_VAR;
@@ -105,7 +105,7 @@ extern uint connection_count;
extern my_bool opt_safe_user_create;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
-extern uint slave_exec_mode_options;
+extern ulong slave_exec_mode_options;
extern ulonglong slave_type_conversions_options;
extern my_bool opt_readonly, lower_case_file_system;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
@@ -136,7 +136,7 @@ extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb;
extern my_bool relay_log_recovery;
extern uint test_flags,select_errors,ha_open_options;
extern uint protocol_version, mysqld_port, dropping_tables;
-extern uint delay_key_write_options;
+extern ulong delay_key_write_options;
extern char *opt_logname, *opt_slow_logname;
extern char *opt_backup_history_logname, *opt_backup_progress_logname,
*opt_backup_settings_name;
@@ -175,7 +175,7 @@ extern ulong binlog_cache_size, open_files_limit;
extern ulonglong max_binlog_cache_size;
extern ulong max_binlog_size, max_relay_log_size;
extern ulong opt_binlog_rows_event_max_size;
-extern ulong rpl_recovery_rank, thread_cache_size, thread_pool_size;
+extern ulong rpl_recovery_rank, thread_cache_size;
extern ulong back_log;
extern char language[FN_REFLEN];
extern ulong server_id, concurrency;
@@ -207,7 +207,7 @@ extern my_bool old_mode;
extern LEX_STRING opt_init_connect, opt_init_slave;
extern int bootstrap_error;
extern I_List<THD> threads;
-extern scheduler_functions thread_scheduler;
+extern char err_shared_dir[];
extern TYPELIB thread_handling_typelib;
extern my_decimal decimal_zero;
@@ -229,7 +229,7 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables,
key_LOCK_logger, key_LOCK_manager,
- key_LOCK_open, key_LOCK_prepared_stmt_count,
+ key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status,
key_LOCK_table_share, key_LOCK_thd_data,
key_LOCK_user_conn, key_LOCK_uuid_generator, key_LOG_LOCK_log,
@@ -249,7 +249,7 @@ extern PSI_cond_key key_PAGE_cond, key_COND_active, key_COND_pool;
extern PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
key_COND_cache_status_changed, key_COND_global_read_lock, key_COND_manager,
- key_COND_refresh, key_COND_rpl_status, key_COND_server_started,
+ key_COND_rpl_status, key_COND_server_started,
key_delayed_insert_cond, key_delayed_insert_cond_client,
key_item_func_sleep_cond, key_master_info_data_cond,
key_master_info_start_cond, key_master_info_stop_cond,
@@ -300,7 +300,7 @@ extern ulong specialflag;
extern uint mysql_data_home_len;
extern uint mysql_real_data_home_len;
extern const char *mysql_real_data_home_ptr;
-extern uint thread_handling;
+extern ulong thread_handling;
extern MYSQL_PLUGIN_IMPORT char *mysql_data_home;
extern char server_version[SERVER_VERSION_LENGTH];
extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[];
@@ -316,7 +316,7 @@ extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded
/*
Server mutex locks and condition variables.
*/
-extern mysql_mutex_t LOCK_open,
+extern mysql_mutex_t
LOCK_user_locks, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
@@ -332,7 +332,7 @@ extern mysql_cond_t COND_server_started;
extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
extern mysql_rwlock_t LOCK_system_variables_hash;
extern mysql_cond_t COND_thread_count;
-extern mysql_cond_t COND_refresh, COND_manager;
+extern mysql_cond_t COND_manager;
extern mysql_cond_t COND_global_read_lock;
extern int32 thread_running;
extern my_atomic_rwlock_t thread_running_lock;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index af5b4b7c7d6..b9819def54d 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -5620,7 +5620,11 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
SEL_TREE *tmp= get_full_func_mm_tree(param, cond_func,
field_item, (Item*)(intptr)i, inv);
if (inv)
+ {
tree= !tree ? tmp : tree_or(param, tree, tmp);
+ if (tree == NULL)
+ break;
+ }
else
tree= tree_and(param, tree, tmp);
}
diff --git a/sql/scheduler.cc b/sql/scheduler.cc
index 10009246428..d61a452b99e 100644
--- a/sql/scheduler.cc
+++ b/sql/scheduler.cc
@@ -25,55 +25,103 @@
#include "unireg.h" // REQUIRED: for other includes
#include "scheduler.h"
#include "sql_connect.h" // init_new_connection_handler_thread
+#include "scheduler.h"
+#include "sql_callback.h"
/*
- 'Dummy' functions to be used when we don't need any handling for a scheduler
- event
- */
+ End connection, in case when we are using 'no-threads'
+*/
-static bool init_dummy(void) {return 0;}
-static void post_kill_dummy(THD* thd) {}
-static void end_dummy(void) {}
-static bool end_thread_dummy(THD *thd, bool cache_thread) { return 0; }
+static bool no_threads_end(THD *thd, bool put_in_cache)
+{
+ unlink_thd(thd);
+ mysql_mutex_unlock(&LOCK_thread_count);
+ return 1; // Abort handle_one_connection
+}
-/*
- Initialize default scheduler with dummy functions so that setup functions
- only need to declare those that are relvant for their usage
+static scheduler_functions one_thread_scheduler_functions=
+{
+ 1, // max_threads
+ NULL, // init
+ init_new_connection_handler_thread, // init_new_connection_thread
+#ifndef EMBEDDED_LIBRARY
+ handle_connection_in_main_thread, // add_connection
+#else
+ NULL, // add_connection
+#endif // EMBEDDED_LIBRARY
+ NULL, // thd_wait_begin
+ NULL, // thd_wait_end
+ NULL, // post_kill_notification
+ no_threads_end, // end_thread
+ NULL, // end
+};
+
+#ifndef EMBEDDED_LIBRARY
+static scheduler_functions one_thread_per_connection_scheduler_functions=
+{
+ 0, // max_threads
+ NULL, // init
+ init_new_connection_handler_thread, // init_new_connection_thread
+ create_thread_to_handle_connection, // add_connection
+ NULL, // thd_wait_begin
+ NULL, // thd_wait_end
+ NULL, // post_kill_notification
+ one_thread_per_connection_end, // end_thread
+ NULL, // end
+};
+#endif // EMBEDDED_LIBRARY
+
+
+scheduler_functions *thread_scheduler= NULL;
+
+/** @internal
+ Helper functions to allow mysys to call the thread scheduler when
+ waiting for locks.
*/
-scheduler_functions::scheduler_functions()
- :init(init_dummy),
- init_new_connection_thread(init_new_connection_handler_thread),
- add_connection(0), // Must be defined
- post_kill_notification(post_kill_dummy),
- end_thread(end_thread_dummy), end(end_dummy)
-{}
+/**@{*/
+static void scheduler_wait_begin(void) {
+ MYSQL_CALLBACK(thread_scheduler,
+ thd_wait_begin, (current_thd, THD_WAIT_ROW_TABLE_LOCK));
+}
+
+static void scheduler_wait_end(void) {
+ MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (current_thd));
+}
+/**@}*/
+/**
+ Common scheduler init function.
+
+ The scheduler is either initialized by calling
+ one_thread_scheduler() or one_thread_per_connection_scheduler() in
+ mysqld.cc, so this init function will always be called.
+ */
+static void scheduler_init() {
+ thr_set_lock_wait_callback(scheduler_wait_begin, scheduler_wait_end);
+}
/*
- End connection, in case when we are using 'no-threads'
+ Initialize scheduler for --thread-handling=one-thread-per-connection
*/
-static bool no_threads_end(THD *thd, bool put_in_cache)
+#ifndef EMBEDDED_LIBRARY
+void one_thread_per_connection_scheduler()
{
- unlink_thd(thd);
- mysql_mutex_unlock(&LOCK_thread_count);
- return 1; // Abort handle_one_connection
+ scheduler_init();
+ one_thread_per_connection_scheduler_functions.max_threads= max_connections;
+ thread_scheduler= &one_thread_per_connection_scheduler_functions;
}
-
+#endif
/*
Initailize scheduler for --thread-handling=no-threads
*/
-void one_thread_scheduler(scheduler_functions* func)
+void one_thread_scheduler()
{
- func->max_threads= 1;
-#ifndef EMBEDDED_LIBRARY
- func->add_connection= handle_connection_in_main_thread;
-#endif
- func->init_new_connection_thread= init_dummy;
- func->end_thread= no_threads_end;
+ scheduler_init();
+ thread_scheduler= &one_thread_scheduler_functions;
}
@@ -81,11 +129,58 @@ void one_thread_scheduler(scheduler_functions* func)
Initialize scheduler for --thread-handling=one-thread-per-connection
*/
-#ifndef EMBEDDED_LIBRARY
-void one_thread_per_connection_scheduler(scheduler_functions* func)
+/*
+ thd_scheduler keeps the link between THD and events.
+ It's embedded in the THD class.
+*/
+
+thd_scheduler::thd_scheduler()
+ : m_psi(NULL), data(NULL)
+{
+#ifndef DBUG_OFF
+ dbug_explain[0]= '\0';
+ set_explain= FALSE;
+#endif
+}
+
+
+thd_scheduler::~thd_scheduler()
+{
+}
+
+static scheduler_functions *saved_thread_scheduler;
+static uint saved_thread_handling;
+
+extern "C"
+int my_thread_scheduler_set(scheduler_functions *scheduler)
+{
+ DBUG_ASSERT(scheduler != 0);
+
+ if (scheduler == NULL)
+ return 1;
+
+ saved_thread_scheduler= thread_scheduler;
+ saved_thread_handling= thread_handling;
+ thread_scheduler= scheduler;
+ // Scheduler loaded dynamically
+ thread_handling= SCHEDULER_TYPES_COUNT;
+ return 0;
+}
+
+
+extern "C"
+int my_thread_scheduler_reset()
{
- func->max_threads= max_connections;
- func->add_connection= create_thread_to_handle_connection;
- func->end_thread= one_thread_per_connection_end;
+ DBUG_ASSERT(saved_thread_scheduler != NULL);
+
+ if (saved_thread_scheduler == NULL)
+ return 1;
+
+ thread_scheduler= saved_thread_scheduler;
+ thread_handling= saved_thread_handling;
+ saved_thread_scheduler= 0;
+ return 0;
}
-#endif /* EMBEDDED_LIBRARY */
+
+
+
diff --git a/sql/scheduler.h b/sql/scheduler.h
index e7916031a27..40f0e28bc2c 100644
--- a/sql/scheduler.h
+++ b/sql/scheduler.h
@@ -28,38 +28,77 @@ class THD;
/* Functions used when manipulating threads */
-class scheduler_functions
+struct scheduler_functions
{
-public:
uint max_threads;
bool (*init)(void);
bool (*init_new_connection_thread)(void);
void (*add_connection)(THD *thd);
+ void (*thd_wait_begin)(THD *thd, int wait_type);
+ void (*thd_wait_end)(THD *thd);
void (*post_kill_notification)(THD *thd);
bool (*end_thread)(THD *thd, bool cache_thread);
void (*end)(void);
- scheduler_functions();
};
+
+/**
+ Scheduler types enumeration.
+
+ The default of --thread-handling is the first one in the
+ thread_handling_names array, this array has to be consistent with
+ the order in this array, so to change default one has to change the
+ first entry in this enum and the first entry in the
+ thread_handling_names array.
+
+ @note The last entry of the enumeration is also used to mark the
+ thread handling as dynamic. In this case the name of the thread
+ handling is fetched from the name of the plugin that implements it.
+*/
enum scheduler_types
{
SCHEDULER_ONE_THREAD_PER_CONNECTION=0,
SCHEDULER_NO_THREADS,
- SCHEDULER_POOL_OF_THREADS
+ SCHEDULER_TYPES_COUNT
};
-void one_thread_per_connection_scheduler(scheduler_functions* func);
-void one_thread_scheduler(scheduler_functions* func);
+void one_thread_per_connection_scheduler();
+void one_thread_scheduler();
enum pool_command_op
{
NOT_IN_USE_OP= 0, NORMAL_OP= 1, CONNECT_OP, KILL_OP, DIE_OP
};
-#define HAVE_POOL_OF_THREADS 0 /* For easyer tests */
-#define pool_of_threads_scheduler(A) one_thread_per_connection_scheduler(A)
-
+/*
+ To be used for pool-of-threads (implemeneted differently on various OSs)
+*/
class thd_scheduler
-{};
+{
+public:
+ /*
+ Thread instrumentation for the user job.
+ This member holds the instrumentation while the user job is not run
+ by a thread.
+
+ Note that this member is not conditionally declared
+ (ifdef HAVE_PSI_INTERFACE), because doing so will change the binary
+ layout of THD, which is exposed to plugin code that may be compiled
+ differently.
+ */
+ PSI_thread *m_psi;
+
+ void *data; /* scheduler-specific data structure */
+
+# ifndef DBUG_OFF
+ char dbug_explain[512];
+ bool set_explain;
+# endif
-#endif /* SCHEDULER_INCLUDED */
+ thd_scheduler();
+ ~thd_scheduler();
+};
+
+extern scheduler_functions *thread_scheduler;
+
+#endif
diff --git a/sql/set_var.cc b/sql/set_var.cc
index c35a2f33a32..19fff76c1da 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -153,6 +153,17 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
guard(lock), offset(off), on_check(on_check_func), on_update(on_update_func),
is_os_charset(FALSE)
{
+ /*
+ There is a limitation in handle_options() related to short options:
+ - either all short options should be declared when parsing in multiple stages,
+ - or none should be declared.
+ Because a lot of short options are used in the normal parsing phase
+ for mysqld, we enforce here that no short option is present
+ in the first (PARSE_EARLY) stage.
+ See handle_options() for details.
+ */
+ DBUG_ASSERT(parse_flag == PARSE_NORMAL || getopt_id <= 0 || getopt_id >= 255);
+
name.str= name_arg;
name.length= strlen(name_arg);
DBUG_ASSERT(name.length <= NAME_CHAR_LEN);
diff --git a/sql/sp.cc b/sql/sp.cc
index 0265ef45a2a..8821dc9365d 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -440,6 +440,7 @@ static TABLE *open_proc_table_for_update(THD *thd)
{
TABLE_LIST table_list;
TABLE *table;
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("open_proc_table_for_update");
table_list.init_one_table("mysql", 5, "proc", 4, "proc", TL_WRITE);
@@ -450,6 +451,9 @@ static TABLE *open_proc_table_for_update(THD *thd)
if (!proc_table_intact.check(table, &proc_table_def))
DBUG_RETURN(table);
+ close_thread_tables(thd);
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+
DBUG_RETURN(NULL);
}
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
new file mode 100644
index 00000000000..1f96f1cf0e4
--- /dev/null
+++ b/sql/sql_admin.cc
@@ -0,0 +1,1001 @@
+/* Copyright (c) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "sql_class.h" // THD
+#include "keycaches.h" // get_key_cache
+#include "sql_base.h" // Open_table_context
+#include "lock.h" // MYSQL_OPEN_*
+#include "sql_handler.h" // mysql_ha_rm_tables
+#include "partition_element.h" // PART_ADMIN
+#include "sql_partition.h" // set_part_state
+#include "transaction.h" // trans_rollback_stmt
+#include "sql_view.h" // view_checksum
+#include "sql_table.h" // mysql_recreate_table
+#include "debug_sync.h" // DEBUG_SYNC
+#include "sql_acl.h" // *_ACL
+#include "sp.h" // Sroutine_hash_entry
+#include "sql_parse.h" // check_table_access
+#include "sql_admin.h"
+
+static int send_check_errmsg(THD *thd, TABLE_LIST* table,
+ const char* operator_name, const char* errmsg)
+
+{
+ Protocol *protocol= thd->protocol;
+ protocol->prepare_for_resend();
+ protocol->store(table->alias, system_charset_info);
+ protocol->store((char*) operator_name, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ protocol->store(errmsg, system_charset_info);
+ thd->clear_error();
+ if (protocol->write())
+ return -1;
+ return 1;
+}
+
+
+static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
+ HA_CHECK_OPT *check_opt)
+{
+ int error= 0;
+ TABLE tmp_table, *table;
+ TABLE_SHARE *share;
+ bool has_mdl_lock= FALSE;
+ char from[FN_REFLEN],tmp[FN_REFLEN+32];
+ const char **ext;
+ MY_STAT stat_info;
+ Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_OPEN_HAS_MDL_LOCK |
+ MYSQL_LOCK_IGNORE_TIMEOUT));
+ DBUG_ENTER("prepare_for_repair");
+
+ if (!(check_opt->sql_flags & TT_USEFRM))
+ DBUG_RETURN(0);
+
+ if (!(table= table_list->table))
+ {
+ char key[MAX_DBKEY_LENGTH];
+ uint key_length;
+ /*
+ If the table didn't exist, we have a shared metadata lock
+ on it that is left from mysql_admin_table()'s attempt to
+ open it. Release the shared metadata lock before trying to
+ acquire the exclusive lock to satisfy MDL asserts and avoid
+ deadlocks.
+ */
+ thd->mdl_context.release_transactional_locks();
+ /*
+ Attempt to do full-blown table open in mysql_admin_table() has failed.
+ Let us try to open at least a .FRM for this table.
+ */
+ my_hash_value_type hash_value;
+
+ key_length= create_table_def_key(thd, key, table_list, 0);
+ table_list->mdl_request.init(MDL_key::TABLE,
+ table_list->db, table_list->table_name,
+ MDL_EXCLUSIVE);
+
+ if (lock_table_names(thd, table_list, table_list->next_global,
+ thd->variables.lock_wait_timeout,
+ MYSQL_OPEN_SKIP_TEMPORARY))
+ DBUG_RETURN(0);
+ has_mdl_lock= TRUE;
+
+ hash_value= my_calc_hash(&table_def_cache, (uchar*) key, key_length);
+ mysql_mutex_lock(&LOCK_open);
+ share= get_table_share(thd, table_list, key, key_length, 0,
+ &error, hash_value);
+ mysql_mutex_unlock(&LOCK_open);
+ if (share == NULL)
+ DBUG_RETURN(0); // Can't open frm file
+
+ if (open_table_from_share(thd, share, "", 0, 0, 0, &tmp_table, FALSE))
+ {
+ mysql_mutex_lock(&LOCK_open);
+ release_table_share(share);
+ mysql_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(0); // Out of memory
+ }
+ table= &tmp_table;
+ }
+
+ /* A MERGE table must not come here. */
+ DBUG_ASSERT(table->file->ht->db_type != DB_TYPE_MRG_MYISAM);
+
+ /*
+ REPAIR TABLE ... USE_FRM for temporary tables makes little sense.
+ */
+ if (table->s->tmp_table)
+ {
+ error= send_check_errmsg(thd, table_list, "repair",
+ "Cannot repair temporary table from .frm file");
+ goto end;
+ }
+
+ /*
+ User gave us USE_FRM which means that the header in the index file is
+ trashed.
+ In this case we will try to fix the table the following way:
+ - Rename the data file to a temporary name
+ - Truncate the table
+ - Replace the new data file with the old one
+ - Run a normal repair using the new index file and the old data file
+ */
+
+ if (table->s->frm_version != FRM_VER_TRUE_VARCHAR)
+ {
+ error= send_check_errmsg(thd, table_list, "repair",
+ "Failed repairing incompatible .frm file");
+ goto end;
+ }
+
+ /*
+ Check if this is a table type that stores index and data separately,
+ like ISAM or MyISAM. We assume fixed order of engine file name
+ extentions array. First element of engine file name extentions array
+ is meta/index file extention. Second element - data file extention.
+ */
+ ext= table->file->bas_ext();
+ if (!ext[0] || !ext[1])
+ goto end; // No data file
+
+ // Name of data file
+ strxmov(from, table->s->normalized_path.str, ext[1], NullS);
+ if (!mysql_file_stat(key_file_misc, from, &stat_info, MYF(0)))
+ goto end; // Can't use USE_FRM flag
+
+ my_snprintf(tmp, sizeof(tmp), "%s-%lx_%lx",
+ from, current_pid, thd->thread_id);
+
+ if (table_list->table)
+ {
+ /*
+ Table was successfully open in mysql_admin_table(). Now we need
+ to close it, but leave it protected by exclusive metadata lock.
+ */
+ if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
+ goto end;
+ close_all_tables_for_name(thd, table_list->table->s, FALSE);
+ table_list->table= 0;
+ }
+ /*
+ After this point we have an exclusive metadata lock on our table
+ in both cases when table was successfully open in mysql_admin_table()
+ and when it was open in prepare_for_repair().
+ */
+
+ if (my_rename(from, tmp, MYF(MY_WME)))
+ {
+ error= send_check_errmsg(thd, table_list, "repair",
+ "Failed renaming data file");
+ goto end;
+ }
+ if (dd_recreate_table(thd, table_list->db, table_list->table_name))
+ {
+ error= send_check_errmsg(thd, table_list, "repair",
+ "Failed generating table from .frm file");
+ goto end;
+ }
+ /*
+ 'FALSE' for 'using_transactions' means don't postpone
+ invalidation till the end of a transaction, but do it
+ immediately.
+ */
+ query_cache_invalidate3(thd, table_list, FALSE);
+ if (mysql_file_rename(key_file_misc, tmp, from, MYF(MY_WME)))
+ {
+ error= send_check_errmsg(thd, table_list, "repair",
+ "Failed restoring .MYD file");
+ goto end;
+ }
+
+ if (thd->locked_tables_list.reopen_tables(thd))
+ goto end;
+
+ /*
+ Now we should be able to open the partially repaired table
+ to finish the repair in the handler later on.
+ */
+ if (open_table(thd, table_list, thd->mem_root, &ot_ctx))
+ {
+ error= send_check_errmsg(thd, table_list, "repair",
+ "Failed to open partially repaired table");
+ goto end;
+ }
+
+end:
+ thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
+ if (table == &tmp_table)
+ {
+ mysql_mutex_lock(&LOCK_open);
+ closefrm(table, 1); // Free allocated memory
+ mysql_mutex_unlock(&LOCK_open);
+ }
+ /* In case of a temporary table there will be no metadata lock. */
+ if (error && has_mdl_lock)
+ thd->mdl_context.release_transactional_locks();
+
+ DBUG_RETURN(error);
+}
+
+
+
+/*
+ RETURN VALUES
+ FALSE Message sent to net (admin operation went ok)
+ TRUE Message should be sent by caller
+ (admin operation or network communication failed)
+*/
+static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
+ HA_CHECK_OPT* check_opt,
+ const char *operator_name,
+ thr_lock_type lock_type,
+ bool open_for_modify,
+ bool no_warnings_for_error,
+ uint extra_open_options,
+ int (*prepare_func)(THD *, TABLE_LIST *,
+ HA_CHECK_OPT *),
+ int (handler::*operator_func)(THD *,
+ HA_CHECK_OPT *),
+ int (view_operator_func)(THD *, TABLE_LIST*))
+{
+ TABLE_LIST *table;
+ SELECT_LEX *select= &thd->lex->select_lex;
+ List<Item> field_list;
+ Item *item;
+ Protocol *protocol= thd->protocol;
+ LEX *lex= thd->lex;
+ int result_code;
+ DBUG_ENTER("mysql_admin_table");
+
+ field_list.push_back(item = new Item_empty_string("Table", NAME_CHAR_LEN*2));
+ item->maybe_null = 1;
+ field_list.push_back(item = new Item_empty_string("Op", 10));
+ item->maybe_null = 1;
+ field_list.push_back(item = new Item_empty_string("Msg_type", 10));
+ item->maybe_null = 1;
+ field_list.push_back(item = new Item_empty_string("Msg_text", 255));
+ item->maybe_null = 1;
+ if (protocol->send_result_set_metadata(&field_list,
+ Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ DBUG_RETURN(TRUE);
+
+ mysql_ha_rm_tables(thd, tables);
+
+ for (table= tables; table; table= table->next_local)
+ {
+ char table_name[NAME_LEN*2+2];
+ char* db = table->db;
+ bool fatal_error=0;
+ bool open_error;
+
+ DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name));
+ DBUG_PRINT("admin", ("extra_open_options: %u", extra_open_options));
+ strxmov(table_name, db, ".", table->table_name, NullS);
+ thd->open_options|= extra_open_options;
+ table->lock_type= lock_type;
+ /*
+ To make code safe for re-execution we need to reset type of MDL
+ request as code below may change it.
+ To allow concurrent execution of read-only operations we acquire
+ weak metadata lock for them.
+ */
+ table->mdl_request.set_type((lock_type >= TL_WRITE_ALLOW_WRITE) ?
+ MDL_SHARED_NO_READ_WRITE : MDL_SHARED_READ);
+ /* open only one table from local list of command */
+ {
+ TABLE_LIST *save_next_global, *save_next_local;
+ save_next_global= table->next_global;
+ table->next_global= 0;
+ save_next_local= table->next_local;
+ table->next_local= 0;
+ 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.
+ TODO: Investigate if we can put extra tables into argument instead of
+ using lex->query_tables
+ */
+ lex->query_tables= table;
+ lex->query_tables_last= &table->next_global;
+ lex->query_tables_own_last= 0;
+ thd->no_warnings_for_error= no_warnings_for_error;
+ if (view_operator_func == NULL)
+ table->required_type=FRMTYPE_TABLE;
+
+ open_error= open_and_lock_tables(thd, table, TRUE, 0);
+ thd->no_warnings_for_error= 0;
+ table->next_global= save_next_global;
+ table->next_local= save_next_local;
+ thd->open_options&= ~extra_open_options;
+ /*
+ Under locked tables, we know that the table can be opened,
+ so any errors opening the table are logical errors.
+ In these cases it does not make sense to try to repair.
+ */
+ if (open_error && thd->locked_tables_mode)
+ {
+ result_code= HA_ADMIN_FAILED;
+ goto send_result;
+ }
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ if (table->table)
+ {
+ /*
+ Set up which partitions that should be processed
+ if ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION ..
+ CACHE INDEX/LOAD INDEX for specified partitions
+ */
+ Alter_info *alter_info= &lex->alter_info;
+
+ if (alter_info->flags & ALTER_ADMIN_PARTITION)
+ {
+ if (!table->table->part_info)
+ {
+ my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+ uint num_parts_found;
+ uint num_parts_opt= alter_info->partition_names.elements;
+ num_parts_found= set_part_state(alter_info, table->table->part_info,
+ PART_ADMIN);
+ if (num_parts_found != num_parts_opt &&
+ (!(alter_info->flags & ALTER_ALL_PARTITION)))
+ {
+ char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
+ size_t length;
+ DBUG_PRINT("admin", ("sending non existent partition error"));
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store(operator_name, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ length= my_snprintf(buff, sizeof(buff),
+ ER(ER_DROP_PARTITION_NON_EXISTENT),
+ table_name);
+ protocol->store(buff, length, system_charset_info);
+ if(protocol->write())
+ goto err;
+ my_eof(thd);
+ goto err;
+ }
+ }
+ }
+#endif
+ }
+ DBUG_PRINT("admin", ("table: 0x%lx", (long) table->table));
+
+ if (prepare_func)
+ {
+ DBUG_PRINT("admin", ("calling prepare_func"));
+ switch ((*prepare_func)(thd, table, check_opt)) {
+ case 1: // error, message written to net
+ trans_rollback_stmt(thd);
+ trans_rollback(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+ DBUG_PRINT("admin", ("simple error, admin next table"));
+ continue;
+ case -1: // error, message could be written to net
+ /* purecov: begin inspected */
+ DBUG_PRINT("admin", ("severe error, stop"));
+ goto err;
+ /* purecov: end */
+ default: // should be 0 otherwise
+ DBUG_PRINT("admin", ("prepare_func succeeded"));
+ ;
+ }
+ }
+
+ /*
+ CHECK TABLE command is only command where VIEW allowed here and this
+ command use only temporary teble method for VIEWs resolving => there
+ can't be VIEW tree substitition of join view => if opening table
+ succeed then table->table will have real TABLE pointer as value (in
+ case of join view substitution table->table can be 0, but here it is
+ impossible)
+ */
+ if (!table->table)
+ {
+ DBUG_PRINT("admin", ("open table failed"));
+ if (thd->warning_info->is_empty())
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
+ /* if it was a view will check md5 sum */
+ if (table->view &&
+ view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM)
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
+ if (thd->stmt_da->is_error() &&
+ (thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE ||
+ thd->stmt_da->sql_errno() == ER_FILE_NOT_FOUND))
+ /* A missing table is just issued as a failed command */
+ result_code= HA_ADMIN_FAILED;
+ else
+ /* Default failure code is corrupt table */
+ result_code= HA_ADMIN_CORRUPT;
+ goto send_result;
+ }
+
+ if (table->view)
+ {
+ DBUG_PRINT("admin", ("calling view_operator_func"));
+ result_code= (*view_operator_func)(thd, table);
+ goto send_result;
+ }
+
+ if (table->schema_table)
+ {
+ result_code= HA_ADMIN_NOT_IMPLEMENTED;
+ goto send_result;
+ }
+
+ if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
+ {
+ /* purecov: begin inspected */
+ char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
+ size_t length;
+ enum_sql_command save_sql_command= lex->sql_command;
+ DBUG_PRINT("admin", ("sending error message"));
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store(operator_name, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ length= my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY),
+ table_name);
+ protocol->store(buff, length, system_charset_info);
+ trans_commit_stmt(thd);
+ trans_commit(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+ lex->reset_query_tables_list(FALSE);
+ /*
+ Restore Query_tables_list::sql_command value to make statement
+ safe for re-execution.
+ */
+ lex->sql_command= save_sql_command;
+ table->table=0; // For query cache
+ if (protocol->write())
+ goto err;
+ thd->stmt_da->reset_diagnostics_area();
+ continue;
+ /* purecov: end */
+ }
+
+ /*
+ Close all instances of the table to allow MyISAM "repair"
+ to rename files.
+ @todo: This code does not close all instances of the table.
+ It only closes instances in other connections, but if this
+ connection has LOCK TABLE t1 a READ, t1 b WRITE,
+ both t1 instances will be kept open.
+ There is no need to execute this branch for InnoDB, which does
+ repair by recreate. There is no need to do it for OPTIMIZE,
+ which doesn't move files around.
+ Hence, this code should be moved to prepare_for_repair(),
+ and executed only for MyISAM engine.
+ */
+ if (lock_type == TL_WRITE && !table->table->s->tmp_table)
+ {
+ if (wait_while_table_is_used(thd, table->table,
+ HA_EXTRA_PREPARE_FOR_RENAME))
+ goto err;
+ DEBUG_SYNC(thd, "after_admin_flush");
+ /* Flush entries in the query cache involving this table. */
+ query_cache_invalidate3(thd, table->table, 0);
+ /*
+ XXX: hack: switch off open_for_modify to skip the
+ flush that is made later in the execution flow.
+ */
+ open_for_modify= 0;
+ }
+
+ if (table->table->s->crashed && operator_func == &handler::ha_check)
+ {
+ /* purecov: begin inspected */
+ DBUG_PRINT("admin", ("sending crashed warning"));
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store(operator_name, system_charset_info);
+ protocol->store(STRING_WITH_LEN("warning"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Table is marked as crashed"),
+ system_charset_info);
+ if (protocol->write())
+ goto err;
+ /* purecov: end */
+ }
+
+ if (operator_func == &handler::ha_repair &&
+ !(check_opt->sql_flags & TT_USEFRM))
+ {
+ if ((table->table->file->check_old_types() == HA_ADMIN_NEEDS_ALTER) ||
+ (table->table->file->ha_check_for_upgrade(check_opt) ==
+ HA_ADMIN_NEEDS_ALTER))
+ {
+ DBUG_PRINT("admin", ("recreating table"));
+ trans_rollback_stmt(thd);
+ trans_rollback(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+ tmp_disable_binlog(thd); // binlogging is done by caller if wanted
+ result_code= mysql_recreate_table(thd, table);
+ reenable_binlog(thd);
+ /*
+ mysql_recreate_table() can push OK or ERROR.
+ Clear 'OK' status. If there is an error, keep it:
+ we will store the error message in a result set row
+ and then clear.
+ */
+ if (thd->stmt_da->is_ok())
+ thd->stmt_da->reset_diagnostics_area();
+ table->table= NULL;
+ result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
+ goto send_result;
+ }
+ }
+
+ DBUG_PRINT("admin", ("calling operator_func '%s'", operator_name));
+ result_code = (table->table->file->*operator_func)(thd, check_opt);
+ DBUG_PRINT("admin", ("operator_func returned: %d", result_code));
+
+send_result:
+
+ lex->cleanup_after_one_table_open();
+ thd->clear_error(); // these errors shouldn't get client
+ {
+ List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ MYSQL_ERROR *err;
+ while ((err= it++))
+ {
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store((char*) operator_name, system_charset_info);
+ protocol->store(warning_level_names[err->get_level()].str,
+ warning_level_names[err->get_level()].length,
+ system_charset_info);
+ protocol->store(err->get_message_text(), system_charset_info);
+ if (protocol->write())
+ goto err;
+ }
+ thd->warning_info->clear_warning_info(thd->query_id);
+ }
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store(operator_name, system_charset_info);
+
+send_result_message:
+
+ DBUG_PRINT("info", ("result_code: %d", result_code));
+ switch (result_code) {
+ case HA_ADMIN_NOT_IMPLEMENTED:
+ {
+ char buf[MYSQL_ERRMSG_SIZE];
+ size_t length=my_snprintf(buf, sizeof(buf),
+ ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
+ protocol->store(STRING_WITH_LEN("note"), system_charset_info);
+ protocol->store(buf, length, system_charset_info);
+ }
+ break;
+
+ case HA_ADMIN_NOT_BASE_TABLE:
+ {
+ char buf[MYSQL_ERRMSG_SIZE];
+ size_t length= my_snprintf(buf, sizeof(buf),
+ ER(ER_BAD_TABLE_ERROR), table_name);
+ protocol->store(STRING_WITH_LEN("note"), system_charset_info);
+ protocol->store(buf, length, system_charset_info);
+ }
+ break;
+
+ case HA_ADMIN_OK:
+ protocol->store(STRING_WITH_LEN("status"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("OK"), system_charset_info);
+ break;
+
+ case HA_ADMIN_FAILED:
+ protocol->store(STRING_WITH_LEN("status"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Operation failed"),
+ system_charset_info);
+ break;
+
+ case HA_ADMIN_REJECT:
+ protocol->store(STRING_WITH_LEN("status"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Operation need committed state"),
+ system_charset_info);
+ open_for_modify= FALSE;
+ break;
+
+ case HA_ADMIN_ALREADY_DONE:
+ protocol->store(STRING_WITH_LEN("status"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Table is already up to date"),
+ system_charset_info);
+ break;
+
+ case HA_ADMIN_CORRUPT:
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Corrupt"), system_charset_info);
+ fatal_error=1;
+ break;
+
+ case HA_ADMIN_INVALID:
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Invalid argument"),
+ system_charset_info);
+ break;
+
+ case HA_ADMIN_TRY_ALTER:
+ {
+ /*
+ This is currently used only by InnoDB. ha_innobase::optimize() answers
+ "try with alter", so here we close the table, do an ALTER TABLE,
+ reopen the table and do ha_innobase::analyze() on it.
+ We have to end the row, so analyze could return more rows.
+ */
+ trans_commit_stmt(thd);
+ trans_commit(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+ DEBUG_SYNC(thd, "ha_admin_try_alter");
+ protocol->store(STRING_WITH_LEN("note"), system_charset_info);
+ protocol->store(STRING_WITH_LEN(
+ "Table does not support optimize, doing recreate + analyze instead"),
+ system_charset_info);
+ if (protocol->write())
+ goto err;
+ DBUG_PRINT("info", ("HA_ADMIN_TRY_ALTER, trying analyze..."));
+ TABLE_LIST *save_next_local= table->next_local,
+ *save_next_global= table->next_global;
+ table->next_local= table->next_global= 0;
+ tmp_disable_binlog(thd); // binlogging is done by caller if wanted
+ result_code= mysql_recreate_table(thd, table);
+ reenable_binlog(thd);
+ /*
+ mysql_recreate_table() can push OK or ERROR.
+ Clear 'OK' status. If there is an error, keep it:
+ we will store the error message in a result set row
+ and then clear.
+ */
+ if (thd->stmt_da->is_ok())
+ thd->stmt_da->reset_diagnostics_area();
+ trans_commit_stmt(thd);
+ trans_commit(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+ table->table= NULL;
+ if (!result_code) // recreation went ok
+ {
+ /* Clear the ticket released above. */
+ table->mdl_request.ticket= NULL;
+ DEBUG_SYNC(thd, "ha_admin_open_ltable");
+ table->mdl_request.set_type(MDL_SHARED_WRITE);
+ if ((table->table= open_ltable(thd, table, lock_type, 0)))
+ {
+ result_code= table->table->file->ha_analyze(thd, check_opt);
+ if (result_code == HA_ADMIN_ALREADY_DONE)
+ result_code= HA_ADMIN_OK;
+ else if (result_code) // analyze failed
+ table->table->file->print_error(result_code, MYF(0));
+ }
+ else
+ result_code= -1; // open failed
+ }
+ /* Start a new row for the final status row */
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store(operator_name, system_charset_info);
+ if (result_code) // either mysql_recreate_table or analyze failed
+ {
+ DBUG_ASSERT(thd->is_error());
+ if (thd->is_error())
+ {
+ const char *err_msg= thd->stmt_da->message();
+ if (!thd->vio_ok())
+ {
+ sql_print_error("%s", err_msg);
+ }
+ else
+ {
+ /* Hijack the row already in-progress. */
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ protocol->store(err_msg, system_charset_info);
+ if (protocol->write())
+ goto err;
+ /* Start off another row for HA_ADMIN_FAILED */
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store(operator_name, system_charset_info);
+ }
+ thd->clear_error();
+ }
+ }
+ result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
+ table->next_local= save_next_local;
+ table->next_global= save_next_global;
+ goto send_result_message;
+ }
+ case HA_ADMIN_WRONG_CHECKSUM:
+ {
+ protocol->store(STRING_WITH_LEN("note"), system_charset_info);
+ protocol->store(ER(ER_VIEW_CHECKSUM), strlen(ER(ER_VIEW_CHECKSUM)),
+ system_charset_info);
+ break;
+ }
+
+ case HA_ADMIN_NEEDS_UPGRADE:
+ case HA_ADMIN_NEEDS_ALTER:
+ {
+ char buf[MYSQL_ERRMSG_SIZE];
+ size_t length;
+
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ length=my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
+ table->table_name);
+ protocol->store(buf, length, system_charset_info);
+ fatal_error=1;
+ break;
+ }
+
+ default: // Probably HA_ADMIN_INTERNAL_ERROR
+ {
+ char buf[MYSQL_ERRMSG_SIZE];
+ size_t length=my_snprintf(buf, sizeof(buf),
+ "Unknown - internal error %d during operation",
+ result_code);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ protocol->store(buf, length, system_charset_info);
+ fatal_error=1;
+ break;
+ }
+ }
+ if (table->table)
+ {
+ if (table->table->s->tmp_table)
+ {
+ /*
+ If the table was not opened successfully, do not try to get
+ status information. (Bug#47633)
+ */
+ if (open_for_modify && !open_error)
+ table->table->file->info(HA_STATUS_CONST);
+ }
+ else if (open_for_modify || fatal_error)
+ {
+ tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+ table->db, table->table_name, FALSE);
+ /*
+ May be something modified. Consequently, we have to
+ invalidate the query cache.
+ */
+ table->table= 0; // For query cache
+ query_cache_invalidate3(thd, table, 0);
+ }
+ }
+ /* Error path, a admin command failed. */
+ trans_commit_stmt(thd);
+ trans_commit_implicit(thd);
+ close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+
+ /*
+ If it is CHECK TABLE v1, v2, v3, and v1, v2, v3 are views, we will run
+ separate open_tables() for each CHECK TABLE argument.
+ Right now we do not have a separate method to reset the prelocking
+ state in the lex to the state after parsing, so each open will pollute
+ this state: add elements to lex->srotuines_list, TABLE_LISTs to
+ lex->query_tables. Below is a lame attempt to recover from this
+ pollution.
+ @todo: have a method to reset a prelocking context, or use separate
+ contexts for each open.
+ */
+ for (Sroutine_hash_entry *rt=
+ (Sroutine_hash_entry*)thd->lex->sroutines_list.first;
+ rt; rt= rt->next)
+ rt->mdl_request.ticket= NULL;
+
+ if (protocol->write())
+ goto err;
+ }
+
+ my_eof(thd);
+ DBUG_RETURN(FALSE);
+
+err:
+ trans_rollback_stmt(thd);
+ trans_rollback(thd);
+ close_thread_tables(thd); // Shouldn't be needed
+ thd->mdl_context.release_transactional_locks();
+ if (table)
+ table->table=0;
+ DBUG_RETURN(TRUE);
+}
+
+
+/*
+ Assigned specified indexes for a table into key cache
+
+ SYNOPSIS
+ mysql_assign_to_keycache()
+ thd Thread object
+ tables Table list (one table only)
+
+ RETURN VALUES
+ FALSE ok
+ TRUE error
+*/
+
+bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
+ LEX_STRING *key_cache_name)
+{
+ HA_CHECK_OPT check_opt;
+ KEY_CACHE *key_cache;
+ DBUG_ENTER("mysql_assign_to_keycache");
+
+ check_opt.init();
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ if (!(key_cache= get_key_cache(key_cache_name)))
+ {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str);
+ DBUG_RETURN(TRUE);
+ }
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ check_opt.key_cache= key_cache;
+ DBUG_RETURN(mysql_admin_table(thd, tables, &check_opt,
+ "assign_to_keycache", TL_READ_NO_INSERT, 0, 0,
+ 0, 0, &handler::assign_to_keycache, 0));
+}
+
+
+/*
+ Preload specified indexes for a table into key cache
+
+ SYNOPSIS
+ mysql_preload_keys()
+ thd Thread object
+ tables Table list (one table only)
+
+ RETURN VALUES
+ FALSE ok
+ TRUE error
+*/
+
+bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
+{
+ DBUG_ENTER("mysql_preload_keys");
+ /*
+ We cannot allow concurrent inserts. The storage engine reads
+ directly from the index file, bypassing the cache. It could read
+ outdated information if parallel inserts into cache blocks happen.
+ */
+ DBUG_RETURN(mysql_admin_table(thd, tables, 0,
+ "preload_keys", TL_READ_NO_INSERT, 0, 0, 0, 0,
+ &handler::preload_keys, 0));
+}
+
+
+bool Analyze_table_statement::execute(THD *thd)
+{
+ TABLE_LIST *first_table= m_lex->select_lex.table_list.first;
+ bool res= TRUE;
+ thr_lock_type lock_type = TL_READ_NO_INSERT;
+ DBUG_ENTER("Analyze_table_statement::execute");
+
+ if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table,
+ FALSE, UINT_MAX, FALSE))
+ goto error;
+ thd->enable_slow_log= opt_log_slow_admin_statements;
+ res= mysql_admin_table(thd, first_table, &m_lex->check_opt,
+ "analyze", lock_type, 1, 0, 0, 0,
+ &handler::ha_analyze, 0);
+ /* ! we write after unlocking the table */
+ if (!res && !m_lex->no_write_to_binlog)
+ {
+ /*
+ Presumably, ANALYZE and binlog writing doesn't require synchronization
+ */
+ res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+ }
+ m_lex->select_lex.table_list.first= first_table;
+ m_lex->query_tables= first_table;
+
+error:
+ DBUG_RETURN(res);
+}
+
+
+bool Check_table_statement::execute(THD *thd)
+{
+ TABLE_LIST *first_table= m_lex->select_lex.table_list.first;
+ thr_lock_type lock_type = TL_READ_NO_INSERT;
+ bool res= TRUE;
+ DBUG_ENTER("Check_table_statement::execute");
+
+ if (check_table_access(thd, SELECT_ACL, first_table,
+ TRUE, UINT_MAX, FALSE))
+ goto error; /* purecov: inspected */
+ thd->enable_slow_log= opt_log_slow_admin_statements;
+
+ res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "check",
+ lock_type, 0, 0, HA_OPEN_FOR_REPAIR, 0,
+ &handler::ha_check, &view_checksum);
+
+ m_lex->select_lex.table_list.first= first_table;
+ m_lex->query_tables= first_table;
+
+error:
+ DBUG_RETURN(res);
+}
+
+
+bool Optimize_table_statement::execute(THD *thd)
+{
+ TABLE_LIST *first_table= m_lex->select_lex.table_list.first;
+ bool res= TRUE;
+ DBUG_ENTER("Optimize_table_statement::execute");
+
+ if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table,
+ FALSE, UINT_MAX, FALSE))
+ goto error; /* purecov: inspected */
+ thd->enable_slow_log= opt_log_slow_admin_statements;
+ res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ?
+ mysql_recreate_table(thd, first_table) :
+ mysql_admin_table(thd, first_table, &m_lex->check_opt,
+ "optimize", TL_WRITE, 1, 0, 0, 0,
+ &handler::ha_optimize, 0);
+ /* ! we write after unlocking the table */
+ if (!res && !m_lex->no_write_to_binlog)
+ {
+ /*
+ Presumably, OPTIMIZE and binlog writing doesn't require synchronization
+ */
+ res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+ }
+ m_lex->select_lex.table_list.first= first_table;
+ m_lex->query_tables= first_table;
+
+error:
+ DBUG_RETURN(res);
+}
+
+
+bool Repair_table_statement::execute(THD *thd)
+{
+ TABLE_LIST *first_table= m_lex->select_lex.table_list.first;
+ bool res= TRUE;
+ DBUG_ENTER("Repair_table_statement::execute");
+
+ if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table,
+ FALSE, UINT_MAX, FALSE))
+ goto error; /* purecov: inspected */
+ thd->enable_slow_log= opt_log_slow_admin_statements;
+ res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "repair",
+ TL_WRITE, 1,
+ test(m_lex->check_opt.sql_flags & TT_USEFRM),
+ HA_OPEN_FOR_REPAIR, &prepare_for_repair,
+ &handler::ha_repair, 0);
+
+ /* ! we write after unlocking the table */
+ if (!res && !m_lex->no_write_to_binlog)
+ {
+ /*
+ Presumably, REPAIR and binlog writing doesn't require synchronization
+ */
+ res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+ }
+ m_lex->select_lex.table_list.first= first_table;
+ m_lex->query_tables= first_table;
+
+error:
+ DBUG_RETURN(res);
+}
diff --git a/sql/sql_admin.h b/sql/sql_admin.h
new file mode 100644
index 00000000000..fdfffec8361
--- /dev/null
+++ b/sql/sql_admin.h
@@ -0,0 +1,132 @@
+/* Copyright (c) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_TABLE_MAINTENANCE_H
+#define SQL_TABLE_MAINTENANCE_H
+
+
+bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
+ LEX_STRING *key_cache_name);
+bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
+int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
+ KEY_CACHE *dst_cache);
+
+/**
+ Analyze_statement represents the ANALYZE TABLE statement.
+*/
+class Analyze_table_statement : public Sql_statement
+{
+public:
+ /**
+ Constructor, used to represent a ANALYZE TABLE statement.
+ @param lex the LEX structure for this statement.
+ */
+ Analyze_table_statement(LEX *lex)
+ : Sql_statement(lex)
+ {}
+
+ ~Analyze_table_statement()
+ {}
+
+ /**
+ Execute a ANALYZE TABLE statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+
+
+/**
+ Check_table_statement represents the CHECK TABLE statement.
+*/
+class Check_table_statement : public Sql_statement
+{
+public:
+ /**
+ Constructor, used to represent a CHECK TABLE statement.
+ @param lex the LEX structure for this statement.
+ */
+ Check_table_statement(LEX *lex)
+ : Sql_statement(lex)
+ {}
+
+ ~Check_table_statement()
+ {}
+
+ /**
+ Execute a CHECK TABLE statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+
+
+/**
+ Optimize_table_statement represents the OPTIMIZE TABLE statement.
+*/
+class Optimize_table_statement : public Sql_statement
+{
+public:
+ /**
+ Constructor, used to represent a OPTIMIZE TABLE statement.
+ @param lex the LEX structure for this statement.
+ */
+ Optimize_table_statement(LEX *lex)
+ : Sql_statement(lex)
+ {}
+
+ ~Optimize_table_statement()
+ {}
+
+ /**
+ Execute a OPTIMIZE TABLE statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+
+
+/**
+ Repair_table_statement represents the REPAIR TABLE statement.
+*/
+class Repair_table_statement : public Sql_statement
+{
+public:
+ /**
+ Constructor, used to represent a REPAIR TABLE statement.
+ @param lex the LEX structure for this statement.
+ */
+ Repair_table_statement(LEX *lex)
+ : Sql_statement(lex)
+ {}
+
+ ~Repair_table_statement()
+ {}
+
+ /**
+ Execute a REPAIR TABLE statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+#endif
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
new file mode 100644
index 00000000000..046e09b20a3
--- /dev/null
+++ b/sql/sql_alter.cc
@@ -0,0 +1,106 @@
+/* Copyright (c) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "sql_parse.h" // check_access,
+ // check_merge_table_access
+#include "sql_table.h" // mysql_alter_table,
+ // mysql_exchange_partition
+#include "sql_alter.h"
+
+bool Alter_table_statement::execute(THD *thd)
+{
+ LEX *lex= thd->lex;
+ /* 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;
+ /*
+ Code in mysql_alter_table() may modify its HA_CREATE_INFO argument,
+ so we have to use a copy of this structure to make execution
+ prepared statement- safe. A shallow copy is enough as no memory
+ referenced from this structure will be modified.
+ @todo move these into constructor...
+ */
+ HA_CREATE_INFO create_info(lex->create_info);
+ Alter_info alter_info(lex->alter_info, thd->mem_root);
+ ulong priv=0;
+ ulong priv_needed= ALTER_ACL;
+ bool result;
+
+ DBUG_ENTER("Alter_table_statement::execute");
+
+ if (thd->is_fatal_error) /* out of memory creating a copy of alter_info */
+ DBUG_RETURN(TRUE);
+ /*
+ We also require DROP priv for ALTER TABLE ... DROP PARTITION, as well
+ as for RENAME TO, as being done by SQLCOM_RENAME_TABLE
+ */
+ if (alter_info.flags & (ALTER_DROP_PARTITION | ALTER_RENAME))
+ priv_needed|= DROP_ACL;
+
+ /* Must be set in the parser */
+ DBUG_ASSERT(select_lex->db);
+ DBUG_ASSERT(!(alter_info.flags & ALTER_ADMIN_PARTITION));
+ if (check_access(thd, priv_needed, first_table->db,
+ &first_table->grant.privilege,
+ &first_table->grant.m_internal,
+ 0, 0) ||
+ check_access(thd, INSERT_ACL | CREATE_ACL, select_lex->db,
+ &priv,
+ NULL, /* Don't use first_tab->grant with sel_lex->db */
+ 0, 0) ||
+ check_merge_table_access(thd, first_table->db,
+ create_info.merge_list.first))
+ DBUG_RETURN(TRUE); /* purecov: inspected */
+
+ if (check_grant(thd, priv_needed, first_table, FALSE, UINT_MAX, FALSE))
+ DBUG_RETURN(TRUE); /* purecov: inspected */
+
+ if (lex->name.str && !test_all_bits(priv, INSERT_ACL | CREATE_ACL))
+ {
+ // Rename of table
+ TABLE_LIST tmp_table;
+ bzero((char*) &tmp_table,sizeof(tmp_table));
+ tmp_table.table_name= lex->name.str;
+ tmp_table.db= select_lex->db;
+ tmp_table.grant.privilege= priv;
+ if (check_grant(thd, INSERT_ACL | CREATE_ACL, &tmp_table, FALSE,
+ UINT_MAX, FALSE))
+ DBUG_RETURN(TRUE); /* purecov: inspected */
+ }
+
+ /* Don't yet allow changing of symlinks with ALTER TABLE */
+ if (create_info.data_file_name)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "DATA DIRECTORY");
+ if (create_info.index_file_name)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "INDEX DIRECTORY");
+ create_info.data_file_name= create_info.index_file_name= NULL;
+
+ thd->enable_slow_log= opt_log_slow_admin_statements;
+
+ result= mysql_alter_table(thd, select_lex->db, lex->name.str,
+ &create_info,
+ first_table,
+ &alter_info,
+ select_lex->order_list.elements,
+ select_lex->order_list.first,
+ lex->ignore);
+
+ DBUG_RETURN(result);
+}
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
new file mode 100644
index 00000000000..6a17f87f5a4
--- /dev/null
+++ b/sql/sql_alter.h
@@ -0,0 +1,66 @@
+/* Copyright (c) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_ALTER_TABLE_H
+#define SQL_ALTER_TABLE_H
+
+/**
+ Alter_table_common represents the common properties of the ALTER TABLE
+ statements.
+ @todo move Alter_info and other ALTER generic structures from Lex here.
+*/
+class Alter_table_common : public Sql_statement
+{
+protected:
+ /**
+ Constructor.
+ @param lex the LEX structure for this statement.
+ */
+ Alter_table_common(LEX *lex)
+ : Sql_statement(lex)
+ {}
+
+ virtual ~Alter_table_common()
+ {}
+
+};
+
+/**
+ Alter_table_statement represents the generic ALTER TABLE statement.
+ @todo move Alter_info and other ALTER specific structures from Lex here.
+*/
+class Alter_table_statement : public Alter_table_common
+{
+public:
+ /**
+ Constructor, used to represent a ALTER TABLE statement.
+ @param lex the LEX structure for this statement.
+ */
+ Alter_table_statement(LEX *lex)
+ : Alter_table_common(lex)
+ {}
+
+ ~Alter_table_statement()
+ {}
+
+ /**
+ Execute a ALTER TABLE statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+#endif
diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc
index 7d269d455a9..b7d363dc09a 100644
--- a/sql/sql_audit.cc
+++ b/sql/sql_audit.cc
@@ -138,6 +138,30 @@ static my_bool acquire_plugins(THD *thd, plugin_ref plugin, void *arg)
/**
+ @brief Acquire audit plugins
+
+ @param[in] thd MySQL thread handle
+ @param[in] event_class Audit event class
+
+ @details Ensure that audit plugins interested in given event
+ class are locked by current thread.
+*/
+void mysql_audit_acquire_plugins(THD *thd, uint event_class)
+{
+ unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
+ DBUG_ENTER("mysql_audit_acquire_plugins");
+ set_audit_mask(event_class_mask, event_class);
+ if (thd && !check_audit_mask(mysql_global_audit_mask, event_class_mask) &&
+ check_audit_mask(thd->audit_class_mask, event_class_mask))
+ {
+ plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, &event_class);
+ add_audit_mask(thd->audit_class_mask, event_class_mask);
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+/**
Notify the audit system of an event
@param[in] thd
@@ -151,21 +175,8 @@ void mysql_audit_notify(THD *thd, uint event_class, uint event_subtype, ...)
{
va_list ap;
audit_handler_t *handlers= audit_handlers + event_class;
- unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
-
DBUG_ASSERT(event_class < audit_handlers_count);
-
- set_audit_mask(event_class_mask, event_class);
- /*
- Check to see if we have acquired the audit plugins for the
- required audit event classes.
- */
- if (thd && check_audit_mask(thd->audit_class_mask, event_class_mask))
- {
- plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, &event_class);
- add_audit_mask(thd->audit_class_mask, event_class_mask);
- }
-
+ mysql_audit_acquire_plugins(thd, event_class);
va_start(ap, event_subtype);
(*handlers)(thd, event_subtype, ap);
va_end(ap);
@@ -448,6 +459,11 @@ static void event_class_dispatch(THD *thd, const struct mysql_event *event)
#else /* EMBEDDED_LIBRARY */
+void mysql_audit_acquire_plugins(THD *thd, uint event_class)
+{
+}
+
+
void mysql_audit_initialize()
{
}
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index aad868dc1ab..7cb40181bd7 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -29,6 +29,7 @@ extern void mysql_audit_finalize();
extern void mysql_audit_init_thd(THD *thd);
extern void mysql_audit_free_thd(THD *thd);
+extern void mysql_audit_acquire_plugins(THD *thd, uint event_class);
extern void mysql_audit_notify(THD *thd, uint event_class,
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index e810d5fc091..b168f561954 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -59,42 +59,13 @@
#endif
-/**
- This internal handler is used to trap internally
- errors that can occur when executing open table
- during the prelocking phase.
-*/
-class Prelock_error_handler : public Internal_error_handler
-{
-public:
- Prelock_error_handler()
- : m_handled_errors(0), m_unhandled_errors(0)
- {}
-
- virtual ~Prelock_error_handler() {}
-
- virtual bool handle_condition(THD *thd,
- uint sql_errno,
- const char* sqlstate,
- MYSQL_ERROR::enum_warning_level level,
- const char* msg,
- MYSQL_ERROR ** cond_hdl);
-
- bool safely_trapped_errors();
-
-private:
- int m_handled_errors;
- int m_unhandled_errors;
-};
-
-
bool
-Prelock_error_handler::handle_condition(THD *,
- uint sql_errno,
- const char*,
- MYSQL_ERROR::enum_warning_level,
- const char*,
- MYSQL_ERROR ** cond_hdl)
+No_such_table_error_handler::handle_condition(THD *,
+ uint sql_errno,
+ const char*,
+ MYSQL_ERROR::enum_warning_level,
+ const char*,
+ MYSQL_ERROR ** cond_hdl)
{
*cond_hdl= NULL;
if (sql_errno == ER_NO_SUCH_TABLE)
@@ -108,7 +79,7 @@ Prelock_error_handler::handle_condition(THD *,
}
-bool Prelock_error_handler::safely_trapped_errors()
+bool No_such_table_error_handler::safely_trapped_errors()
{
/*
If m_unhandled_errors != 0, something else, unanticipated, happened,
@@ -124,6 +95,40 @@ bool Prelock_error_handler::safely_trapped_errors()
*/
/**
+ Protects table_def_hash, used and unused lists in the
+ TABLE_SHARE object, LRU lists of used TABLEs and used
+ TABLE_SHAREs, refresh_version and the table id counter.
+*/
+mysql_mutex_t LOCK_open;
+mysql_mutex_t LOCK_dd_owns_lock_open;
+uint dd_owns_lock_open= 0;
+
+#ifdef HAVE_PSI_INTERFACE
+static PSI_mutex_key key_LOCK_open;
+static PSI_mutex_info all_tdc_mutexes[]= {
+ { &key_LOCK_open, "LOCK_open", PSI_FLAG_GLOBAL }
+};
+
+/**
+ Initialize performance schema instrumentation points
+ used by the table cache.
+*/
+
+static void init_tdc_psi_keys(void)
+{
+ const char *category= "sql";
+ int count;
+
+ if (PSI_server == NULL)
+ return;
+
+ count= array_elements(all_tdc_mutexes);
+ PSI_server->register_mutex(category, all_tdc_mutexes, count);
+}
+#endif /* HAVE_PSI_INTERFACE */
+
+
+/**
Total number of TABLE instances for tables in the table definition cache
(both in use by threads and not in use). This value is accessible to user
as "Open_tables" status variable.
@@ -146,9 +151,6 @@ static bool check_and_update_table_version(THD *thd, TABLE_LIST *tables,
static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry);
static bool auto_repair_table(THD *thd, TABLE_LIST *table_list);
static void free_cache_entry(TABLE *entry);
-static bool tdc_wait_for_old_versions(THD *thd,
- MDL_request_list *mdl_requests,
- ulong timeout);
static bool
has_write_table_with_auto_increment(TABLE_LIST *tables);
@@ -294,9 +296,15 @@ static void table_def_free_entry(TABLE_SHARE *share)
bool table_def_init(void)
{
table_def_inited= 1;
+#ifdef HAVE_PSI_INTERFACE
+ init_tdc_psi_keys();
+#endif
+ mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(NULL, &LOCK_dd_owns_lock_open, MY_MUTEX_INIT_FAST);
oldest_unused_share= &end_of_unused_share;
end_of_unused_share.prev= &oldest_unused_share;
+
return my_hash_init(&table_def_cache, &my_charset_bin, table_def_size,
0, 0, table_def_key,
(my_hash_free_key) table_def_free_entry, 0) != 0;
@@ -314,8 +322,6 @@ void table_def_start_shutdown(void)
if (table_def_inited)
{
mysql_mutex_lock(&LOCK_open);
- /* Free all cached but unused TABLEs and TABLE_SHAREs first. */
- close_cached_tables(NULL, NULL, TRUE, FALSE);
/*
Ensure that TABLE and TABLE_SHARE objects which are created for
tables that are open during process of plugins' shutdown are
@@ -324,6 +330,8 @@ void table_def_start_shutdown(void)
*/
table_def_shutdown_in_progress= TRUE;
mysql_mutex_unlock(&LOCK_open);
+ /* Free all cached but unused TABLEs and TABLE_SHAREs. */
+ close_cached_tables(NULL, NULL, FALSE, LONG_TIMEOUT);
}
}
@@ -336,6 +344,8 @@ void table_def_free(void)
table_def_inited= 0;
/* Free table definitions. */
my_hash_free(&table_def_cache);
+ mysql_mutex_destroy(&LOCK_dd_owns_lock_open);
+ mysql_mutex_destroy(&LOCK_open);
}
DBUG_VOID_RETURN;
}
@@ -441,7 +451,7 @@ static void table_def_unuse_table(TABLE *table)
DBUG_ASSERT(table->in_use);
/* We shouldn't put the table to 'unused' list if the share is old. */
- DBUG_ASSERT(! table->s->needs_reopen());
+ DBUG_ASSERT(! table->s->has_old_version());
table->in_use= 0;
/* Remove table from the list of tables used in this share. */
@@ -516,10 +526,10 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
}
/*
- We assign a new table id under the protection of the LOCK_open and
- the share's own mutex. We do this insted of creating a new mutex
+ We assign a new table id under the protection of LOCK_open.
+ We do this instead of creating a new mutex
and using it for the sole purpose of serializing accesses to a
- static variable, we assign the table id here. We assign it to the
+ static variable, we assign the table id here. We assign it to the
share before inserting it into the table_def_cache to be really
sure that it cannot be read from the cache without having a table
id assigned.
@@ -547,7 +557,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
DBUG_RETURN(share);
found:
- /*
+ /*
We found an existing table definition. Return it if we didn't get
an error when reading the table definition from file.
*/
@@ -589,21 +599,21 @@ found:
}
-/*
+/**
Get a table share. If it didn't exist, try creating it from engine
- For arguments and return values, see get_table_from_share()
+ For arguments and return values, see get_table_share()
*/
-static TABLE_SHARE
-*get_table_share_with_create(THD *thd, TABLE_LIST *table_list,
- char *key, uint key_length,
- uint db_flags, int *error,
- my_hash_value_type hash_value)
+static TABLE_SHARE *
+get_table_share_with_discover(THD *thd, TABLE_LIST *table_list,
+ char *key, uint key_length,
+ uint db_flags, int *error,
+ my_hash_value_type hash_value)
{
TABLE_SHARE *share;
- int tmp;
+ bool exists;
DBUG_ENTER("get_table_share_with_create");
share= get_table_share(thd, table_list, key, key_length, db_flags, error,
@@ -617,10 +627,15 @@ static TABLE_SHARE
from the pre-locking list. In this case we still need to try
auto-discover before returning a NULL share.
+ Or, we're inside SHOW CREATE VIEW, which
+ also installs a silencer for ER_NO_SUCH_TABLE error.
+
If share is NULL and the error is ER_NO_SUCH_TABLE, this is
- the same as above, only that the error was not silenced by
- pre-locking. Once again, we need to try to auto-discover
- the share.
+ the same as above, only that the error was not silenced by
+ pre-locking or SHOW CREATE VIEW.
+
+ In both these cases it won't harm to try to discover the
+ table.
Finally, if share is still NULL, it's a real error and we need
to abort.
@@ -628,20 +643,25 @@ static TABLE_SHARE
@todo Rework alternative ways to deal with ER_NO_SUCH TABLE.
*/
if (share || (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE))
-
DBUG_RETURN(share);
+ *error= 0;
+
/* Table didn't exist. Check if some engine can provide it */
- tmp= ha_create_table_from_engine(thd, table_list->db,
- table_list->table_name);
- if (tmp < 0)
+ if (ha_check_if_table_exists(thd, table_list->db, table_list->table_name,
+ &exists))
+ {
+ thd->clear_error();
+ /* Conventionally, the storage engine API does not report errors. */
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ }
+ else if (! exists)
{
/*
No such table in any engine.
Hide "Table doesn't exist" errors if the table belongs to a view.
The check for thd->is_error() is necessary to not push an
- unwanted error in case of pre-locking, which silences
- "no such table" errors.
+ unwanted error in case the error was already silenced.
@todo Rework the alternative ways to deal with ER_NO_SUCH TABLE.
*/
if (thd->is_error())
@@ -659,27 +679,16 @@ static TABLE_SHARE
view->view_db.str, view->view_name.str);
}
}
- DBUG_RETURN(0);
}
- if (tmp)
+ else
{
- /* Give right error message */
thd->clear_error();
- DBUG_PRINT("error", ("Discovery of %s/%s failed", table_list->db,
- table_list->table_name));
- my_printf_error(ER_UNKNOWN_ERROR,
- "Failed to open '%-.64s', error while "
- "unpacking from engine",
- MYF(0), table_list->table_name);
- DBUG_RETURN(0);
+ *error= 7; /* Run auto-discover. */
}
- /* Table existed in engine. Let's open it */
- thd->warning_info->clear_warning_info(thd->query_id);
- thd->clear_error(); // Clear error message
- DBUG_RETURN(get_table_share(thd, table_list, key, key_length,
- db_flags, error, hash_value));
+ DBUG_RETURN(NULL);
}
+
/**
Mark that we are not using table share anymore.
@@ -703,7 +712,7 @@ void release_table_share(TABLE_SHARE *share)
DBUG_ASSERT(share->ref_count);
if (!--share->ref_count)
{
- if (share->needs_reopen() || table_def_shutdown_in_progress)
+ if (share->has_old_version() || table_def_shutdown_in_progress)
my_hash_delete(&table_def_cache, (uchar*) share);
else
{
@@ -890,7 +899,7 @@ void free_io_cache(TABLE *table)
@param share Table share.
- @pre Caller should have LOCK_open mutex acquired.
+ @pre Caller should have LOCK_open mutex.
*/
static void kill_delayed_threads_for_table(TABLE_SHARE *share)
@@ -926,8 +935,8 @@ static void kill_delayed_threads_for_table(TABLE_SHARE *share)
@param thd Thread context
@param tables List of tables to remove from the cache
- @param have_lock If LOCK_open is locked
@param wait_for_refresh Wait for a impending flush
+ @param timeout Timeout for waiting for flush to be completed.
@note THD can be NULL, but then wait_for_refresh must be FALSE
and tables must be NULL.
@@ -940,19 +949,28 @@ static void kill_delayed_threads_for_table(TABLE_SHARE *share)
lock taken by thread trying to obtain global read lock.
*/
-bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
- bool wait_for_refresh)
+bool close_cached_tables(THD *thd, TABLE_LIST *tables,
+ bool wait_for_refresh, ulong timeout)
{
bool result= FALSE;
bool found= TRUE;
+ struct timespec abstime;
DBUG_ENTER("close_cached_tables");
DBUG_ASSERT(thd || (!wait_for_refresh && !tables));
- if (!have_lock)
- mysql_mutex_lock(&LOCK_open);
+ mysql_mutex_lock(&LOCK_open);
if (!tables)
{
- refresh_version++; // Force close of open tables
+ /*
+ Force close of all open tables.
+
+ Note that code in TABLE_SHARE::wait_for_old_version() assumes that
+ incrementing of refresh_version and removal of unused tables and
+ shares from TDC happens atomically under protection of LOCK_open,
+ or putting it another way that TDC does not contain old shares
+ which don't have any tables used.
+ */
+ refresh_version++;
DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu",
refresh_version));
kill_delayed_threads();
@@ -978,7 +996,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
kill_delayed_threads_for_table(share);
/* tdc_remove_table() also sets TABLE_SHARE::version to 0. */
tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, table->db,
- table->table_name);
+ table->table_name, TRUE);
found=1;
}
}
@@ -986,14 +1004,12 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
wait_for_refresh=0; // Nothing to wait for
}
- if (!have_lock)
- mysql_mutex_unlock(&LOCK_open);
+ mysql_mutex_unlock(&LOCK_open);
if (!wait_for_refresh)
DBUG_RETURN(result);
- /* Code below assume that LOCK_open is released. */
- DBUG_ASSERT(!have_lock);
+ set_timespec(abstime, timeout);
if (thd->locked_tables_mode)
{
@@ -1034,6 +1050,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
while (found && ! thd->killed)
{
+ TABLE_SHARE *share;
found= FALSE;
/*
To a self-deadlock or deadlocks with other FLUSH threads
@@ -1044,15 +1061,12 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
mysql_mutex_lock(&LOCK_open);
- thd->enter_cond(&COND_refresh, &LOCK_open, "Flushing tables");
-
if (!tables)
{
for (uint idx=0 ; idx < table_def_cache.records ; idx++)
{
- TABLE_SHARE *share=(TABLE_SHARE*) my_hash_element(&table_def_cache,
- idx);
- if (share->needs_reopen())
+ share= (TABLE_SHARE*) my_hash_element(&table_def_cache, idx);
+ if (share->has_old_version())
{
found= TRUE;
break;
@@ -1063,8 +1077,8 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
{
for (TABLE_LIST *table= tables; table; table= table->next_local)
{
- TABLE_SHARE *share= get_cached_table_share(table->db, table->table_name);
- if (share && share->needs_reopen())
+ share= get_cached_table_share(table->db, table->table_name);
+ if (share && share->has_old_version())
{
found= TRUE;
break;
@@ -1074,11 +1088,20 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
if (found)
{
- DBUG_PRINT("signal", ("Waiting for COND_refresh"));
- mysql_cond_wait(&COND_refresh, &LOCK_open);
+ /*
+ The method below temporarily unlocks LOCK_open and frees
+ share's memory.
+ */
+ if (share->wait_for_old_version(thd, &abstime,
+ MDL_wait_for_subgraph::DEADLOCK_WEIGHT_DDL))
+ {
+ mysql_mutex_unlock(&LOCK_open);
+ result= TRUE;
+ goto err_with_reopen;
+ }
}
- thd->exit_cond(NULL);
+ mysql_mutex_unlock(&LOCK_open);
}
err_with_reopen:
@@ -1102,13 +1125,12 @@ err_with_reopen:
}
-/*
+/**
Close all tables which match specified connection string or
if specified string is NULL, then any table with a connection string.
*/
-bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh,
- LEX_STRING *connection, bool have_lock)
+bool close_cached_connection_tables(THD *thd, LEX_STRING *connection)
{
uint idx;
TABLE_LIST tmp, *tables= NULL;
@@ -1118,8 +1140,7 @@ bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh,
bzero(&tmp, sizeof(TABLE_LIST));
- if (!have_lock)
- mysql_mutex_lock(&LOCK_open);
+ mysql_mutex_lock(&LOCK_open);
for (idx= 0; idx < table_def_cache.records; idx++)
{
@@ -1147,21 +1168,10 @@ bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh,
tables= (TABLE_LIST *) memdup_root(thd->mem_root, (char*)&tmp,
sizeof(TABLE_LIST));
}
+ mysql_mutex_unlock(&LOCK_open);
if (tables)
- result= close_cached_tables(thd, tables, TRUE, FALSE);
-
- if (!have_lock)
- mysql_mutex_unlock(&LOCK_open);
-
- if (if_wait_for_refresh)
- {
- mysql_mutex_lock(&thd->mysys_var->mutex);
- thd->mysys_var->current_mutex= 0;
- thd->mysys_var->current_cond= 0;
- thd->proc_info=0;
- mysql_mutex_unlock(&thd->mysys_var->mutex);
- }
+ result= close_cached_tables(thd, tables, FALSE, LONG_TIMEOUT);
DBUG_RETURN(result);
}
@@ -1355,9 +1365,8 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
}
}
/* Remove the table share from the cache. */
- mysql_mutex_lock(&LOCK_open);
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db, table_name);
- mysql_mutex_unlock(&LOCK_open);
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db, table_name,
+ FALSE);
/*
There could be a FLUSH thread waiting
on the table to go away. Wake it up.
@@ -1500,9 +1509,6 @@ void close_thread_tables(THD *thd)
thd->lock=0;
}
/*
- Note that we need to hold LOCK_open while changing the
- open_tables list. Another thread may work on it.
- (See: mysql_notify_thread_having_shared_lock())
Closing a MERGE child before the parent would be fatal if the
other thread tries to abort the MERGE lock in between.
*/
@@ -1548,7 +1554,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
mysql_mutex_lock(&LOCK_open);
- if (table->s->needs_reopen() || table->needs_reopen() ||
+ if (table->s->has_old_version() || table->needs_reopen() ||
table_def_shutdown_in_progress)
{
free_cache_entry(table);
@@ -2042,13 +2048,17 @@ TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list)
thd->temporary_tables list, it's impossible to tell here whether
we're dealing with an internal or a user temporary table.
+ If is_trans is not null, we return the type of the table:
+ either transactional (e.g. innodb) as TRUE or non-transactional
+ (e.g. myisam) as FALSE.
+
@retval 0 the table was found and dropped successfully.
@retval 1 the table was not found in the list of temporary tables
of this thread
@retval -1 the table is in use by a outer query
*/
-int drop_temporary_table(THD *thd, TABLE_LIST *table_list)
+int drop_temporary_table(THD *thd, TABLE_LIST *table_list, bool *is_trans)
{
TABLE *table;
DBUG_ENTER("drop_temporary_table");
@@ -2065,6 +2075,9 @@ int drop_temporary_table(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(-1);
}
+ if (is_trans != NULL)
+ *is_trans= table->file->has_transactions();
+
/*
If LOCK TABLES list is not empty and contains this table,
unlock the table and remove the table from this list.
@@ -2201,10 +2214,9 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
table->mdl_ticket, thd->variables.lock_wait_timeout))
DBUG_RETURN(TRUE);
- mysql_mutex_lock(&LOCK_open);
tdc_remove_table(thd, TDC_RT_REMOVE_NOT_OWN,
- table->s->db.str, table->s->table_name.str);
- mysql_mutex_unlock(&LOCK_open);
+ table->s->db.str, table->s->table_name.str,
+ FALSE);
/* extra() call must come only after all instances above are closed */
(void) table->file->extra(function);
DBUG_RETURN(FALSE);
@@ -2245,9 +2257,8 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
close_thread_table(thd, &thd->open_tables);
/* Remove the table share from the table cache. */
- mysql_mutex_lock(&LOCK_open);
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db_name, table_name);
- mysql_mutex_unlock(&LOCK_open);
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db_name, table_name,
+ FALSE);
/* Remove the table from the storage engine and rm the .frm. */
quick_rm_table(table_type, db_name, table_name, 0);
}
@@ -2265,8 +2276,6 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
exists and to FALSE otherwise.
@note This function acquires LOCK_open internally.
- It also assumes that the fact that there are no exclusive
- metadata locks on the table was checked beforehand.
@note If there is no .FRM file for the table but it exists in one
of engines (e.g. it was created on another node of NDB cluster)
@@ -2279,16 +2288,20 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists)
{
char path[FN_REFLEN + 1];
- int rc= 0;
+ TABLE_SHARE *share;
DBUG_ENTER("check_if_table_exists");
- mysql_mutex_assert_not_owner(&LOCK_open);
-
*exists= TRUE;
+ DBUG_ASSERT(thd->mdl_context.
+ is_lock_owner(MDL_key::TABLE, table->db,
+ table->table_name, MDL_SHARED));
+
mysql_mutex_lock(&LOCK_open);
+ share= get_cached_table_share(table->db, table->table_name);
+ mysql_mutex_unlock(&LOCK_open);
- if (get_cached_table_share(table->db, table->table_name))
+ if (share)
goto end;
build_table_filename(path, sizeof(path) - 1, table->db, table->table_name,
@@ -2298,24 +2311,14 @@ bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists)
goto end;
/* .FRM file doesn't exist. Check if some engine can provide it. */
-
- rc= ha_create_table_from_engine(thd, table->db, table->table_name);
-
- if (rc < 0)
- {
- /* Table does not exists in engines as well. */
- *exists= FALSE;
- rc= 0;
- }
- else if (rc)
+ if (ha_check_if_table_exists(thd, table->db, table->table_name, exists))
{
- my_printf_error(ER_UNKNOWN_ERROR, "Failed to open '%-.64s', error while "
+ my_printf_error(ER_OUT_OF_RESOURCES, "Failed to open '%-.64s', error while "
"unpacking from engine", MYF(0), table->table_name);
+ DBUG_RETURN(TRUE);
}
-
end:
- mysql_mutex_unlock(&LOCK_open);
- DBUG_RETURN(test(rc));
+ DBUG_RETURN(FALSE);
}
@@ -2365,8 +2368,9 @@ bool MDL_deadlock_handler::handle_condition(THD *,
{
/* Disable the handler to avoid infinite recursion. */
m_is_active= TRUE;
- (void) m_ot_ctx->request_backoff_action(Open_table_context::OT_MDL_CONFLICT,
- NULL);
+ (void) m_ot_ctx->request_backoff_action(
+ Open_table_context::OT_BACKOFF_AND_RETRY,
+ NULL);
m_is_active= FALSE;
/*
If the above back-off request failed, a new instance of
@@ -2412,6 +2416,8 @@ open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
uint flags,
MDL_ticket **mdl_ticket)
{
+ MDL_request mdl_request_shared;
+
if (flags & (MYSQL_OPEN_FORCE_SHARED_MDL |
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL))
{
@@ -2437,16 +2443,12 @@ open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
DBUG_ASSERT(!(flags & MYSQL_OPEN_FORCE_SHARED_MDL) ||
!(flags & MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL));
- mdl_request= new (thd->mem_root) MDL_request(mdl_request);
- if (mdl_request == NULL)
- return TRUE;
-
- mdl_request->set_type((flags & MYSQL_OPEN_FORCE_SHARED_MDL) ?
- MDL_SHARED : MDL_SHARED_HIGH_PRIO);
+ mdl_request_shared.init(&mdl_request->key,
+ (flags & MYSQL_OPEN_FORCE_SHARED_MDL) ?
+ MDL_SHARED : MDL_SHARED_HIGH_PRIO);
+ mdl_request= &mdl_request_shared;
}
- ot_ctx->add_request(mdl_request);
-
if (flags & MYSQL_OPEN_FAIL_ON_MDL_CONFLICT)
{
/*
@@ -2509,6 +2511,40 @@ open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
}
+/**
+ Check if table's share is being removed from the table definition
+ cache and, if yes, wait until the flush is complete.
+
+ @param thd Thread context.
+ @param table_list Table which share should be checked.
+ @param timeout Timeout for waiting.
+ @param deadlock_weight Weight of this wait for deadlock detector.
+
+ @retval FALSE Success. Share is up to date or has been flushed.
+ @retval TRUE Error (OOM, our was killed, the wait resulted
+ in a deadlock or timeout). Reported.
+*/
+
+static bool
+tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name,
+ ulong wait_timeout, uint deadlock_weight)
+{
+ TABLE_SHARE *share;
+ bool res= FALSE;
+
+ mysql_mutex_lock(&LOCK_open);
+ if ((share= get_cached_table_share(db, table_name)) &&
+ share->has_old_version())
+ {
+ struct timespec abstime;
+ set_timespec(abstime, wait_timeout);
+ res= share->wait_for_old_version(thd, &abstime, deadlock_weight);
+ }
+ mysql_mutex_unlock(&LOCK_open);
+ return res;
+}
+
+
/*
Open a table.
@@ -2540,10 +2576,6 @@ open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
is never opened. In both cases, metadata locks are always taken according
to the lock strategy.
- If the lock strategy is OTLS_DOWNGRADE_IF_EXISTS and opening the table
- is successful, the exclusive metadata lock acquired by the caller
- is downgraded to a shared lock.
-
RETURN
TRUE Open failed. "action" parameter may contain type of action
needed to remedy problem before retrying again.
@@ -2598,8 +2630,8 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (thd->open_tables && thd->open_tables->s->version != refresh_version)
{
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_TDC,
- NULL);
+ (void)ot_ctx->request_backoff_action(Open_table_context::OT_REOPEN_TABLES,
+ NULL);
DBUG_RETURN(TRUE);
}
}
@@ -2810,13 +2842,29 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
else if (table_list->open_strategy == TABLE_LIST::OPEN_STUB)
DBUG_RETURN(FALSE);
+retry_share:
+
mysql_mutex_lock(&LOCK_open);
- if (!(share= get_table_share_with_create(thd, table_list, key,
- key_length, OPEN_VIEW,
- &error,
- hash_value)))
- goto err_unlock2;
+ if (!(share= get_table_share_with_discover(thd, table_list, key,
+ key_length, OPEN_VIEW,
+ &error,
+ hash_value)))
+ {
+ mysql_mutex_unlock(&LOCK_open);
+ /*
+ If thd->is_error() is not set, we either need discover
+ (error == 7), or the error was silenced by the prelocking
+ handler (error == 0), in which case we should skip this
+ table.
+ */
+ if (error == 7 && !thd->is_error())
+ {
+ (void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER,
+ table_list);
+ }
+ DBUG_RETURN(TRUE);
+ }
if (share->is_view)
{
@@ -2867,31 +2915,50 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
goto err_unlock;
- /*
- If the version changes while we're opening the tables,
- we have to back off, close all the tables opened-so-far,
- and try to reopen them. Note: refresh_version is currently
- changed only during FLUSH TABLES.
- */
- if (share->needs_reopen() ||
- (thd->open_tables && thd->open_tables->s->version != share->version))
+ if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
{
- if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
+ if (share->has_old_version())
{
- /*
- We already have an MDL lock. But we have encountered an old
- version of table in the table definition cache which is possible
- when someone changes the table version directly in the cache
- without acquiring a metadata lock (e.g. this can happen during
- "rolling" FLUSH TABLE(S)).
- Note, that to avoid a "busywait" in this case, we have to wait
- separately in the caller for old table versions to go away
- (see tdc_wait_for_old_versions()).
- */
+ /*
+ We already have an MDL lock. But we have encountered an old
+ version of table in the table definition cache which is possible
+ when someone changes the table version directly in the cache
+ without acquiring a metadata lock (e.g. this can happen during
+ "rolling" FLUSH TABLE(S)).
+ Release our reference to share, wait until old version of
+ share goes away and then try to get new version of table share.
+ */
+ MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
+ bool wait_result;
+
+ release_table_share(share);
+ mysql_mutex_unlock(&LOCK_open);
+
+ thd->push_internal_handler(&mdl_deadlock_handler);
+ wait_result= tdc_wait_for_old_version(thd, table_list->db,
+ table_list->table_name,
+ ot_ctx->get_timeout(),
+ mdl_ticket->get_deadlock_weight());
+ thd->pop_internal_handler();
+
+ if (wait_result)
+ DBUG_RETURN(TRUE);
+
+ goto retry_share;
+ }
+
+ if (thd->open_tables && thd->open_tables->s->version != share->version)
+ {
+ /*
+ If the version changes while we're opening the tables,
+ we have to back off, close all the tables opened-so-far,
+ and try to reopen them. Note: refresh_version is currently
+ changed only during FLUSH TABLES.
+ */
release_table_share(share);
mysql_mutex_unlock(&LOCK_open);
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_TDC,
- NULL);
+ (void)ot_ctx->request_backoff_action(Open_table_context::OT_REOPEN_TABLES,
+ NULL);
DBUG_RETURN(TRUE);
}
}
@@ -2952,15 +3019,6 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
mysql_mutex_unlock(&LOCK_open);
- /*
- In CREATE TABLE .. If NOT EXISTS .. SELECT we have found that
- table exists now we should downgrade our exclusive metadata
- lock on this table to SW metadata lock.
- */
- if (table_list->lock_strategy == TABLE_LIST::OTLS_DOWNGRADE_IF_EXISTS &&
- !(flags & MYSQL_OPEN_HAS_MDL_LOCK))
- mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_WRITE);
-
table->mdl_ticket= mdl_ticket;
table->next= thd->open_tables; /* Link into simple list */
@@ -3010,7 +3068,6 @@ err_lock:
mysql_mutex_lock(&LOCK_open);
err_unlock:
release_table_share(share);
-err_unlock2:
mysql_mutex_unlock(&LOCK_open);
DBUG_RETURN(TRUE);
@@ -3432,7 +3489,7 @@ Locked_tables_list::reopen_tables(THD *thd)
PRE-CONDITION(S)
share is non-NULL
- The LOCK_open mutex is locked
+ The LOCK_open mutex is locked.
POST-CONDITION(S)
@@ -3633,10 +3690,10 @@ bool tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
cache_key_length);
mysql_mutex_lock(&LOCK_open);
- if (!(share= get_table_share_with_create(thd, table_list, cache_key,
- cache_key_length,
- OPEN_VIEW, &error,
- hash_value)))
+ if (!(share= get_table_share(thd, table_list, cache_key,
+ cache_key_length,
+ OPEN_VIEW, &error,
+ hash_value)))
goto err;
if (share->is_view &&
@@ -3738,10 +3795,10 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
cache_key_length);
mysql_mutex_lock(&LOCK_open);
- if (!(share= get_table_share_with_create(thd, table_list, cache_key,
- cache_key_length,
- OPEN_VIEW, &not_used,
- hash_value)))
+ if (!(share= get_table_share(thd, table_list, cache_key,
+ cache_key_length,
+ OPEN_VIEW, &not_used,
+ hash_value)))
goto end_unlock;
if (share->is_view)
@@ -3786,7 +3843,8 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
release_table_share(share);
/* Remove the repaired share from the table cache. */
tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
- table_list->db, table_list->table_name);
+ table_list->db, table_list->table_name,
+ TRUE);
end_unlock:
mysql_mutex_unlock(&LOCK_open);
return result;
@@ -3820,7 +3878,7 @@ request_backoff_action(enum_open_table_action action_arg,
TABLE_LIST *table)
{
/*
- A back off action may be one of the three kinds:
+ A back off action may be one of three kinds:
* We met a broken table that needs repair, or a table that
is not present on this MySQL server and needs re-discovery.
@@ -3829,27 +3887,47 @@ request_backoff_action(enum_open_table_action action_arg,
locks is very deadlock-prone. If this is a multi- statement
transaction that holds metadata locks for completed
statements, we don't do it, and report an error instead.
+ The action type in this case is OT_DISCOVER or OT_REPAIR.
* Our attempt to acquire an MDL lock lead to a deadlock,
detected by the MDL deadlock detector. The current
session was chosen a victim. If this is a multi-statement
- transaction that holds metadata locks for completed statements,
- restarting locking for the current statement may lead
- to a livelock. Thus, again, if m_has_locks is set,
+ transaction that holds metadata locks taken by completed
+ statements, restarting locking for the current statement
+ may lead to a livelock. Releasing locks of completed
+ statements can not be done as will lead to violation
+ of ACID. Thus, again, if m_has_locks is set,
we report an error. Otherwise, when there are no metadata
locks other than which belong to this statement, we can
try to recover from error by releasing all locks and
restarting the pre-locking.
- * Finally, we could have met a TABLE_SHARE with old version.
- Again, if this is a first statement in a transaction we can
- close all tables, release all metadata locks and wait for
- the old version to go away. Otherwise, waiting with MDL locks
- may lead to criss-cross wait between this connection and a
- connection that has an open table and waits on a metadata lock,
- i.e. to a deadlock.
- Since there is no way to detect such a deadlock, we prevent
- it by reporting an error.
+ Similarly, a deadlock error can occur when the
+ pre-locking process met a TABLE_SHARE that is being
+ flushed, and unsuccessfully waited for the flush to
+ complete. A deadlock in this case can happen, e.g.,
+ when our session is holding a metadata lock that
+ is being waited on by a session which is using
+ the table which is being flushed. The only way
+ to recover from this error is, again, to close all
+ open tables, release all locks, and retry pre-locking.
+ Action type name is OT_REOPEN_TABLES. Re-trying
+ while holding some locks may lead to a livelock,
+ and thus we don't do it.
+ * Finally, this session has open TABLEs from different
+ "generations" of the table cache. This can happen, e.g.,
+ when, after this session has successfully opened one
+ table used for a statement, FLUSH TABLES interfered and
+ expelled another table used in it. FLUSH TABLES then
+ blocks and waits on the table already opened by this
+ statement.
+ We detect this situation by ensuring that table cache
+ version of all tables used in a statement is the same.
+ If it isn't, all tables needs to be reopened.
+ Note, that we can always perform a reopen in this case,
+ even if we already have metadata locks, since we don't
+ keep tables open between statements and a livelock
+ is not possible.
*/
- if (m_has_locks)
+ if (action_arg != OT_REOPEN_TABLES && m_has_locks)
{
my_error(ER_LOCK_DEADLOCK, MYF(0));
return TRUE;
@@ -3895,11 +3973,9 @@ recover_from_failed_open(THD *thd)
/* Execute the action. */
switch (m_action)
{
- case OT_MDL_CONFLICT:
+ case OT_BACKOFF_AND_RETRY:
break;
- case OT_WAIT_TDC:
- result= tdc_wait_for_old_versions(thd, &m_mdl_requests, get_timeout());
- DBUG_ASSERT(thd->mysys_var->current_mutex == NULL);
+ case OT_REOPEN_TABLES:
break;
case OT_DISCOVER:
{
@@ -3908,12 +3984,10 @@ recover_from_failed_open(THD *thd)
MYSQL_OPEN_SKIP_TEMPORARY)))
break;
- mysql_mutex_lock(&LOCK_open);
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, m_failed_table->db,
- m_failed_table->table_name);
+ m_failed_table->table_name, FALSE);
ha_create_table_from_engine(thd, m_failed_table->db,
m_failed_table->table_name);
- mysql_mutex_unlock(&LOCK_open);
thd->warning_info->clear_warning_info(thd->query_id);
thd->clear_error(); // Clear error message
@@ -3927,10 +4001,8 @@ recover_from_failed_open(THD *thd)
MYSQL_OPEN_SKIP_TEMPORARY)))
break;
- mysql_mutex_lock(&LOCK_open);
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, m_failed_table->db,
- m_failed_table->table_name);
- mysql_mutex_unlock(&LOCK_open);
+ m_failed_table->table_name, FALSE);
result= auto_repair_table(thd, m_failed_table);
thd->mdl_context.release_transactional_locks();
@@ -3939,8 +4011,6 @@ recover_from_failed_open(THD *thd)
default:
DBUG_ASSERT(0);
}
- /* Remove all old requests, they will be re-added. */
- m_mdl_requests.empty();
/*
Reset the pointers to conflicting MDL request and the
TABLE_LIST element, set when we need auto-discovery or repair,
@@ -4061,8 +4131,6 @@ open_and_process_routine(THD *thd, Query_tables_list *prelocking_ctx,
if (rt != (Sroutine_hash_entry*)prelocking_ctx->sroutines_list.first ||
mdl_type != MDL_key::PROCEDURE)
{
- ot_ctx->add_request(&rt->mdl_request);
-
/*
Since we acquire only shared lock on routines we don't
need to care about global intention exclusive locks.
@@ -4267,11 +4335,11 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
The real failure will occur when/if a statement attempts to use
that table.
*/
- Prelock_error_handler prelock_handler;
- thd->push_internal_handler(& prelock_handler);
+ No_such_table_error_handler no_such_table_handler;
+ thd->push_internal_handler(&no_such_table_handler);
error= open_table(thd, tables, new_frm_mem, ot_ctx);
thd->pop_internal_handler();
- safe_to_ignore_table= prelock_handler.safely_trapped_errors();
+ safe_to_ignore_table= no_such_table_handler.safely_trapped_errors();
}
else
error= open_table(thd, tables, new_frm_mem, ot_ctx);
@@ -4739,6 +4807,8 @@ restart:
}
goto err;
}
+
+ DEBUG_SYNC(thd, "open_tables_after_open_and_process_table");
}
/*
@@ -5352,8 +5422,14 @@ bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags)
DBUG_RETURN(0);
end:
- /* No need to rollback statement transaction, it's not started. */
- DBUG_ASSERT(thd->transaction.stmt.is_empty());
+ /*
+ No need to commit/rollback the statement transaction: it's
+ either not started or we're filling in an INFORMATION_SCHEMA
+ table on the fly, and thus mustn't manipulate with the
+ transaction of the enclosing statement.
+ */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty() ||
+ (thd->state_flags & Open_tables_state::BACKUPS_AVAIL));
close_thread_tables(thd);
/* Don't keep locks for a failed statement. */
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
@@ -8541,7 +8617,7 @@ void tdc_flush_unused_tables()
mysql_mutex_lock(&LOCK_open);
while (unused_tables)
free_cache_entry(unused_tables);
- (void) mysql_mutex_unlock(&LOCK_open);
+ mysql_mutex_unlock(&LOCK_open);
}
@@ -8607,17 +8683,6 @@ bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
}
mysql_mutex_unlock(&in_use->LOCK_thd_data);
}
- /*
- Wake up threads waiting in tdc_wait_for_old_versions().
- Normally such threads would already get blocked
- in MDL subsystem, when trying to acquire a shared lock.
- But in case a thread has an open HANDLER statement,
- (and thus already grabbed a metadata lock), it gets
- blocked only too late -- at the table cache level.
- Starting from 5.5, this could also easily happen in
- a multi-statement transaction.
- */
- broadcast_refresh();
return signalled;
}
@@ -8646,21 +8711,27 @@ bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
remove TABLE_SHARE).
@param db Name of database
@param table_name Name of table
+ @param has_lock If TRUE, LOCK_open is already acquired
- @note Unlike remove_table_from_cache() it assumes that table instances
- are already not used by any (other) thread (this should be achieved
- by using meta-data locks).
+ @note It assumes that table instances are already not used by any
+ (other) thread (this should be achieved by using meta-data locks).
*/
void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
- const char *db, const char *table_name)
+ const char *db, const char *table_name,
+ bool has_lock)
{
char key[MAX_DBKEY_LENGTH];
uint key_length;
TABLE *table;
TABLE_SHARE *share;
- mysql_mutex_assert_owner(&LOCK_open);
+ if (! has_lock)
+ mysql_mutex_lock(&LOCK_open);
+ else
+ {
+ mysql_mutex_assert_owner(&LOCK_open);
+ }
DBUG_ASSERT(remove_type == TDC_RT_REMOVE_UNUSED ||
thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name,
@@ -8692,6 +8763,13 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
/*
Set share's version to zero in order to ensure that it gets
automatically deleted once it is no longer referenced.
+
+ Note that code in TABLE_SHARE::wait_for_old_version() assumes
+ that marking share as old and removal of its unused tables
+ and of the share itself from TDC happens atomically under
+ protection of LOCK_open, or, putting it another way, that
+ TDC does not contain old shares which don't have any tables
+ used.
*/
share->version= 0;
@@ -8701,84 +8779,9 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
else
(void) my_hash_delete(&table_def_cache, (uchar*) share);
}
-}
-
-
-/**
- Wait until there are no old versions of tables in the table
- definition cache for the metadata locks that we try to acquire.
-
- @param thd Thread context
- @param context Metadata locking context with locks.
- @param timeout Seconds to wait before reporting ER_LOCK_WAIT_TIMEOUT.
-*/
-static bool
-tdc_wait_for_old_versions(THD *thd, MDL_request_list *mdl_requests,
- ulong timeout)
-{
- TABLE_SHARE *share;
- const char *old_msg;
- MDL_request *mdl_request;
- struct timespec abstime;
- set_timespec(abstime, timeout);
- int wait_result= 0;
-
- while (!thd->killed)
- {
- /*
- We have to get rid of HANDLERs which are open by this thread
- and have old TABLE versions. Otherwise we might get a deadlock
- in situation when we are waiting for an old TABLE object which
- corresponds to a HANDLER open by another session. And this
- other session waits for our HANDLER object to get closed.
-
- TODO: We should also investigate in which situations we have
- to broadcast on COND_refresh because of this.
- */
- mysql_ha_flush(thd);
-
- mysql_mutex_lock(&LOCK_open);
-
- MDL_request_list::Iterator it(*mdl_requests);
- while ((mdl_request= it++))
- {
- /* Skip requests on non-TDC objects. */
- if (mdl_request->key.mdl_namespace() != MDL_key::TABLE)
- continue;
-
- if ((share= get_cached_table_share(mdl_request->key.db_name(),
- mdl_request->key.name())) &&
- share->needs_reopen())
- break;
- }
- if (!mdl_request)
- {
- /*
- Reset wait_result here in case this was the final check
- after getting a timeout from mysql_cond_timedwait().
- */
- wait_result= 0;
- mysql_mutex_unlock(&LOCK_open);
- break;
- }
- if (wait_result == ETIMEDOUT || wait_result == ETIME)
- {
- /*
- Test for timeout here instead of right after mysql_cond_timedwait().
- This allows for a final iteration and a final check before reporting
- ER_LOCK_WAIT_TIMEOUT.
- */
- mysql_mutex_unlock(&LOCK_open);
- my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
- break;
- }
- old_msg= thd->enter_cond(&COND_refresh, &LOCK_open, "Waiting for table");
- wait_result= mysql_cond_timedwait(&COND_refresh, &LOCK_open, &abstime);
- /* LOCK_open mutex is unlocked by THD::exit_cond() as side-effect. */
- thd->exit_cond(old_msg);
- }
- return thd->killed || wait_result == ETIMEDOUT || wait_result == ETIME;
+ if (! has_lock)
+ mysql_mutex_unlock(&LOCK_open);
}
@@ -8890,87 +8893,6 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b)
/*
- 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)
-{
- TABLE_SHARE *share= lpt->table->s;
- THD *thd= lpt->thd;
- TABLE *table;
- DBUG_ENTER("alter_close_tables");
- /*
- We must keep LOCK_open while manipulating with thd->open_tables.
- Another thread may be working on it.
- */
- mysql_mutex_lock(&LOCK_open);
- /*
- We can safely remove locks for all tables with the same name:
- later they will all be closed anyway in
- alter_partition_lock_handling().
- */
- for (table= thd->open_tables; table ; table= table->next)
- {
- if (!strcmp(table->s->table_name.str, share->table_name.str) &&
- !strcmp(table->s->db.str, share->db.str))
- {
- mysql_lock_remove(thd, thd->lock, table);
- table->file->close();
- table->db_stat= 0; // Mark file closed
- /*
- Ensure that we won't end up with a crippled table instance
- in the table cache if an error occurs before we reach
- alter_partition_lock_handling() and the table is closed
- by close_thread_tables() instead.
- */
- tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
- table->s->db.str,
- table->s->table_name.str);
- }
- }
- mysql_mutex_unlock(&LOCK_open);
- DBUG_RETURN(0);
-}
-
-
-/*
- SYNOPSIS
- abort_and_upgrade_lock_and_close_table()
- lpt Parameter passing struct
- All parameters passed through the ALTER_PARTITION_PARAM_TYPE object
- RETURN VALUE
- 0
- DESCRIPTION
- 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. Close the table and hold the name lock.
-
- thd Thread object
- table Table object
- db Database name
- table_name Table name
- old_lock_level Old lock level
-*/
-
-int abort_and_upgrade_lock_and_close_table(ALTER_PARTITION_PARAM_TYPE *lpt)
-{
- DBUG_ENTER("abort_and_upgrade_lock_and_close_table");
-
- if (wait_while_table_is_used(lpt->thd, lpt->table, HA_EXTRA_FORCE_REOPEN))
- DBUG_RETURN(1);
- if (alter_close_tables(lpt))
- DBUG_RETURN(1);
- DBUG_RETURN(0);
-}
-
-
-/*
Tells if two (or more) tables have auto_increment columns and we want to
lock those tables with a write lock.
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 45f1408e2f5..2e4554313e5 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -70,6 +70,9 @@ enum enum_tdc_remove_table_type {TDC_RT_REMOVE_ALL, TDC_RT_REMOVE_NOT_OWN,
#define RTFC_CHECK_KILLED_FLAG 0x0004
bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
+extern mysql_mutex_t LOCK_open;
+extern mysql_mutex_t LOCK_dd_owns_lock_open;
+extern uint dd_owns_lock_open;
bool table_cache_init(void);
void table_cache_free(void);
bool table_def_init(void);
@@ -88,30 +91,55 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
uint lock_flags);
+
+/* mysql_lock_tables() and open_table() flags bits */
+#define MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK 0x0001
+#define MYSQL_OPEN_IGNORE_FLUSH 0x0002
+#define MYSQL_OPEN_TEMPORARY_ONLY 0x0004
+#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008
+#define MYSQL_LOCK_LOG_TABLE 0x0010
+/**
+ Do not try to acquire a metadata lock on the table: we
+ already have one.
+*/
+#define MYSQL_OPEN_HAS_MDL_LOCK 0x0020
+/**
+ If in locked tables mode, ignore the locked tables and get
+ a new instance of the table.
+*/
+#define MYSQL_OPEN_GET_NEW_TABLE 0x0040
+/** Don't look up the table in the list of temporary tables. */
+#define MYSQL_OPEN_SKIP_TEMPORARY 0x0080
+/** Fail instead of waiting when conficting metadata lock is discovered. */
+#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0100
+/** Open tables using MDL_SHARED lock instead of one specified in parser. */
+#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0200
+/**
+ Open tables using MDL_SHARED_HIGH_PRIO lock instead of one specified
+ in parser.
+*/
+#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0400
+/**
+ When opening or locking the table, use the maximum timeout
+ (LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value.
+*/
+#define MYSQL_LOCK_IGNORE_TIMEOUT 0x0800
+
+/** Please refer to the internals manual. */
+#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
+ MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |\
+ MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |\
+ MYSQL_LOCK_IGNORE_TIMEOUT |\
+ MYSQL_OPEN_GET_NEW_TABLE |\
+ MYSQL_OPEN_SKIP_TEMPORARY |\
+ MYSQL_OPEN_HAS_MDL_LOCK)
+
bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
Open_table_context *ot_ctx);
-bool name_lock_locked_table(THD *thd, TABLE_LIST *tables);
-bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in);
-TABLE *table_cache_insert_placeholder(THD *thd, const char *key,
- uint key_length);
-bool lock_table_name_if_not_cached(THD *thd, const char *db,
- const char *table_name, TABLE **table);
-void detach_merge_children(TABLE *table, bool clear_refs);
-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);
-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);
bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
uint db_stat, uint prgflag,
uint ha_open_flags, TABLE *outparam, TABLE_LIST *table_desc,
MEM_ROOT *mem_root);
-bool wait_for_tables(THD *thd);
-bool table_is_used(TABLE *table, bool wait_for_name_lock);
-TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name);
-void abort_locked_tables(THD *thd,const char *db, const char *table_name);
bool get_key_map_from_key_list(key_map *map, TABLE *table,
List<String> *index_list);
@@ -190,12 +218,9 @@ bool setup_tables_and_check_access(THD *thd,
ulong want_access);
bool wait_while_table_is_used(THD *thd, TABLE *table,
enum ha_extra_function function);
-void unlink_open_table(THD *thd, TABLE *find, bool unlock);
void drop_open_table(THD *thd, TABLE *table, const char *db_name,
const char *table_name);
-void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
- bool remove_from_locked_tables);
void update_non_unique_table_error(TABLE_LIST *update,
const char *operation,
TABLE_LIST *duplicate);
@@ -218,7 +243,6 @@ TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
thr_lock_type lock_type, uint flags);
bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
bool lock_tables(THD *thd, TABLE_LIST *tables, uint counter, uint flags);
-int abort_and_upgrade_lock_and_close_table(ALTER_PARTITION_PARAM_TYPE *lpt);
int decide_logging_format(THD *thd, TABLE_LIST *tables);
void free_io_cache(TABLE *entry);
void intern_close_table(TABLE *entry);
@@ -226,14 +250,12 @@ bool close_thread_table(THD *thd, TABLE **table_ptr);
bool close_temporary_tables(THD *thd);
TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
bool check_alias);
-int drop_temporary_table(THD *thd, TABLE_LIST *table_list);
+int drop_temporary_table(THD *thd, TABLE_LIST *table_list, bool *is_trans);
void close_temporary_table(THD *thd, TABLE *table, bool free_share,
bool delete_table);
void close_temporary(TABLE *table, bool free_share, bool delete_table);
bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
const char *table_name);
-void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table);
-void remove_db_from_cache(const char *db);
bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
/* Functions to work with system tables. */
@@ -249,18 +271,15 @@ TABLE *open_performance_schema_table(THD *thd, TABLE_LIST *one_table,
Open_tables_state *backup);
void close_performance_schema_table(THD *thd, Open_tables_state *backup);
-bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
- bool wait_for_refresh);
-bool close_cached_connection_tables(THD *thd, bool wait_for_refresh,
- LEX_STRING *connect_string,
- bool have_lock = FALSE);
+bool close_cached_tables(THD *thd, TABLE_LIST *tables,
+ bool wait_for_refresh, ulong timeout);
+bool close_cached_connection_tables(THD *thd, LEX_STRING *connect_string);
void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
bool remove_from_locked_tables);
OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild);
-bool remove_table_from_cache(THD *thd, const char *db, const char *table,
- uint flags);
void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
- const char *db, const char *table_name);
+ const char *db, const char *table_name,
+ bool has_lock);
bool tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
char *cache_key, uint cache_key_length,
MEM_ROOT *mem_root, uint flags);
@@ -271,12 +290,10 @@ TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db,
void mark_tmp_table_for_reuse(TABLE *table);
bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists);
-extern uint table_cache_count;
extern TABLE *unused_tables;
extern Item **not_found_item;
extern Field *not_found_field;
extern Field *view_ref_found;
-extern HASH open_cache;
extern HASH table_def_cache;
/**
@@ -454,8 +471,8 @@ public:
enum enum_open_table_action
{
OT_NO_ACTION= 0,
- OT_MDL_CONFLICT,
- OT_WAIT_TDC,
+ OT_BACKOFF_AND_RETRY,
+ OT_REOPEN_TABLES,
OT_DISCOVER,
OT_REPAIR
};
@@ -465,9 +482,6 @@ public:
bool request_backoff_action(enum_open_table_action action_arg,
TABLE_LIST *table);
- void add_request(MDL_request *request)
- { m_mdl_requests.push_front(request); }
-
bool can_recover_from_failed_open() const
{ return m_action != OT_NO_ACTION; }
@@ -489,8 +503,6 @@ public:
uint get_flags() const { return m_flags; }
private:
- /** List of requests for all locks taken so far. Used for waiting on locks. */
- MDL_request_list m_mdl_requests;
/**
For OT_DISCOVER and OT_REPAIR actions, the table list element for
the table which definition should be re-discovered or which
@@ -516,4 +528,34 @@ private:
};
+/**
+ This internal handler is used to trap ER_NO_SUCH_TABLE.
+*/
+
+class No_such_table_error_handler : public Internal_error_handler
+{
+public:
+ No_such_table_error_handler()
+ : m_handled_errors(0), m_unhandled_errors(0)
+ {}
+
+ bool handle_condition(THD *thd,
+ uint sql_errno,
+ const char* sqlstate,
+ MYSQL_ERROR::enum_warning_level level,
+ const char* msg,
+ MYSQL_ERROR ** cond_hdl);
+
+ /**
+ Returns TRUE if one or more ER_NO_SUCH_TABLE errors have been
+ trapped and no other errors have been seen. FALSE otherwise.
+ */
+ bool safely_trapped_errors();
+
+private:
+ int m_handled_errors;
+ int m_unhandled_errors;
+};
+
+
#endif /* SQL_BASE_INCLUDED */
diff --git a/sql/sql_callback.h b/sql/sql_callback.h
new file mode 100644
index 00000000000..430514d3d7e
--- /dev/null
+++ b/sql/sql_callback.h
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef SQL_CALLBACK_INCLUDED
+#define SQL_CALLBACK_INCLUDED
+
+/**
+ Macro used for an internal callback.
+
+ The macro will check that the object exists and that the function
+ is defined. If that is the case, it will call the function with the
+ given parameters.
+
+ If the object or the function is not defined, the callback will be
+ considered successful (nothing needed to be done) and will
+ therefore return no error.
+ */
+
+#define MYSQL_CALLBACK(OBJ, FUNC, PARAMS) \
+ do { \
+ if ((OBJ) && ((OBJ)->FUNC)) \
+ (OBJ)->FUNC PARAMS; \
+ } while (0)
+
+#define MYSQL_CALLBACK_ELSE(OBJ, FUNC, PARAMS, ELSE) \
+ (((OBJ) && ((OBJ)->FUNC)) ? (OBJ)->FUNC PARAMS : (ELSE))
+
+
+#endif /* SQL_CALLBACK_INCLUDED */
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index f06c7885c85..15fbc6a1480 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -57,6 +57,7 @@
#include "transaction.h"
#include "debug_sync.h"
#include "sql_parse.h" // is_update_query
+#include "sql_callback.h"
/*
The following is used to initialise Table_ident with a internal
@@ -306,6 +307,11 @@ void **thd_ha_data(const THD *thd, const struct handlerton *hton)
return (void **) &thd->ha_data[hton->slot].ha_ptr;
}
+extern "C"
+void thd_storage_lock_wait(THD *thd, long long value)
+{
+ thd->utime_after_lock+= value;
+}
/**
Provide a handler data getter to simplify coding
@@ -1071,6 +1077,7 @@ THD::~THD()
DBUG_ENTER("~THD()");
/* Ensure that no one is using THD */
mysql_mutex_lock(&LOCK_thd_data);
+ mysys_var=0; // Safety (shouldn't be needed)
mysql_mutex_unlock(&LOCK_thd_data);
add_to_status(&global_status_var, &status_var);
@@ -1096,7 +1103,6 @@ THD::~THD()
my_free(db);
db= NULL;
free_root(&transaction.mem_root,MYF(0));
- mysys_var=0; // Safety (shouldn't be needed)
mysql_mutex_destroy(&LOCK_thd_data);
#ifndef DBUG_OFF
dbug_sentry= THD_SENTRY_GONE;
@@ -1185,7 +1191,7 @@ void THD::awake(THD::killed_state state_to_set)
{
thr_alarm_kill(thread_id);
if (!slave_thread)
- thread_scheduler.post_kill_notification(this);
+ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (this));
#ifdef SIGNAL_WITH_VIO_CLOSE
if (this != current_thd)
{
@@ -1254,6 +1260,15 @@ bool THD::store_globals()
if (my_pthread_setspecific_ptr(THR_THD, this) ||
my_pthread_setspecific_ptr(THR_MALLOC, &mem_root))
return 1;
+ /*
+ mysys_var is concurrently readable by a killer thread.
+ It is protected by LOCK_thd_data, it is not needed to lock while the
+ pointer is changing from NULL not non-NULL. If the kill thread reads
+ NULL it doesn't refer to anything, but if it is non-NULL we need to
+ ensure that the thread doesn't proceed to assign another thread to
+ have the mysys_var reference (which in fact refers to the worker
+ threads local storage with key THR_KEY_mysys.
+ */
mysys_var=my_thread_var;
/*
Let mysqld define the thread id (not mysys)
@@ -3190,6 +3205,60 @@ extern "C" bool thd_sqlcom_can_generate_row_events(const MYSQL_THD thd)
{
return sqlcom_can_generate_row_events(thd);
}
+
+#ifndef EMBEDDED_LIBRARY
+extern "C" void thd_pool_wait_begin(MYSQL_THD thd, int wait_type);
+extern "C" void thd_pool_wait_end(MYSQL_THD thd);
+
+/*
+ Interface for MySQL Server, plugins and storage engines to report
+ when they are going to sleep/stall.
+
+ SYNOPSIS
+ thd_wait_begin()
+ thd Thread object
+ wait_type Type of wait
+ 1 -- short wait (e.g. for mutex)
+ 2 -- medium wait (e.g. for disk io)
+ 3 -- large wait (e.g. for locked row/table)
+ NOTES
+ This is used by the threadpool to have better knowledge of which
+ threads that currently are actively running on CPUs. When a thread
+ reports that it's going to sleep/stall, the threadpool scheduler is
+ free to start another thread in the pool most likely. The expected wait
+ time is simply an indication of how long the wait is expected to
+ become, the real wait time could be very different.
+
+ thd_wait_end MUST be called immediately after waking up again.
+*/
+extern "C" void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type)
+{
+ MYSQL_CALLBACK(thread_scheduler, thd_wait_begin, (thd, wait_type));
+}
+
+/**
+ Interface for MySQL Server, plugins and storage engines to report
+ when they waking up from a sleep/stall.
+
+ @param thd Thread handle
+*/
+extern "C" void thd_wait_end(MYSQL_THD thd)
+{
+ MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (thd));
+}
+#else
+extern "C" void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type)
+{
+ /* do NOTHING for the embedded library */
+ return;
+}
+
+extern "C" void thd_wait_end(MYSQL_THD thd)
+{
+ /* do NOTHING for the embedded library */
+ return;
+}
+#endif
#endif // INNODB_COMPATIBILITY_HOOKS */
/****************************************************************************
@@ -3373,6 +3442,13 @@ void THD::set_query_id(query_id_t new_query_id)
mysql_mutex_unlock(&LOCK_thd_data);
}
+/** Assign a new value to thd->mysys_var. */
+void THD::set_mysys_var(struct st_my_thread_var *new_mysys_var)
+{
+ mysql_mutex_lock(&LOCK_thd_data);
+ mysys_var= new_mysys_var;
+ mysql_mutex_unlock(&LOCK_thd_data);
+}
/**
Leave explicit LOCK TABLES or prelocked mode and restore value of
@@ -3651,7 +3727,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
{
DBUG_ENTER("THD::decide_logging_format");
DBUG_PRINT("info", ("query: %s", query()));
- DBUG_PRINT("info", ("variables.binlog_format: %u",
+ DBUG_PRINT("info", ("variables.binlog_format: %lu",
variables.binlog_format));
DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x",
lex->get_stmt_unsafe_flags()));
@@ -3782,124 +3858,16 @@ int THD::decide_logging_format(TABLE_LIST *tables)
int error= 0;
int unsafe_flags;
- /*
- Classify a statement as unsafe when there is a mixed statement and an
- on-going transaction at any point of the execution if:
-
- 1. The mixed statement is about to update a transactional table and
- a non-transactional table.
-
- 2. The mixed statement is about to update a temporary transactional
- table and a non-transactional table.
-
- 3. The mixed statement is about to update a transactional table and
- read from a non-transactional table.
-
- 4. The mixed statement is about to update a temporary transactional
- table and read from a non-transactional table.
+ bool multi_stmt_trans= in_multi_stmt_transaction_mode();
+ bool trans_table= trans_has_updated_trans_table(this);
+ bool binlog_direct= variables.binlog_direct_non_trans_update;
- 5. The mixed statement is about to update a non-transactional table
- and read from a transactional table when the isolation level is
- lower than repeatable read.
-
- After updating a transactional table if:
-
- 6. The mixed statement is about to update a non-transactional table
- and read from a temporary transactional table.
-
- 7. The mixed statement is about to update a non-transactional table
- and read from a temporary transactional table.
-
- 8. The mixed statement is about to update a non-transactionala table
- and read from a temporary non-transactional table.
-
- 9. The mixed statement is about to update a temporary non-transactional
- table and update a non-transactional table.
-
- 10. The mixed statement is about to update a temporary non-transactional
- table and read from a non-transactional table.
-
- 11. A statement is about to update a non-transactional table and the
- option variables.binlog_direct_non_trans_update is OFF.
-
- The reason for this is that locks acquired may not protected a concurrent
- transaction of interfering in the current execution and by consequence in
- the result. In particular, if there is an on-going transaction and a
- transactional table was already updated, a temporary table must be written
- to the binary log in the boundaries of the on-going transaction and as
- such we artificially classify them as transactional.
- */
- if (in_multi_stmt_transaction_mode())
- {
- my_bool mixed_unsafe= FALSE;
- my_bool non_trans_unsafe= FALSE;
-
- /* Case 1. */
- if (lex->stmt_accessed_table(LEX::STMT_WRITES_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 2. */
- else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 3. */
- else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 4. */
- else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 5. */
- else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_READS_TRANS_TABLE) &&
- tx_isolation < ISO_REPEATABLE_READ)
- /*
- By default, InnoDB operates in REPEATABLE READ and with the option
- --innodb-locks-unsafe-for-binlog disabled. In this case, InnoDB uses
- next-key locks for searches and index scans, which prevents phantom
- rows.
-
- This is scenario is safe for Innodb. However, there are no means to
- transparently get this information. Therefore, we need to improve this
- and change the storage engines to report somehow when an execution is
- safe under an isolation level & binary logging format.
- */
- mixed_unsafe= TRUE;
-
- if (trans_has_updated_trans_table(this))
- {
- /* Case 6. */
- if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_READS_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 7. */
- else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_READS_TEMP_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 8. */
- else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_READS_TEMP_NON_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 9. */
- else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 10. */
- else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
- lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
- mixed_unsafe= TRUE;
- /* Case 11. */
- else if (!variables.binlog_direct_non_trans_update &&
- lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
- non_trans_unsafe= TRUE;
- }
-
- if (mixed_unsafe)
- lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MIXED_STATEMENT);
- else if (non_trans_unsafe)
- lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS);
- }
+ if (lex->is_mixed_stmt_unsafe(multi_stmt_trans, binlog_direct,
+ trans_table, tx_isolation))
+ lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MIXED_STATEMENT);
+ else if (multi_stmt_trans && trans_table && !binlog_direct &&
+ lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
+ lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS);
/*
If more than one engine is involved in the statement and at
@@ -4024,7 +3992,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
DBUG_PRINT("info", ("decision: no logging since "
"mysql_bin_log.is_open() = %d "
"and (options & OPTION_BIN_LOG) = 0x%llx "
- "and binlog_format = %u "
+ "and binlog_format = %lu "
"and binlog_filter->db_ok(db) = %d",
mysql_bin_log.is_open(),
(variables.option_bits & OPTION_BIN_LOG),
diff --git a/sql/sql_class.h b/sql/sql_class.h
index dd9960b17ba..aa0f6cf1aa3 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -114,7 +114,7 @@ extern bool volatile shutdown_in_progress;
#define TC_HEURISTIC_RECOVER_COMMIT 1
#define TC_HEURISTIC_RECOVER_ROLLBACK 2
-extern uint tc_heuristic_recover;
+extern ulong tc_heuristic_recover;
typedef struct st_user_var_events
{
@@ -426,13 +426,13 @@ typedef struct system_variables
ulong log_warnings;
ulong group_concat_max_len;
- uint binlog_format; ///< binlog format for this thd (see enum_binlog_format)
+ ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format)
my_bool binlog_direct_non_trans_update;
my_bool sql_log_bin;
- uint completion_type;
- uint query_cache_type;
- uint tx_isolation;
- uint updatable_views_with_limit;
+ ulong completion_type;
+ ulong query_cache_type;
+ ulong tx_isolation;
+ ulong updatable_views_with_limit;
uint max_user_connections;
/**
In slave thread we need to know in behalf of which
@@ -1505,7 +1505,7 @@ public:
// track down slow pthread_create
ulonglong prior_thr_create_utime, thr_create_utime;
ulonglong start_utime, utime_after_lock;
-
+
thr_lock_type update_lock_default;
Delayed_insert *di;
@@ -1638,6 +1638,10 @@ public:
xid_state.xid.null();
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
}
+ my_bool is_active()
+ {
+ return (all.ha_list != NULL);
+ }
st_transactions()
{
bzero((char*)this, sizeof(*this));
@@ -2669,7 +2673,7 @@ public:
virtual void set_statement(Statement *stmt);
/**
- Assign a new value to thd->query and thd->query_id.
+ Assign a new value to thd->query and thd->query_id and mysys_var.
Protected with LOCK_thd_data mutex.
*/
void set_query(char *query_arg, uint32 query_length_arg);
@@ -2682,6 +2686,7 @@ public:
open_tables= open_tables_arg;
mysql_mutex_unlock(&LOCK_thd_data);
}
+ void set_mysys_var(struct st_my_thread_var *new_mysys_var);
void enter_locked_tables_mode(enum_locked_tables_mode mode_arg)
{
DBUG_ASSERT(locked_tables_mode == LTM_NONE);
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 4822e2d66c3..d03d77c1f66 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -35,6 +35,7 @@
#include "hostname.h" // inc_host_errors, ip_to_hostname,
// reset_host_errors
#include "sql_acl.h" // acl_getroot, NO_ACCESS, SUPER_ACL
+#include "sql_callback.h"
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
/*
@@ -519,7 +520,7 @@ bool setup_connection_thread_globals(THD *thd)
{
close_connection(thd, ER_OUT_OF_RESOURCES, 1);
statistic_increment(aborted_connects,&LOCK_status);
- thread_scheduler.end_thread(thd, 0);
+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
return 1; // Error
}
return 0;
@@ -542,7 +543,7 @@ bool setup_connection_thread_globals(THD *thd)
*/
-static bool login_connection(THD *thd)
+bool login_connection(THD *thd)
{
NET *net= &thd->net;
int error;
@@ -580,7 +581,7 @@ static bool login_connection(THD *thd)
This mainly updates status variables
*/
-static void end_connection(THD *thd)
+void end_connection(THD *thd)
{
NET *net= &thd->net;
plugin_thdvar_cleanup(thd);
@@ -621,7 +622,7 @@ static void end_connection(THD *thd)
Initialize THD to handle queries
*/
-static void prepare_new_connection_state(THD* thd)
+void prepare_new_connection_state(THD* thd)
{
Security_context *sctx= thd->security_ctx;
@@ -690,11 +691,11 @@ void do_handle_one_connection(THD *thd_arg)
thd->thr_create_utime= my_micro_time();
- if (thread_scheduler.init_new_connection_thread())
+ if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0))
{
close_connection(thd, ER_OUT_OF_RESOURCES, 1);
statistic_increment(aborted_connects,&LOCK_status);
- thread_scheduler.end_thread(thd,0);
+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
return;
}
@@ -748,7 +749,7 @@ void do_handle_one_connection(THD *thd_arg)
end_thread:
close_connection(thd, 0, 1);
- if (thread_scheduler.end_thread(thd,1))
+ if (MYSQL_CALLBACK_ELSE(thread_scheduler, end_thread, (thd, 1), 0))
return; // Probably no-threads
/*
diff --git a/sql/sql_connect.h b/sql/sql_connect.h
index 06cb4287f3a..666db4c6462 100644
--- a/sql/sql_connect.h
+++ b/sql/sql_connect.h
@@ -40,6 +40,9 @@ int check_user(THD *thd, enum enum_server_command command,
const char *passwd, uint passwd_len, const char *db,
bool check_count);
+bool login_connection(THD *thd);
+void prepare_new_connection_state(THD* thd);
+void end_connection(THD *thd);
int get_or_create_user_conn(THD *thd, const char *user,
const char *host, const USER_RESOURCES *mqh);
int check_for_max_user_connections(THD *thd, USER_CONN *uc);
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index f1dddbb2eb5..a5c126a8521 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -934,7 +934,7 @@ void mysql_ha_flush(THD *thd)
((hash_tables->table->mdl_ticket &&
hash_tables->table->mdl_ticket->has_pending_conflicting_lock()) ||
(!hash_tables->table->s->tmp_table &&
- hash_tables->table->s->needs_reopen())))
+ hash_tables->table->s->has_old_version())))
mysql_ha_close_table(thd, hash_tables);
}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 85c7b807ea6..7d2a6ad864e 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -548,10 +548,25 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(TRUE);
}
- if (delayed_get_table(thd, table_list))
+ /*
+ In order for the deadlock detector to be able to find any deadlocks
+ caused by the handler thread locking this table, we take the metadata
+ lock inside the connection thread. If this goes ok, the ticket is cloned
+ and added to the list of granted locks held by the handler thread.
+ */
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ if (thd->mdl_context.acquire_lock(&table_list->mdl_request,
+ thd->variables.lock_wait_timeout))
+ /*
+ If a lock can't be acquired, it makes no sense to try normal insert.
+ Therefore we just abort the statement.
+ */
DBUG_RETURN(TRUE);
- if (table_list->table)
+ bool error= FALSE;
+ if (delayed_get_table(thd, table_list))
+ error= TRUE;
+ else if (table_list->table)
{
/*
Open tables used for sub-selects or in stored functions, will also
@@ -560,16 +575,36 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
if (open_and_lock_tables(thd, table_list->next_global, TRUE, 0))
{
end_delayed_insert(thd);
- DBUG_RETURN(TRUE);
+ error= TRUE;
+ }
+ else
+ {
+ /*
+ First table was not processed by open_and_lock_tables(),
+ we need to set updatability flag "by hand".
+ */
+ if (!table_list->derived && !table_list->view)
+ table_list->updatable= 1; // usual table
}
- /*
- First table was not processed by open_and_lock_tables(),
- we need to set updatability flag "by hand".
- */
- if (!table_list->derived && !table_list->view)
- table_list->updatable= 1; // usual table
- DBUG_RETURN(FALSE);
}
+
+ /*
+ If a lock was acquired above, we should release it after
+ handle_delayed_insert() has cloned the ticket. Note that acquire_lock() can
+ succeed because the connection already has the lock. In this case the ticket
+ will be before the mdl_savepoint and we should not release it here.
+ */
+ if (!thd->mdl_context.has_lock(mdl_savepoint, table_list->mdl_request.ticket))
+ thd->mdl_context.release_lock(table_list->mdl_request.ticket);
+
+ /*
+ Reset the ticket in case we end up having to use normal insert and
+ therefore will reopen the table and reacquire the metadata lock.
+ */
+ table_list->mdl_request.ticket= NULL;
+
+ if (error || table_list->table)
+ DBUG_RETURN(error);
#endif
/*
* This is embedded library and we don't have auxiliary
@@ -1801,14 +1836,25 @@ public:
mysql_cond_t cond, cond_client;
volatile uint tables_in_use,stacked_inserts;
volatile bool status;
+ /*
+ When the handler thread starts, it clones a metadata lock ticket
+ for the table to be inserted. This is done to allow the deadlock
+ detector to detect deadlocks resulting from this lock.
+ Before this is done, the connection thread cannot safely exit
+ without causing problems for clone_ticket().
+ Once handler_thread_initialized has been set, it is safe for the
+ connection thread to exit.
+ Access to handler_thread_initialized is protected by di->mutex.
+ */
+ bool handler_thread_initialized;
COPY_INFO info;
I_List<delayed_row> rows;
ulong group_count;
TABLE_LIST table_list; // Argument
Delayed_insert()
- :locks_in_memory(0),
- table(0),tables_in_use(0),stacked_inserts(0), status(0), group_count(0)
+ :locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0),
+ status(0), handler_thread_initialized(FALSE), group_count(0)
{
DBUG_ENTER("Delayed_insert constructor");
thd.security_ctx->user=(char*) delayed_user;
@@ -2027,6 +2073,10 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
/* Replace volatile strings with local copies */
di->table_list.alias= di->table_list.table_name= di->thd.query();
di->table_list.db= di->thd.db;
+ /* We need the ticket so that it can be cloned in handle_delayed_insert */
+ init_mdl_requests(&di->table_list);
+ di->table_list.mdl_request.ticket= table_list->mdl_request.ticket;
+
di->lock();
mysql_mutex_lock(&di->mutex);
if ((error= mysql_thread_create(key_thread_delayed_insert,
@@ -2043,9 +2093,15 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
goto end_create;
}
- /* Wait until table is open */
+ /*
+ Wait until table is open unless the handler thread or the connection
+ thread has been killed. Note that we in all cases must wait until the
+ handler thread has been properly initialized before exiting. Otherwise
+ we risk doing clone_ticket() on a ticket that is no longer valid.
+ */
thd_proc_info(thd, "waiting for handler open");
- while (!di->thd.killed && !di->table && !thd->killed)
+ while (!di->handler_thread_initialized ||
+ (!di->thd.killed && !di->table && !thd->killed))
{
mysql_cond_wait(&di->cond_client, &di->mutex);
}
@@ -2473,6 +2529,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
/* Can't use my_error since store_globals has not yet been called */
thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
ER(ER_OUT_OF_RESOURCES), NULL);
+ di->handler_thread_initialized= TRUE;
}
else
{
@@ -2483,6 +2540,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
/* Can't use my_error since store_globals has perhaps failed */
thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES,
ER(ER_OUT_OF_RESOURCES), NULL);
+ di->handler_thread_initialized= TRUE;
thd->fatal_error();
goto err;
}
@@ -2495,7 +2553,24 @@ pthread_handler_t handle_delayed_insert(void *arg)
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED);
thd->set_current_stmt_binlog_format_row_if_mixed();
- init_mdl_requests(&di->table_list);
+ /*
+ Clone the ticket representing the lock on the target table for
+ the insert and add it to the list of granted metadata locks held by
+ the handler thread. This is safe since the handler thread is
+ not holding nor waiting on any metadata locks.
+ */
+ if (thd->mdl_context.clone_ticket(&di->table_list.mdl_request))
+ {
+ di->handler_thread_initialized= TRUE;
+ goto err;
+ }
+
+ /*
+ Now that the ticket has been cloned, it is safe for the connection
+ thread to exit.
+ */
+ di->handler_thread_initialized= TRUE;
+ di->table_list.mdl_request.ticket= NULL;
if (di->open_and_lock_table())
goto err;
@@ -2707,7 +2782,7 @@ bool Delayed_insert::handle_inserts(void)
thd_proc_info(&thd, "insert");
max_rows= delayed_insert_limit;
- if (thd.killed || table->s->needs_reopen())
+ if (thd.killed || table->s->has_old_version())
{
thd.killed= THD::KILL_CONNECTION;
max_rows= ULONG_MAX; // Do as much as possible
@@ -3045,6 +3120,9 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
we are fixing fields from insert list.
*/
lex->current_select= &lex->select_lex;
+
+ /* Errors during check_insert_fields() should not be ignored. */
+ lex->current_select->no_error= FALSE;
res= (setup_fields(thd, 0, values, MARK_COLUMNS_READ, 0, 0) ||
check_insert_fields(thd, table_list, *fields, values,
!insert_into_view, 1, &map));
@@ -3578,19 +3656,8 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
if (!mysql_create_table_no_lock(thd, create_table->db,
create_table->table_name,
create_info, alter_info, 0,
- select_field_count))
+ select_field_count, NULL))
{
- if (create_info->table_existed)
- {
- /*
- This means that someone created table underneath server
- or it was created via different mysqld front-end to the
- cluster. We don't have much options but throw an error.
- */
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_table->table_name);
- DBUG_RETURN(0);
- }
-
DBUG_EXECUTE_IF("sleep_create_select_before_open", my_sleep(6000000););
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
@@ -3602,11 +3669,9 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
*/
if (open_table(thd, create_table, thd->mem_root, &ot_ctx))
{
- mysql_mutex_lock(&LOCK_open);
quick_rm_table(create_info->db_type, create_table->db,
table_case_name(create_info, create_table->table_name),
0);
- mysql_mutex_unlock(&LOCK_open);
}
else
table= create_table->table;
@@ -3621,7 +3686,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
it preparable for open. But let us do close_temporary_table() here
just in case.
*/
- drop_temporary_table(thd, create_table);
+ drop_temporary_table(thd, create_table, NULL);
}
else
table= create_table->table;
@@ -3708,15 +3773,13 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
TABLE const *const table = *tables;
if (thd->is_current_stmt_binlog_format_row() &&
- !table->s->tmp_table &&
- !ptr->get_create_info()->table_existed)
+ !table->s->tmp_table)
{
if (int error= ptr->binlog_show_create_table(tables, count))
return error;
}
return 0;
}
-
select_create *ptr;
TABLE_LIST *create_table;
TABLE_LIST *select_tables;
@@ -3739,34 +3802,15 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
thd->binlog_start_trans_and_stmt();
}
+ DBUG_ASSERT(create_table->table == NULL);
+
DBUG_EXECUTE_IF("sleep_create_select_before_check_if_exists", my_sleep(6000000););
- if (create_table->table)
- {
- /* Table already exists and was open at open_and_lock_tables() stage. */
- if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
- {
- /* Mark that table existed */
- create_info->table_existed= 1;
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
- ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
- create_table->table_name);
- if (thd->is_current_stmt_binlog_format_row())
- binlog_show_create_table(&(create_table->table), 1);
- table= create_table->table;
- }
- else
- {
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_table->table_name);
- DBUG_RETURN(-1);
- }
- }
- else
- if (!(table= create_table_from_items(thd, create_info, create_table,
- alter_info, &values,
- &extra_lock, hook_ptr)))
- /* abort() deletes table */
- DBUG_RETURN(-1);
+ if (!(table= create_table_from_items(thd, create_info, create_table,
+ alter_info, &values,
+ &extra_lock, hook_ptr)))
+ /* abort() deletes table */
+ DBUG_RETURN(-1);
if (extra_lock)
{
@@ -3886,10 +3930,6 @@ void select_create::send_error(uint errcode,const char *err)
("Current table (at 0x%lu) %s a temporary (or non-existant) table",
(ulong) table,
table && !table->s->tmp_table ? "is NOT" : "is"));
- DBUG_PRINT("info",
- ("Table %s prior to executing this statement",
- get_create_info()->table_existed ? "existed" : "did not exist"));
-
/*
This will execute any rollbacks that are necessary before writing
the transcation cache.
@@ -3978,8 +4018,7 @@ void select_create::abort_result_set()
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
table->auto_increment_field_not_null= FALSE;
- if (!create_info->table_existed)
- drop_open_table(thd, table, create_table->db, create_table->table_name);
+ drop_open_table(thd, table, create_table->db, create_table->table_name);
table=0; // Safety
}
DBUG_VOID_RETURN;
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 81e609faa4e..ff0422a517f 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -402,6 +402,7 @@ void lex_start(THD *thd)
lex->spname= NULL;
lex->sphead= NULL;
lex->spcont= NULL;
+ lex->m_stmt= NULL;
lex->proc_list.first= 0;
lex->escape_used= FALSE;
lex->query_tables= 0;
@@ -1439,8 +1440,6 @@ int lex_one_token(void *arg, void *yythd)
}
else
{
- const char* version_mark= lip->get_ptr() - 1;
- DBUG_ASSERT(*version_mark == '!');
/*
Patch and skip the conditional comment to avoid it
being propagated infinitely (eg. to a slave).
@@ -1449,7 +1448,6 @@ int lex_one_token(void *arg, void *yythd)
comment_closed= ! consume_comment(lip, 1);
if (! comment_closed)
{
- DBUG_ASSERT(pcom == version_mark);
*pcom= '!';
}
/* version allowed to have one level of comment inside. */
@@ -2301,7 +2299,7 @@ void Query_tables_list::reset_query_tables_list(bool init)
sroutines_list_own_last= sroutines_list.next;
sroutines_list_own_elements= 0;
binlog_stmt_flags= 0;
- stmt_accessed_table_flag= 0;
+ stmt_accessed_table_flag= 0;
}
@@ -3146,3 +3144,150 @@ bool LEX::is_partition_management() const
alter_info.flags == ALTER_REORGANIZE_PARTITION));
}
+
+#ifdef MYSQL_SERVER
+uint binlog_unsafe_map[256];
+
+#define UNSAFE(a, b, c) \
+ { \
+ DBUG_PRINT("unsafe_mixed_statement", ("SETTING BASE VALUES: %s, %s, %02X\n", \
+ LEX::stmt_accessed_table_string(a), \
+ LEX::stmt_accessed_table_string(b), \
+ c)); \
+ unsafe_mixed_statement(a, b, c); \
+ }
+
+/*
+ Sets the combination given by "a" and "b" and automatically combinations
+ given by other types of access, i.e. 2^(8 - 2), as unsafe.
+
+ It may happen a colision when automatically defining a combination as unsafe.
+ For that reason, a combination has its unsafe condition redefined only when
+ the new_condition is greater then the old. For instance,
+
+ . (BINLOG_DIRECT_ON & TRX_CACHE_NOT_EMPTY) is never overwritten by
+ . (BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF).
+*/
+void unsafe_mixed_statement(LEX::enum_stmt_accessed_table a,
+ LEX::enum_stmt_accessed_table b, uint condition)
+{
+ int type= 0;
+ int index= (1U << a) | (1U << b);
+
+
+ for (type= 0; type < 256; type++)
+ {
+ if ((type & index) == index)
+ {
+ binlog_unsafe_map[type] |= condition;
+ }
+ }
+}
+/*
+ The BINLOG_* AND TRX_CACHE_* values can be combined by using '&' or '|',
+ which means that both conditions need to be satisfied or any of them is
+ enough. For example,
+
+ . BINLOG_DIRECT_ON & TRX_CACHE_NOT_EMPTY means that the statment is
+ unsafe when the option is on and trx-cache is not empty;
+
+ . BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF means the statement is unsafe
+ in all cases.
+
+ . TRX_CACHE_EMPTY | TRX_CACHE_NOT_EMPTY means the statement is unsafe
+ in all cases. Similar as above.
+*/
+void binlog_unsafe_map_init()
+{
+ memset((void*) binlog_unsafe_map, 0, sizeof(uint) * 256);
+
+ /*
+ Classify a statement as unsafe when there is a mixed statement and an
+ on-going transaction at any point of the execution if:
+
+ 1. The mixed statement is about to update a transactional table and
+ a non-transactional table.
+
+ 2. The mixed statement is about to update a transactional table and
+ read from a non-transactional table.
+
+ 3. The mixed statement is about to update a non-transactional table
+ and temporary transactional table.
+
+ 4. The mixed statement is about to update a temporary transactional
+ table and read from a non-transactional table.
+
+ 5. The mixed statement is about to update a transactional table and
+ a temporary non-transactional table.
+
+ 6. The mixed statement is about to update a transactional table and
+ read from a temporary non-transactional table.
+
+ 7. The mixed statement is about to update a temporary transactional
+ table and temporary non-transactional table.
+
+ 8. The mixed statement is about to update a temporary transactional
+ table and read from a temporary non-transactional table.
+
+ After updating a transactional table if:
+
+ 9. The mixed statement is about to update a non-transactional table
+ and read from a transactional table.
+
+ 10. The mixed statement is about to update a non-transactional table
+ and read from a temporary transactional table.
+
+ 11. The mixed statement is about to update a temporary non-transactional
+ table and read from a transactional table.
+
+ 12. The mixed statement is about to update a temporary non-transactional
+ table and read from a temporary transactional table.
+
+ 13. The mixed statement is about to update a temporary non-transactional
+ table and read from a non-transactional table.
+
+ The reason for this is that locks acquired may not protected a concurrent
+ transaction of interfering in the current execution and by consequence in
+ the result.
+ */
+ /* Case 1. */
+ UNSAFE(LEX::STMT_WRITES_TRANS_TABLE, LEX::STMT_WRITES_NON_TRANS_TABLE,
+ BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF);
+ /* Case 2. */
+ UNSAFE(LEX::STMT_WRITES_TRANS_TABLE, LEX::STMT_READS_NON_TRANS_TABLE,
+ BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF);
+ /* Case 3. */
+ UNSAFE(LEX::STMT_WRITES_NON_TRANS_TABLE, LEX::STMT_WRITES_TEMP_TRANS_TABLE,
+ BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF);
+ /* Case 4. */
+ UNSAFE(LEX::STMT_WRITES_TEMP_TRANS_TABLE, LEX::STMT_READS_NON_TRANS_TABLE,
+ BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF);
+ /* Case 5. */
+ UNSAFE(LEX::STMT_WRITES_TRANS_TABLE, LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE,
+ BINLOG_DIRECT_ON);
+ /* Case 6. */
+ UNSAFE(LEX::STMT_WRITES_TRANS_TABLE, LEX::STMT_READS_TEMP_NON_TRANS_TABLE,
+ BINLOG_DIRECT_ON);
+ /* Case 7. */
+ UNSAFE(LEX::STMT_WRITES_TEMP_TRANS_TABLE, LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE,
+ BINLOG_DIRECT_ON);
+ /* Case 8. */
+ UNSAFE(LEX::STMT_WRITES_TEMP_TRANS_TABLE, LEX::STMT_READS_TEMP_NON_TRANS_TABLE,
+ BINLOG_DIRECT_ON);
+ /* Case 9. */
+ UNSAFE(LEX::STMT_WRITES_NON_TRANS_TABLE, LEX::STMT_READS_TRANS_TABLE,
+ (BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF) & TRX_CACHE_NOT_EMPTY);
+ /* Case 10 */
+ UNSAFE(LEX::STMT_WRITES_NON_TRANS_TABLE, LEX::STMT_READS_TEMP_TRANS_TABLE,
+ (BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF) & TRX_CACHE_NOT_EMPTY);
+ /* Case 11. */
+ UNSAFE(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE, LEX::STMT_READS_TRANS_TABLE,
+ BINLOG_DIRECT_ON & TRX_CACHE_NOT_EMPTY);
+ /* Case 12. */
+ UNSAFE(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE, LEX::STMT_READS_TEMP_TRANS_TABLE,
+ BINLOG_DIRECT_ON & TRX_CACHE_NOT_EMPTY);
+ /* Case 13. */
+ UNSAFE(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE, LEX::STMT_READS_NON_TRANS_TABLE,
+ BINLOG_DIRECT_OFF & TRX_CACHE_NOT_EMPTY);
+}
+#endif
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 2635a31f1a3..c6662501cf6 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -47,6 +47,53 @@ class Key;
class File_parser;
class Key_part_spec;
+#ifdef MYSQL_SERVER
+/*
+ There are 8 different type of table access so there is no more than
+ combinations 2^8 = 256:
+
+ . STMT_READS_TRANS_TABLE
+
+ . STMT_READS_NON_TRANS_TABLE
+
+ . STMT_READS_TEMP_TRANS_TABLE
+
+ . STMT_READS_TEMP_NON_TRANS_TABLE
+
+ . STMT_WRITES_TRANS_TABLE
+
+ . STMT_WRITES_NON_TRANS_TABLE
+
+ . STMT_WRITES_TEMP_TRANS_TABLE
+
+ . STMT_WRITES_TEMP_NON_TRANS_TABLE
+
+ The unsafe conditions for each combination is represented within a byte
+ and stores the status of the option --binlog-direct-non-trans-updates,
+ whether the trx-cache is empty or not, and whether the isolation level
+ is lower than ISO_REPEATABLE_READ:
+
+ . option (OFF/ON)
+ . trx-cache (empty/not empty)
+ . isolation (>= ISO_REPEATABLE_READ / < ISO_REPEATABLE_READ)
+
+ bits 0 : . OFF, . empty, . >= ISO_REPEATABLE_READ
+ bits 1 : . OFF, . empty, . < ISO_REPEATABLE_READ
+ bits 2 : . OFF, . not empty, . >= ISO_REPEATABLE_READ
+ bits 3 : . OFF, . not empty, . < ISO_REPEATABLE_READ
+ bits 4 : . ON, . empty, . >= ISO_REPEATABLE_READ
+ bits 5 : . ON, . empty, . < ISO_REPEATABLE_READ
+ bits 6 : . ON, . not empty, . >= ISO_REPEATABLE_READ
+ bits 7 : . ON, . not empty, . < ISO_REPEATABLE_READ
+*/
+extern uint binlog_unsafe_map[256];
+/*
+ Initializes the array with unsafe combinations and its respective
+ conditions.
+*/
+void binlog_unsafe_map_init();
+#endif
+
/**
used by the parser to store internal variable name
*/
@@ -919,6 +966,24 @@ enum enum_alter_table_change_level
ALTER_TABLE_INDEX_CHANGED= 2
};
+
+/**
+ Temporary hack to enable a class bound forward declaration
+ of the enum_alter_table_change_level enumeration. To be
+ removed once Alter_info is moved to the sql_alter.h
+ header.
+*/
+class Alter_table_change_level
+{
+private:
+ typedef enum enum_alter_table_change_level enum_type;
+ enum_type value;
+public:
+ void operator = (enum_type v) { value = v; }
+ operator enum_type () { return value; }
+};
+
+
/**
@brief Parsing data for CREATE or ALTER TABLE.
@@ -1286,33 +1351,33 @@ public:
*/
STMT_READS_TRANS_TABLE= 0,
/*
- If a transactional table is about to be updated.
- */
- STMT_WRITES_TRANS_TABLE,
- /*
If a non-transactional table is about to be read. Note that
a write implies a read.
*/
STMT_READS_NON_TRANS_TABLE,
/*
- If a non-transactional table is about to be updated.
- */
- STMT_WRITES_NON_TRANS_TABLE,
- /*
If a temporary transactional table is about to be read. Note
that a write implies a read.
*/
STMT_READS_TEMP_TRANS_TABLE,
/*
- If a temporary transactional table is about to be updated.
- */
- STMT_WRITES_TEMP_TRANS_TABLE,
- /*
If a temporary non-transactional table is about to be read. Note
that a write implies a read.
*/
STMT_READS_TEMP_NON_TRANS_TABLE,
/*
+ If a transactional table is about to be updated.
+ */
+ STMT_WRITES_TRANS_TABLE,
+ /*
+ If a non-transactional table is about to be updated.
+ */
+ STMT_WRITES_NON_TRANS_TABLE,
+ /*
+ If a temporary transactional table is about to be updated.
+ */
+ STMT_WRITES_TEMP_TRANS_TABLE,
+ /*
If a temporary non-transactional table is about to be updated.
*/
STMT_WRITES_TEMP_NON_TRANS_TABLE,
@@ -1322,7 +1387,58 @@ public:
*/
STMT_ACCESS_TABLE_COUNT
};
+
+ static inline const char *stmt_accessed_table_string(enum_stmt_accessed_table accessed_table)
+ {
+ switch (accessed_table)
+ {
+ case STMT_READS_TRANS_TABLE:
+ return "STMT_READS_TRANS_TABLE";
+ break;
+ case STMT_READS_NON_TRANS_TABLE:
+ return "STMT_READS_NON_TRANS_TABLE";
+ break;
+ case STMT_READS_TEMP_TRANS_TABLE:
+ return "STMT_READS_TEMP_TRANS_TABLE";
+ break;
+ case STMT_READS_TEMP_NON_TRANS_TABLE:
+ return "STMT_READS_TEMP_NON_TRANS_TABLE";
+ break;
+ case STMT_WRITES_TRANS_TABLE:
+ return "STMT_WRITES_TRANS_TABLE";
+ break;
+ case STMT_WRITES_NON_TRANS_TABLE:
+ return "STMT_WRITES_NON_TRANS_TABLE";
+ break;
+ case STMT_WRITES_TEMP_TRANS_TABLE:
+ return "STMT_WRITES_TEMP_TRANS_TABLE";
+ break;
+ case STMT_WRITES_TEMP_NON_TRANS_TABLE:
+ return "STMT_WRITES_TEMP_NON_TRANS_TABLE";
+ break;
+ case STMT_ACCESS_TABLE_COUNT:
+ default:
+ DBUG_ASSERT(0);
+ break;
+ }
+ }
+ #define BINLOG_DIRECT_ON 0xF0 /* unsafe when
+ --binlog-direct-non-trans-updates
+ is ON */
+
+ #define BINLOG_DIRECT_OFF 0xF /* unsafe when
+ --binlog-direct-non-trans-updates
+ is OFF */
+
+ #define TRX_CACHE_EMPTY 0x33 /* unsafe when trx-cache is empty */
+
+ #define TRX_CACHE_NOT_EMPTY 0xCC /* unsafe when trx-cache is not empty */
+
+ #define IL_LT_REPEATABLE 0xAA /* unsafe when < ISO_REPEATABLE_READ */
+
+ #define IL_GTE_REPEATABLE 0x55 /* unsafe when >= ISO_REPEATABLE_READ */
+
/**
Sets the type of table that is about to be accessed while executing a
statement.
@@ -1332,7 +1448,7 @@ public:
*/
inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table)
{
- DBUG_ENTER("THD::set_stmt_accessed_table");
+ DBUG_ENTER("LEX::set_stmt_accessed_table");
DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
stmt_accessed_table_flag |= (1U << accessed_table);
@@ -1345,7 +1461,7 @@ public:
statement.
@param accessed_table Enumeration type that defines the type of table,
- e.g. temporary, transactional, non-transactional.
+ e.g. temporary, transactional, non-transactional.
@return
@retval TRUE if the type of the table is about to be accessed
@@ -1353,7 +1469,7 @@ public:
*/
inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table)
{
- DBUG_ENTER("THD::stmt_accessed_table");
+ DBUG_ENTER("LEX::stmt_accessed_table");
DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
@@ -1361,40 +1477,79 @@ public:
}
/**
- Checks if a temporary table is about to be accessed while executing a
- statement.
+ Checks if a temporary non-transactional table is about to be accessed
+ while executing a statement.
@return
- @retval TRUE if a temporary table is about to be accessed
+ @retval TRUE if a temporary non-transactional table is about to be
+ accessed
@retval FALSE otherwise
*/
- inline bool stmt_accessed_temp_table()
+ inline bool stmt_accessed_non_trans_temp_table()
{
- DBUG_ENTER("THD::stmt_accessed_temp_table");
+ DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
DBUG_RETURN((stmt_accessed_table_flag &
- ((1U << STMT_READS_TEMP_TRANS_TABLE) |
- (1U << STMT_WRITES_TEMP_TRANS_TABLE) |
- (1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
+ ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
(1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
}
- /**
- Checks if a temporary non-transactional table is about to be accessed
- while executing a statement.
+ /*
+ Checks if a mixed statement is unsafe.
+
+ @param in_multi_stmt_transaction_mode defines if there is an on-going
+ multi-transactional statement.
+ @param binlog_direct defines if --binlog-direct-non-trans-updates is
+ active.
+ @param trx_cache_is_not_empty defines if the trx-cache is empty or not.
+ @param trx_isolation defines the isolation level.
+
@return
- @retval TRUE if a temporary non-transactional table is about to be
- accessed
+ @retval TRUE if the mixed statement is unsafe
@retval FALSE otherwise
*/
- inline bool stmt_accessed_non_trans_temp_table()
+ inline bool is_mixed_stmt_unsafe(bool in_multi_stmt_transaction_mode,
+ bool binlog_direct,
+ bool trx_cache_is_not_empty,
+ uint tx_isolation)
{
- DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
+ bool unsafe= FALSE;
- DBUG_RETURN((stmt_accessed_table_flag &
- ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
- (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
+ if (in_multi_stmt_transaction_mode)
+ {
+ uint condition=
+ (binlog_direct ? BINLOG_DIRECT_ON : BINLOG_DIRECT_OFF) &
+ (trx_cache_is_not_empty ? TRX_CACHE_NOT_EMPTY : TRX_CACHE_EMPTY) &
+ (tx_isolation >= ISO_REPEATABLE_READ ? IL_GTE_REPEATABLE : IL_LT_REPEATABLE);
+
+ unsafe= (binlog_unsafe_map[stmt_accessed_table_flag] & condition);
+
+#if !defined(DBUG_OFF)
+ DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("RESULT %02X %02X %02X\n", condition,
+ binlog_unsafe_map[stmt_accessed_table_flag],
+ (binlog_unsafe_map[stmt_accessed_table_flag] & condition)));
+
+ int type_in= 0;
+ for (; type_in < STMT_ACCESS_TABLE_COUNT; type_in++)
+ {
+ if (stmt_accessed_table((enum_stmt_accessed_table) type_in))
+ DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("ACCESSED %s ",
+ stmt_accessed_table_string((enum_stmt_accessed_table) type_in)));
+ }
+#endif
+ }
+
+ if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
+ stmt_accessed_table(STMT_READS_TRANS_TABLE) &&
+ tx_isolation < ISO_REPEATABLE_READ)
+ unsafe= TRUE;
+ else if (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
+ stmt_accessed_table(STMT_READS_TRANS_TABLE) &&
+ tx_isolation < ISO_REPEATABLE_READ)
+ unsafe= TRUE;
+
+ return(unsafe);
}
/**
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index d367c1c4fde..15efa488173 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -189,6 +189,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
bool is_concurrent;
DBUG_ENTER("mysql_load");
+ /*
+ Bug #34283
+ mysqlbinlog leaves tmpfile after termination if binlog contains
+ load data infile, so in mixed mode we go to row-based for
+ avoiding the problem.
+ */
+ thd->set_current_stmt_binlog_format_row_if_mixed();
+
#ifdef EMBEDDED_LIBRARY
read_file_from_client = 0; //server is always in the same process
#endif
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 505e6038978..5d669de3110 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -50,6 +50,8 @@
// mysql_backup_table,
// mysql_restore_table
#include "sql_truncate.h" // mysql_truncate_table
+#include "sql_reload.h" // reload_acl_and_cache
+#include "sql_admin.h" // mysql_assign_to_keycache
#include "sql_connect.h" // check_user,
// decrease_user_connections,
// thd_init_client_charset, check_mqh,
@@ -658,8 +660,7 @@ end:
every child. Set 'db' for every child if not present.
*/
#ifndef NO_EMBEDDED_ACCESS_CHECKS
-static bool check_merge_table_access(THD *thd, char *db,
- TABLE_LIST *table_list)
+bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list)
{
int error= 0;
@@ -1627,140 +1628,6 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
/**
- Implementation of FLUSH TABLES <table_list> WITH READ LOCK.
-
- In brief: take exclusive locks, expel tables from the table
- cache, reopen the tables, enter the 'LOCKED TABLES' mode,
- downgrade the locks.
- Note: the function is written to be called from
- mysql_execute_command(), it is not reusable in arbitrary
- execution context.
-
- Required privileges
- -------------------
- Since the statement implicitly enters LOCK TABLES mode,
- it requires LOCK TABLES privilege on every table.
- But since the rest of FLUSH commands require
- the global RELOAD_ACL, it also requires RELOAD_ACL.
-
- Compatibility with the global read lock
- ---------------------------------------
- We don't wait for the GRL, since neither the
- 5.1 combination that this new statement is intended to
- replace (LOCK TABLE <list> WRITE; FLUSH TABLES;),
- nor FLUSH TABLES WITH READ LOCK do.
- @todo: this is not implemented, Dmitry disagrees.
- Currently we wait for GRL in another connection,
- but are compatible with a GRL in our own connection.
-
- Behaviour under LOCK TABLES
- ---------------------------
- Bail out: i.e. don't perform an implicit UNLOCK TABLES.
- This is not consistent with LOCK TABLES statement, but is
- in line with behaviour of FLUSH TABLES WITH READ LOCK, and we
- try to not introduce any new statements with implicit
- semantics.
-
- Compatibility with parallel updates
- -----------------------------------
- As a result, we will wait for all open transactions
- against the tables to complete. After the lock downgrade,
- new transactions will be able to read the tables, but not
- write to them.
-
- Differences from FLUSH TABLES <list>
- -------------------------------------
- - you can't flush WITH READ LOCK a non-existent table
- - you can't flush WITH READ LOCK under LOCK TABLES
- - currently incompatible with the GRL (@todo: fix)
-
- Effect on views and temporary tables.
- ------------------------------------
- You can only apply this command to existing base tables.
- If a view with such name exists, ER_WRONG_OBJECT is returned.
- If a temporary table with such name exists, it's ignored:
- if there is a base table, it's used, otherwise ER_NO_SUCH_TABLE
- is returned.
-*/
-
-static bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
-{
- Lock_tables_prelocking_strategy lock_tables_prelocking_strategy;
- TABLE_LIST *table_list;
-
- /*
- This is called from SQLCOM_FLUSH, the transaction has
- been committed implicitly.
- */
-
- /* RELOAD_ACL is checked by the caller. Check table-level privileges. */
- if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
- FALSE, UINT_MAX, FALSE))
- goto error;
-
- if (thd->locked_tables_mode)
- {
- my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
- goto error;
- }
-
- /*
- @todo: Since lock_table_names() acquires a global IX
- lock, this actually waits for a GRL in another connection.
- We are thus introducing an incompatibility.
- Do nothing for now, since not taking a global IX violates
- current internal MDL asserts, fix after discussing with
- Dmitry.
- */
- if (lock_table_names(thd, all_tables, 0, thd->variables.lock_wait_timeout,
- MYSQL_OPEN_SKIP_TEMPORARY))
- goto error;
-
- for (table_list= all_tables; table_list;
- table_list= table_list->next_global)
- {
- /* Remove the table from cache. */
- mysql_mutex_lock(&LOCK_open);
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
- table_list->db,
- table_list->table_name);
- mysql_mutex_unlock(&LOCK_open);
-
- /* Skip views and temporary tables. */
- table_list->required_type= FRMTYPE_TABLE; /* Don't try to flush views. */
- table_list->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */
- }
-
- if (open_and_lock_tables(thd, all_tables, FALSE,
- MYSQL_OPEN_HAS_MDL_LOCK,
- &lock_tables_prelocking_strategy) ||
- thd->locked_tables_list.init_locked_tables(thd))
- {
- goto error;
- }
- thd->variables.option_bits|= OPTION_TABLE_LOCK;
-
- /*
- Downgrade the exclusive locks.
- Use MDL_SHARED_NO_WRITE as the intended
- post effect of this call is identical
- to LOCK TABLES <...> READ, and we didn't use
- thd->in_lock_talbes and thd->sql_command= SQLCOM_LOCK_TABLES
- hacks to enter the LTM.
- @todo: release the global IX lock here!!!
- */
- for (table_list= all_tables; table_list;
- table_list= table_list->next_global)
- table_list->mdl_request.ticket->downgrade_exclusive_lock(MDL_SHARED_NO_WRITE);
-
- return FALSE;
-
-error:
- return TRUE;
-}
-
-
-/**
Read query from packet and store in thd->query.
Used in COM_QUERY and COM_STMT_PREPARE.
@@ -2521,13 +2388,7 @@ case SQLCOM_PREPARE:
}
#endif
- /* Set strategies: reset default or 'prepared' values. */
- create_table->open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
- create_table->lock_strategy= TABLE_LIST::OTLS_DOWNGRADE_IF_EXISTS;
-
- /*
- Close any open handlers for the table
- */
+ /* Close any open handlers for the table. */
mysql_ha_rm_tables(thd, create_table);
if (select_lex->item_list.elements) // With select
@@ -2587,44 +2448,25 @@ case SQLCOM_PREPARE:
goto end_with_restore_list;
}
- if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
- {
- /* Base table and temporary table are not in the same name space. */
- create_table->open_type= OT_BASE_ONLY;
- }
-
if (!(res= open_and_lock_tables(thd, lex->query_tables, TRUE, 0)))
{
- /*
- Is table which we are changing used somewhere in other parts
- of query
- */
- if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
+ /* The table already exists */
+ if (create_table->table)
{
- TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, create_table, select_tables, 0)))
+ if (create_info.options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
- update_non_unique_table_error(create_table, "CREATE", duplicate);
- res= 1;
- goto end_with_restore_list;
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR,
+ ER(ER_TABLE_EXISTS_ERROR),
+ create_info.alias);
+ my_ok(thd);
}
- }
- /* If we create merge table, we have to test tables in merge, too */
- if (create_info.used_fields & HA_CREATE_USED_UNION)
- {
- TABLE_LIST *tab;
- for (tab= create_info.merge_list.first;
- tab;
- tab= tab->next_local)
+ else
{
- TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, tab, select_tables, 0)))
- {
- update_non_unique_table_error(tab, "CREATE", duplicate);
- res= 1;
- goto end_with_restore_list;
- }
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_info.alias);
+ res= 1;
}
+ goto end_with_restore_list;
}
/*
@@ -2657,7 +2499,7 @@ case SQLCOM_PREPARE:
res= handle_select(thd, lex, result, 0);
delete result;
}
-
+
lex->link_first_table_back(create_table, link_to_local);
}
}
@@ -2762,77 +2604,6 @@ end_with_restore_list:
}
#endif /* HAVE_REPLICATION */
- case SQLCOM_ALTER_TABLE:
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- {
- ulong priv=0;
- ulong priv_needed= ALTER_ACL;
- /*
- Code in mysql_alter_table() may modify its HA_CREATE_INFO argument,
- so we have to use a copy of this structure to make execution
- prepared statement- safe. A shallow copy is enough as no memory
- referenced from this structure will be modified.
- */
- HA_CREATE_INFO create_info(lex->create_info);
- Alter_info alter_info(lex->alter_info, thd->mem_root);
-
- if (thd->is_fatal_error) /* out of memory creating a copy of alter_info */
- goto error;
- /*
- We also require DROP priv for ALTER TABLE ... DROP PARTITION, as well
- as for RENAME TO, as being done by SQLCOM_RENAME_TABLE
- */
- if (alter_info.flags & (ALTER_DROP_PARTITION | ALTER_RENAME))
- priv_needed|= DROP_ACL;
-
- /* Must be set in the parser */
- DBUG_ASSERT(select_lex->db);
- if (check_access(thd, priv_needed, first_table->db,
- &first_table->grant.privilege,
- &first_table->grant.m_internal,
- 0, 0) ||
- check_access(thd, INSERT_ACL | CREATE_ACL, select_lex->db,
- &priv,
- NULL, /* Do not use first_table->grant with select_lex->db */
- 0, 0) ||
- check_merge_table_access(thd, first_table->db,
- create_info.merge_list.first))
- goto error; /* purecov: inspected */
- if (check_grant(thd, priv_needed, all_tables, FALSE, UINT_MAX, FALSE))
- goto error;
- if (lex->name.str && !test_all_bits(priv,INSERT_ACL | CREATE_ACL))
- { // Rename of table
- TABLE_LIST tmp_table;
- bzero((char*) &tmp_table,sizeof(tmp_table));
- tmp_table.table_name= lex->name.str;
- tmp_table.db=select_lex->db;
- tmp_table.grant.privilege=priv;
- if (check_grant(thd, INSERT_ACL | CREATE_ACL, &tmp_table, FALSE,
- UINT_MAX, FALSE))
- goto error;
- }
-
- /* Don't yet allow changing of symlinks with ALTER TABLE */
- if (create_info.data_file_name)
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
- "DATA DIRECTORY");
- if (create_info.index_file_name)
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
- "INDEX DIRECTORY");
- create_info.data_file_name= create_info.index_file_name= NULL;
-
- thd->enable_slow_log= opt_log_slow_admin_statements;
- res= mysql_alter_table(thd, select_lex->db, lex->name.str,
- &create_info,
- first_table,
- &alter_info,
- select_lex->order_list.elements,
- select_lex->order_list.first,
- lex->ignore);
- break;
- }
case SQLCOM_RENAME_TABLE:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
@@ -2952,81 +2723,6 @@ end_with_restore_list:
res = mysql_checksum_table(thd, first_table, &lex->check_opt);
break;
}
- case SQLCOM_REPAIR:
- {
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
- FALSE, UINT_MAX, FALSE))
- goto error; /* purecov: inspected */
- thd->enable_slow_log= opt_log_slow_admin_statements;
- res= mysql_repair_table(thd, first_table, &lex->check_opt);
- /* ! we write after unlocking the table */
- if (!res && !lex->no_write_to_binlog)
- {
- /*
- Presumably, REPAIR and binlog writing doesn't require synchronization
- */
- res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
- }
- select_lex->table_list.first= first_table;
- lex->query_tables=all_tables;
- break;
- }
- case SQLCOM_CHECK:
- {
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (check_table_access(thd, SELECT_ACL, all_tables,
- TRUE, UINT_MAX, FALSE))
- goto error; /* purecov: inspected */
- thd->enable_slow_log= opt_log_slow_admin_statements;
- res = mysql_check_table(thd, first_table, &lex->check_opt);
- select_lex->table_list.first= first_table;
- lex->query_tables=all_tables;
- break;
- }
- case SQLCOM_ANALYZE:
- {
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
- FALSE, UINT_MAX, FALSE))
- goto error; /* purecov: inspected */
- thd->enable_slow_log= opt_log_slow_admin_statements;
- res= mysql_analyze_table(thd, first_table, &lex->check_opt);
- /* ! we write after unlocking the table */
- if (!res && !lex->no_write_to_binlog)
- {
- /*
- Presumably, ANALYZE and binlog writing doesn't require synchronization
- */
- res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
- }
- select_lex->table_list.first= first_table;
- lex->query_tables=all_tables;
- break;
- }
-
- case SQLCOM_OPTIMIZE:
- {
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
- FALSE, UINT_MAX, FALSE))
- goto error; /* purecov: inspected */
- thd->enable_slow_log= opt_log_slow_admin_statements;
- res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ?
- mysql_recreate_table(thd, first_table) :
- mysql_optimize_table(thd, first_table, &lex->check_opt);
- /* ! we write after unlocking the table */
- if (!res && !lex->no_write_to_binlog)
- {
- /*
- Presumably, OPTIMIZE and binlog writing doesn't require synchronization
- */
- res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
- }
- select_lex->table_list.first= first_table;
- lex->query_tables=all_tables;
- break;
- }
case SQLCOM_UPDATE:
{
ha_rows found= 0, updated= 0;
@@ -3247,23 +2943,6 @@ end_with_restore_list:
break;
}
- case SQLCOM_TRUNCATE:
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (check_one_table_access(thd, DROP_ACL, all_tables))
- goto error;
- /*
- Don't allow this within a transaction because we want to use
- re-generate table
- */
- if (thd->in_active_multi_stmt_transaction())
- {
- my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
- goto error;
- }
- if (! (res= mysql_truncate_table(thd, first_table)))
- my_ok(thd);
- break;
case SQLCOM_DELETE:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
@@ -3345,7 +3024,7 @@ end_with_restore_list:
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
thd->variables.option_bits|= OPTION_KEEP_LOG;
}
- /* DDL and binlog write order protected by LOCK_open */
+ /* DDL and binlog write order are protected by metadata locks. */
res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
lex->drop_temporary);
}
@@ -3898,6 +3577,10 @@ end_with_restore_list:
if (first_table && lex->type & REFRESH_READ_LOCK)
{
+ /* Check table-level privileges. */
+ if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
+ FALSE, UINT_MAX, FALSE))
+ goto error;
if (flush_tables_with_read_lock(thd, all_tables))
goto error;
my_ok(thd);
@@ -4657,6 +4340,14 @@ create_sp_error:
my_ok(thd, 1);
break;
}
+ case SQLCOM_ANALYZE:
+ case SQLCOM_CHECK:
+ case SQLCOM_OPTIMIZE:
+ case SQLCOM_REPAIR:
+ case SQLCOM_TRUNCATE:
+ case SQLCOM_ALTER_TABLE:
+ DBUG_ASSERT(first_table == all_tables && first_table != 0);
+ /* fall through */
case SQLCOM_SIGNAL:
case SQLCOM_RESIGNAL:
DBUG_ASSERT(lex->m_stmt != NULL);
@@ -6638,258 +6329,6 @@ void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields,
/**
- Reload/resets privileges and the different caches.
-
- @param thd Thread handler (can be NULL!)
- @param options What should be reset/reloaded (tables, privileges, slave...)
- @param tables Tables to flush (if any)
- @param write_to_binlog True if we can write to the binlog.
-
- @note Depending on 'options', it may be very bad to write the
- query to the binlog (e.g. FLUSH SLAVE); this is a
- pointer where reload_acl_and_cache() will put 0 if
- it thinks we really should not write to the binlog.
- Otherwise it will put 1.
-
- @return Error status code
- @retval 0 Ok
- @retval !=0 Error; thd->killed is set or thd->is_error() is true
-*/
-
-bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
- bool *write_to_binlog)
-{
- bool result=0;
- select_errors=0; /* Write if more errors */
- bool tmp_write_to_binlog= 1;
-
- DBUG_ASSERT(!thd || !thd->in_sub_stmt);
-
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (options & REFRESH_GRANT)
- {
- THD *tmp_thd= 0;
- /*
- If reload_acl_and_cache() is called from SIGHUP handler we have to
- allocate temporary THD for execution of acl_reload()/grant_reload().
- */
- if (!thd && (thd= (tmp_thd= new THD)))
- {
- thd->thread_stack= (char*) &tmp_thd;
- thd->store_globals();
- }
-
- if (thd)
- {
- bool reload_acl_failed= acl_reload(thd);
- bool reload_grants_failed= grant_reload(thd);
- bool reload_servers_failed= servers_reload(thd);
-
- if (reload_acl_failed || reload_grants_failed || reload_servers_failed)
- {
- result= 1;
- /*
- When an error is returned, my_message may have not been called and
- the client will hang waiting for a response.
- */
- my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed");
- }
- }
-
- if (tmp_thd)
- {
- delete tmp_thd;
- /* Remember that we don't have a THD */
- my_pthread_setspecific_ptr(THR_THD, 0);
- thd= 0;
- }
- reset_mqh((LEX_USER *)NULL, TRUE);
- }
-#endif
- if (options & REFRESH_LOG)
- {
- /*
- Flush the normal query log, the update log, the binary log,
- the slow query log, the relay log (if it exists) and the log
- tables.
- */
-
- options|= REFRESH_BINARY_LOG;
- options|= REFRESH_RELAY_LOG;
- options|= REFRESH_SLOW_LOG;
- options|= REFRESH_GENERAL_LOG;
- options|= REFRESH_ENGINE_LOG;
- options|= REFRESH_ERROR_LOG;
- }
-
- if (options & REFRESH_ERROR_LOG)
- if (flush_error_log())
- result= 1;
-
- if ((options & REFRESH_SLOW_LOG) && opt_slow_log)
- logger.flush_slow_log();
-
- if ((options & REFRESH_GENERAL_LOG) && opt_log)
- logger.flush_general_log();
-
- if (options & REFRESH_ENGINE_LOG)
- if (ha_flush_logs(NULL))
- result= 1;
-
- if (options & REFRESH_BINARY_LOG)
- {
- /*
- Writing this command to the binlog may result in infinite loops
- when doing mysqlbinlog|mysql, and anyway it does not really make
- sense to log it automatically (would cause more trouble to users
- than it would help them)
- */
- tmp_write_to_binlog= 0;
- if (mysql_bin_log.is_open())
- mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE);
- }
- if (options & REFRESH_RELAY_LOG)
- {
-#ifdef HAVE_REPLICATION
- mysql_mutex_lock(&LOCK_active_mi);
- rotate_relay_log(active_mi);
- mysql_mutex_unlock(&LOCK_active_mi);
-#endif
- }
-#ifdef HAVE_QUERY_CACHE
- if (options & REFRESH_QUERY_CACHE_FREE)
- {
- query_cache.pack(); // FLUSH QUERY CACHE
- options &= ~REFRESH_QUERY_CACHE; // Don't flush cache, just free memory
- }
- if (options & (REFRESH_TABLES | REFRESH_QUERY_CACHE))
- {
- query_cache.flush(); // RESET QUERY CACHE
- }
-#endif /*HAVE_QUERY_CACHE*/
-
- DBUG_ASSERT(!thd || thd->locked_tables_mode ||
- !thd->mdl_context.has_locks() ||
- thd->handler_tables_hash.records ||
- thd->global_read_lock.is_acquired());
-
- /*
- Note that if REFRESH_READ_LOCK bit is set then REFRESH_TABLES is set too
- (see sql_yacc.yy)
- */
- if (options & (REFRESH_TABLES | REFRESH_READ_LOCK))
- {
- if ((options & REFRESH_READ_LOCK) && thd)
- {
- /*
- On the first hand we need write lock on the tables to be flushed,
- on the other hand we must not try to aspire a global read lock
- if we have a write locked table as this would lead to a deadlock
- when trying to reopen (and re-lock) the table after the flush.
- */
- if (thd->locked_tables_mode)
- {
- my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
- return 1;
- }
- /*
- Writing to the binlog could cause deadlocks, as we don't log
- UNLOCK TABLES
- */
- tmp_write_to_binlog= 0;
- if (thd->global_read_lock.lock_global_read_lock(thd))
- return 1; // Killed
- if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
- FALSE : TRUE))
- result= 1;
-
- if (thd->global_read_lock.make_global_read_lock_block_commit(thd)) // Killed
- {
- /* Don't leave things in a half-locked state */
- thd->global_read_lock.unlock_global_read_lock(thd);
- return 1;
- }
- }
- else
- {
- if (thd && thd->locked_tables_mode)
- {
- /*
- If we are under LOCK TABLES we should have a write
- lock on tables which we are going to flush.
- */
- if (tables)
- {
- for (TABLE_LIST *t= tables; t; t= t->next_local)
- if (!find_table_for_mdl_upgrade(thd->open_tables, t->db,
- t->table_name, FALSE))
- return 1;
- }
- else
- {
- for (TABLE *tab= thd->open_tables; tab; tab= tab->next)
- {
- if (! tab->mdl_ticket->is_upgradable_or_exclusive())
- {
- my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),
- tab->s->table_name.str);
- return 1;
- }
- }
- }
- }
-
- if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
- FALSE : TRUE))
- result= 1;
- }
- my_dbopt_cleanup();
- }
- if (options & REFRESH_HOSTS)
- hostname_cache_refresh();
- if (thd && (options & REFRESH_STATUS))
- refresh_status(thd);
- if (options & REFRESH_THREADS)
- flush_thread_cache();
-#ifdef HAVE_REPLICATION
- if (options & REFRESH_MASTER)
- {
- DBUG_ASSERT(thd);
- tmp_write_to_binlog= 0;
- if (reset_master(thd))
- {
- result=1;
- }
- }
-#endif
-#ifdef OPENSSL
- if (options & REFRESH_DES_KEY_FILE)
- {
- if (des_key_file && load_des_key_file(des_key_file))
- result= 1;
- }
-#endif
-#ifdef HAVE_REPLICATION
- if (options & REFRESH_SLAVE)
- {
- tmp_write_to_binlog= 0;
- mysql_mutex_lock(&LOCK_active_mi);
- if (reset_slave(thd, active_mi))
- result=1;
- mysql_mutex_unlock(&LOCK_active_mi);
- }
-#endif
- if (options & REFRESH_USER_RESOURCES)
- reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */
- *write_to_binlog= tmp_write_to_binlog;
- /*
- If the query was killed then this function must fail.
- */
- return result || (thd ? thd->killed : 0);
-}
-
-
-/**
kill on thread.
@param thd Thread class
@@ -7420,7 +6859,7 @@ void create_table_set_open_action_and_adjust_tables(LEX *lex)
if (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)
create_table->open_type= OT_TEMPORARY_ONLY;
- else if (!lex->select_lex.item_list.elements)
+ else
create_table->open_type= OT_BASE_ONLY;
if (!lex->select_lex.item_list.elements)
@@ -7800,6 +7239,7 @@ bool parse_sql(THD *thd,
{
bool ret_value;
DBUG_ASSERT(thd->m_parser_state == NULL);
+ DBUG_ASSERT(thd->lex->m_stmt == NULL);
MYSQL_QUERY_PARSE_START(thd->query());
/* Backup creation context. */
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 8b7fe8f7b83..ad620544d29 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -93,8 +93,6 @@ void mysql_init_multi_delete(LEX *lex);
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
void create_table_set_open_action_and_adjust_tables(LEX *lex);
pthread_handler_t handle_bootstrap(void *arg);
-bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
- bool *write_to_binlog);
int mysql_execute_command(THD *thd);
bool do_command(THD *thd);
void do_handle_bootstrap(THD *thd);
@@ -155,6 +153,7 @@ bool check_single_table_access(THD *thd, ulong privilege,
bool check_routine_access(THD *thd,ulong want_access,char *db,char *name,
bool is_proc, bool no_errors);
bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
+bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list);
bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc);
bool check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
GRANT_INTERNAL_INFO *grant_internal_info,
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index fb880cce8d3..b72816f8ce3 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -63,6 +63,7 @@
#include "sql_table.h" // build_table_filename,
// build_table_shadow_filename,
// table_to_filename
+ // mysql_*_alter_copy_data
#include "opt_range.h" // store_key_image_to_rec
#include "sql_analyse.h" // append_escaped
@@ -71,6 +72,8 @@
#define ERROR_INJECT_CRASH(code) \
DBUG_EVALUATE_IF(code, (abort(), 0), 0)
+#define ERROR_INJECT_ERROR(code) \
+ DBUG_EVALUATE_IF(code, (my_error(ER_UNKNOWN_ERROR, MYF(0)), TRUE), 0)
/*
Partition related functions declarations and some static constants;
@@ -4375,7 +4378,6 @@ static int fast_end_partition(THD *thd, ulonglong copied,
ALTER_PARTITION_PARAM_TYPE *lpt,
bool written_bin_log)
{
- int error;
char tmp_name[80];
DBUG_ENTER("fast_end_partition");
@@ -4384,13 +4386,6 @@ static int fast_end_partition(THD *thd, ulonglong copied,
if (!is_empty)
query_cache_invalidate3(thd, table_list, 0);
- error= trans_commit_stmt(thd);
- if (trans_commit_implicit(thd))
- error= 1;
-
- if (error)
- DBUG_RETURN(TRUE); /* The error has been reported */
-
if ((!is_empty) && (!written_bin_log) &&
(!thd->lex->no_write_to_binlog) &&
write_bin_log(thd, FALSE, thd->query(), thd->query_length()))
@@ -5533,17 +5528,25 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
char path[FN_REFLEN+1];
int error;
handler *file= lpt->table->file;
+ THD *thd= lpt->thd;
DBUG_ENTER("mysql_change_partitions");
build_table_filename(path, sizeof(path) - 1, lpt->db, lpt->table_name, "", 0);
+
+ if(mysql_trans_prepare_alter_copy_data(thd))
+ DBUG_RETURN(TRUE);
+
if ((error= file->ha_change_partitions(lpt->create_info, path, &lpt->copied,
&lpt->deleted, lpt->pack_frm_data,
lpt->pack_frm_len)))
{
file->print_error(error, MYF(error != ER_OUTOFMEMORY ? 0 : ME_FATALERROR));
- DBUG_RETURN(TRUE);
}
- DBUG_RETURN(FALSE);
+
+ if (mysql_trans_commit_alter_copy_data(thd))
+ DBUG_RETURN(TRUE); /* The error has been reported */
+
+ DBUG_RETURN(test(error));
}
@@ -6109,25 +6112,32 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
- DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL;
+ DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
char tmp_path[FN_REFLEN + 1];
char path[FN_REFLEN + 1];
uint next_entry= 0;
+ DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
+ /* write_log_drop_shadow_frm(lpt) must have been run first */
+ DBUG_ASSERT(old_first_log_entry);
DBUG_ENTER("write_log_add_change_partition");
build_table_filename(path, sizeof(path) - 1, lpt->db,
lpt->table_name, "", 0);
build_table_shadow_filename(tmp_path, sizeof(tmp_path) - 1, lpt);
mysql_mutex_lock(&LOCK_gdl);
+
+ /* Relink the previous drop shadow frm entry */
+ if (old_first_log_entry)
+ next_entry= old_first_log_entry->entry_pos;
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
FALSE))
goto error;
- if (write_log_replace_delete_frm(lpt, next_entry, NULL, tmp_path,
- FALSE))
- goto error;
log_entry= part_info->first_log_entry;
+
if (write_execute_ddl_log_entry(log_entry->entry_pos,
- FALSE, &exec_log_entry))
+ FALSE,
+ /* Reuse the old execute ddl_log_entry */
+ &exec_log_entry))
goto error;
mysql_mutex_unlock(&LOCK_gdl);
set_part_info_exec_log_entry(part_info, exec_log_entry);
@@ -6136,7 +6146,7 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
error:
release_part_info_log_entries(part_info->first_log_entry);
mysql_mutex_unlock(&LOCK_gdl);
- part_info->first_log_entry= NULL;
+ part_info->first_log_entry= old_first_log_entry;
my_error(ER_DDL_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
@@ -6153,9 +6163,15 @@ error:
TRUE Error
FALSE Success
DESCRIPTION
- We will write log entries that specify to remove all partitions reorganised,
- to rename others to reflect the new naming scheme and to install the shadow
- frm file.
+ We will write log entries that specify to
+ 1) Install the shadow frm file.
+ 2) Remove all partitions reorganized. (To be able to reorganize a partition
+ to the same name. Like in REORGANIZE p0 INTO (p0, p1),
+ so that the later rename from the new p0-temporary name to p0 don't
+ fail because the partition already exists.
+ 3) Rename others to reflect the new naming scheme.
+
+ Note that it is written in the ddl log in reverse.
*/
static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
@@ -6169,20 +6185,25 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
uint next_entry= 0;
DBUG_ENTER("write_log_final_change_partition");
+ /*
+ Do not link any previous log entry.
+ Replace the revert operations with forced retry operations.
+ */
part_info->first_log_entry= NULL;
build_table_filename(path, sizeof(path) - 1, lpt->db,
lpt->table_name, "", 0);
build_table_shadow_filename(shadow_path, sizeof(shadow_path) - 1, lpt);
mysql_mutex_lock(&LOCK_gdl);
+ if (write_log_changed_partitions(lpt, &next_entry, (const char*)path))
+ goto error;
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
lpt->alter_info->flags & ALTER_REORGANIZE_PARTITION))
goto error;
- if (write_log_changed_partitions(lpt, &next_entry, (const char*)path))
- goto error;
- if (write_log_replace_delete_frm(lpt, 0UL, shadow_path, path, TRUE))
+ if (write_log_replace_delete_frm(lpt, next_entry, shadow_path, path, TRUE))
goto error;
log_entry= part_info->first_log_entry;
part_info->frm_log_entry= log_entry;
+ /* Overwrite the revert execute log entry with this retry execute entry */
if (write_execute_ddl_log_entry(log_entry->entry_pos,
FALSE, &exec_log_entry))
goto error;
@@ -6282,6 +6303,55 @@ 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)
+{
+ TABLE_SHARE *share= lpt->table->s;
+ THD *thd= lpt->thd;
+ TABLE *table;
+ DBUG_ENTER("alter_close_tables");
+ /*
+ We must keep LOCK_open while manipulating with thd->open_tables.
+ Another thread may be working on it.
+ */
+ mysql_mutex_lock(&LOCK_open);
+ /*
+ We can safely remove locks for all tables with the same name:
+ later they will all be closed anyway in
+ alter_partition_lock_handling().
+ */
+ for (table= thd->open_tables; table ; table= table->next)
+ {
+ if (!strcmp(table->s->table_name.str, share->table_name.str) &&
+ !strcmp(table->s->db.str, share->db.str))
+ {
+ mysql_lock_remove(thd, thd->lock, table);
+ table->file->close();
+ table->db_stat= 0; // Mark file closed
+ /*
+ Ensure that we won't end up with a crippled table instance
+ in the table cache if an error occurs before we reach
+ alter_partition_lock_handling() and the table is closed
+ by close_thread_tables() instead.
+ */
+ tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+ table->s->db.str,
+ table->s->table_name.str, TRUE);
+ }
+ }
+ mysql_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(0);
+}
+
+
+/*
Handle errors for ALTER TABLE for partitioning
SYNOPSIS
handle_alter_part_error()
@@ -6294,13 +6364,26 @@ static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt)
void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
bool not_completed,
bool drop_partition,
- bool frm_install)
+ bool frm_install,
+ bool close_table)
{
partition_info *part_info= lpt->part_info;
DBUG_ENTER("handle_alter_part_error");
+ if (close_table)
+ {
+ /*
+ Since the error handling (ddl_log) needs to drop newly created
+ partitions they must be closed first to not issue errors.
+ But we still need some information from the part_info object,
+ so we clone it first to have a copy.
+ */
+ part_info= lpt->part_info->get_clone();
+ alter_close_tables(lpt);
+ }
+
if (part_info->first_log_entry &&
- execute_ddl_log_entry(current_thd,
+ execute_ddl_log_entry(lpt->thd,
part_info->first_log_entry->entry_pos))
{
/*
@@ -6401,6 +6484,22 @@ void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
}
+/**
+ Downgrade an exclusive MDL lock if under LOCK TABLE.
+
+ If we don't downgrade the lock, it will not be downgraded or released
+ until the table is unlocked, resulting in blocking other threads using
+ the table.
+*/
+
+static void downgrade_mdl_if_lock_tables_mode(THD *thd, MDL_ticket *ticket,
+ enum_mdl_type type)
+{
+ if (thd->locked_tables_mode)
+ ticket->downgrade_exclusive_lock(type);
+}
+
+
/*
Actually perform the change requested by ALTER TABLE of partitions
previously prepared.
@@ -6438,7 +6537,9 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ALTER_PARTITION_PARAM_TYPE *lpt= &lpt_obj;
bool written_bin_log= TRUE;
bool not_completed= TRUE;
+ bool close_table_on_failure= FALSE;
bool frm_install= FALSE;
+ MDL_ticket *mdl_ticket= table->mdl_ticket;
DBUG_ENTER("fast_alter_partition_table");
lpt->thd= thd;
@@ -6537,20 +6638,18 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
0) Write an entry that removes the shadow frm file if crash occurs
1) Write the new frm file as a shadow frm
- 2) Write the ddl log to ensure that the operation is completed
- even in the presence of a MySQL Server crash
- 3) Lock the table in TL_WRITE_ONLY to ensure all other accesses to
- the table have completed. This ensures that other threads can not
- execute on the table in parallel.
- 4) Get an exclusive metadata lock on the table. This ensures that we
+ 2) Get an exclusive metadata lock on the table (waits for all active
+ transactions using this table). This ensures that we
can release all other locks on the table and since no one can open
the table, there can be no new threads accessing the table. They
will be hanging on this exclusive lock.
- 5) Close all tables that have already been opened but didn't stumble on
+ 3) Write the ddl log to ensure that the operation is completed
+ even in the presence of a MySQL Server crash (the log is executed
+ before any other threads are started, so there are no locking issues).
+ 4) Close all tables that have already been opened but didn't stumble on
the abort locked previously. This is done as part of the
- close_data_files_and_morph_locks call.
- 6) We are now ready to release all locks we got in this thread.
- 7) Write the bin log
+ alter_close_tables call.
+ 5) Write the bin log
Unfortunately the writing of the binlog is not synchronised with
other logging activities. So no matter in which order the binlog
is written compared to other activities there will always be cases
@@ -6561,40 +6660,54 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
require writing the statement first in the ddl log and then
when recovering from the crash read the binlog and insert it into
the binlog if not written already.
- 8) Install the previously written shadow frm file
- 9) Prepare handlers for drop of partitions
- 10) Drop the partitions
- 11) Remove entries from ddl log
- 12) Reopen table if under lock tables
- 13) Complete query
+ 6) Install the previously written shadow frm file
+ 7) Prepare handlers for drop of partitions
+ 8) Drop the partitions
+ 9) Remove entries from ddl log
+ 10) Reopen table if under lock tables
+ 11) Complete query
We insert Error injections at all places where it could be interesting
to test if recovery is properly done.
*/
if (write_log_drop_shadow_frm(lpt) ||
ERROR_INJECT_CRASH("crash_drop_partition_1") ||
+ ERROR_INJECT_ERROR("fail_drop_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECT_CRASH("crash_drop_partition_2") ||
- write_log_drop_partition(lpt) ||
+ ERROR_INJECT_ERROR("fail_drop_partition_2") ||
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
ERROR_INJECT_CRASH("crash_drop_partition_3") ||
- (not_completed= FALSE) ||
- abort_and_upgrade_lock_and_close_table(lpt) ||
+ ERROR_INJECT_ERROR("fail_drop_partition_3") ||
+ (close_table_on_failure= TRUE, FALSE) ||
+ write_log_drop_partition(lpt) ||
+ ERROR_INJECT_CRASH("crash_drop_partition_4") ||
+ ERROR_INJECT_ERROR("fail_drop_partition_4") ||
+ (close_table_on_failure= FALSE, FALSE) ||
+ (not_completed= FALSE, FALSE) ||
+ alter_close_tables(lpt) ||
ERROR_INJECT_CRASH("crash_drop_partition_5") ||
+ ERROR_INJECT_ERROR("fail_drop_partition_5") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_drop_partition_6") ||
- ((frm_install= TRUE), FALSE) ||
+ ERROR_INJECT_ERROR("fail_drop_partition_6") ||
+ (frm_install= TRUE, FALSE) ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
- ((frm_install= FALSE), FALSE) ||
+ (frm_install= FALSE, FALSE) ||
ERROR_INJECT_CRASH("crash_drop_partition_7") ||
+ ERROR_INJECT_ERROR("fail_drop_partition_7") ||
mysql_drop_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_drop_partition_8") ||
+ ERROR_INJECT_ERROR("fail_drop_partition_8") ||
(write_log_completed(lpt, FALSE), FALSE) ||
ERROR_INJECT_CRASH("crash_drop_partition_9") ||
+ ERROR_INJECT_ERROR("fail_drop_partition_9") ||
(alter_partition_lock_handling(lpt), FALSE))
{
- handle_alter_part_error(lpt, not_completed, TRUE, frm_install);
+ handle_alter_part_error(lpt, not_completed, TRUE, frm_install,
+ close_table_on_failure);
goto err;
}
}
@@ -6613,54 +6726,64 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
0) Write an entry that removes the shadow frm file if crash occurs
1) Write the new frm file as a shadow frm file
- 2) Log the changes to happen in ddl log
- 2) Add the new partitions
- 3) Lock all partitions in TL_WRITE_ONLY to ensure that no users
- are still using the old partitioning scheme. Wait until all
- ongoing users have completed before progressing.
- 4) Get an exclusive metadata lock on the table. This ensures that we
+ 2) Get an exclusive metadata lock on the table (waits for all active
+ transactions using this table). This ensures that we
can release all other locks on the table and since no one can open
the table, there can be no new threads accessing the table. They
will be hanging on this exclusive lock.
- 5) Close all tables that have already been opened but didn't stumble on
- the abort locked previously. This is done as part of the
- close_data_files_and_morph_locks call.
- 6) Close all table handlers and unlock all handlers but retain
- metadata lock.
- 7) Write binlog
- 8) Now the change is completed except for the installation of the
+ 3) Write an entry to remove the new parttions if crash occurs
+ 4) Add the new partitions.
+ 5) Close all instances of the table and remove them from the table cache.
+ 6) Write binlog
+ 7) Now the change is completed except for the installation of the
new frm file. We thus write an action in the log to change to
the shadow frm file
- 9) Install the new frm file of the table where the partitions are
+ 8) Install the new frm file of the table where the partitions are
added to the table.
- 10)Wait until all accesses using the old frm file has completed
- 11)Remove entries from ddl log
- 12)Reopen tables if under lock tables
- 13)Complete query
+ 9) Remove entries from ddl log
+ 10)Reopen tables if under lock tables
+ 11)Complete query
*/
- if (write_log_add_change_partition(lpt) ||
+ if (write_log_drop_shadow_frm(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_1") ||
+ ERROR_INJECT_ERROR("fail_add_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECT_CRASH("crash_add_partition_2") ||
- mysql_change_partitions(lpt) ||
+ ERROR_INJECT_ERROR("fail_add_partition_2") ||
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
ERROR_INJECT_CRASH("crash_add_partition_3") ||
- abort_and_upgrade_lock_and_close_table(lpt) ||
+ ERROR_INJECT_ERROR("fail_add_partition_3") ||
+ (close_table_on_failure= TRUE, FALSE) ||
+ write_log_add_change_partition(lpt) ||
+ ERROR_INJECT_CRASH("crash_add_partition_4") ||
+ ERROR_INJECT_ERROR("fail_add_partition_4") ||
+ mysql_change_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_5") ||
+ ERROR_INJECT_ERROR("fail_add_partition_5") ||
+ (close_table_on_failure= FALSE, FALSE) ||
+ alter_close_tables(lpt) ||
+ ERROR_INJECT_CRASH("crash_add_partition_6") ||
+ ERROR_INJECT_ERROR("fail_add_partition_6") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
- ERROR_INJECT_CRASH("crash_add_partition_6") ||
- write_log_rename_frm(lpt) ||
- (not_completed= FALSE) ||
ERROR_INJECT_CRASH("crash_add_partition_7") ||
- ((frm_install= TRUE), FALSE) ||
- mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
+ ERROR_INJECT_ERROR("fail_add_partition_7") ||
+ write_log_rename_frm(lpt) ||
+ (frm_install= TRUE, FALSE) ||
+ (not_completed= FALSE, FALSE) ||
ERROR_INJECT_CRASH("crash_add_partition_8") ||
- (write_log_completed(lpt, FALSE), FALSE) ||
+ ERROR_INJECT_ERROR("fail_add_partition_8") ||
+ mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
ERROR_INJECT_CRASH("crash_add_partition_9") ||
+ ERROR_INJECT_ERROR("fail_add_partition_9") ||
+ (write_log_completed(lpt, FALSE), FALSE) ||
+ ERROR_INJECT_CRASH("crash_add_partition_10") ||
+ ERROR_INJECT_ERROR("fail_add_partition_10") ||
(alter_partition_lock_handling(lpt), FALSE))
{
- handle_alter_part_error(lpt, not_completed, FALSE, frm_install);
+ handle_alter_part_error(lpt, not_completed, FALSE, frm_install,
+ close_table_on_failure);
goto err;
}
}
@@ -6703,13 +6826,14 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
removed in a crash situation
3) Add the new partitions
Copy from the reorganised partitions to the new partitions
- 4) Log that operation is completed and log all complete actions
+ 4) Get an exclusive metadata lock on the table (waits for all active
+ transactions using this table). This ensures that we
+ can release all other locks on the table and since no one can open
+ the table, there can be no new threads accessing the table. They
+ will be hanging on this exclusive lock.
+ 5) Close all instances of the table and remove them from the table cache.
+ 6) Log that operation is completed and log all complete actions
needed to complete operation from here
- 5) Upgrade shared metadata lock on the table to an exclusive one.
- After this we can be sure that there is no other connection
- using this table (they will be waiting for metadata lock).
- 6) Close all table instances opened by this thread, but retain
- exclusive metadata lock.
7) Write bin log
8) Prepare handlers for rename and delete of partitions
9) Rename and drop the reorged partitions such that they are no
@@ -6718,36 +6842,56 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
11) Reopen the table if under lock tables
12) Complete query
*/
- if (write_log_add_change_partition(lpt) ||
+ if (write_log_drop_shadow_frm(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_1") ||
+ ERROR_INJECT_ERROR("fail_change_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECT_CRASH("crash_change_partition_2") ||
- mysql_change_partitions(lpt) ||
+ ERROR_INJECT_ERROR("fail_change_partition_2") ||
+ (close_table_on_failure= TRUE, FALSE) ||
+ write_log_add_change_partition(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_3") ||
- write_log_final_change_partition(lpt) ||
+ ERROR_INJECT_ERROR("fail_change_partition_3") ||
+ mysql_change_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_4") ||
- (not_completed= FALSE) ||
- abort_and_upgrade_lock_and_close_table(lpt) ||
+ ERROR_INJECT_ERROR("fail_change_partition_4") ||
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
+ ERROR_INJECT_CRASH("crash_change_partition_5") ||
+ ERROR_INJECT_ERROR("fail_change_partition_5") ||
+ alter_close_tables(lpt) ||
+ (close_table_on_failure= FALSE) ||
ERROR_INJECT_CRASH("crash_change_partition_6") ||
+ ERROR_INJECT_ERROR("fail_change_partition_6") ||
+ write_log_final_change_partition(lpt) ||
+ (not_completed= FALSE) ||
+ ERROR_INJECT_CRASH("crash_change_partition_7") ||
+ ERROR_INJECT_ERROR("fail_change_partition_7") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
- ERROR_INJECT_CRASH("crash_change_partition_7") ||
- mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
ERROR_INJECT_CRASH("crash_change_partition_8") ||
- mysql_drop_partitions(lpt) ||
+ ERROR_INJECT_ERROR("fail_change_partition_8") ||
+ mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
ERROR_INJECT_CRASH("crash_change_partition_9") ||
+ ERROR_INJECT_ERROR("fail_change_partition_9") ||
+ mysql_drop_partitions(lpt) ||
+ ERROR_INJECT_CRASH("crash_change_partition_10") ||
+ ERROR_INJECT_ERROR("fail_change_partition_10") ||
mysql_rename_partitions(lpt) ||
((frm_install= TRUE), FALSE) ||
- ERROR_INJECT_CRASH("crash_change_partition_10") ||
- (write_log_completed(lpt, FALSE), FALSE) ||
ERROR_INJECT_CRASH("crash_change_partition_11") ||
+ ERROR_INJECT_ERROR("fail_change_partition_11") ||
+ (write_log_completed(lpt, FALSE), FALSE) ||
+ ERROR_INJECT_CRASH("crash_change_partition_12") ||
+ ERROR_INJECT_ERROR("fail_change_partition_12") ||
(alter_partition_lock_handling(lpt), FALSE))
{
- handle_alter_part_error(lpt, not_completed, FALSE, frm_install);
+ handle_alter_part_error(lpt, not_completed, FALSE, frm_install,
+ close_table_on_failure);
goto err;
}
}
+ downgrade_mdl_if_lock_tables_mode(thd, mdl_ticket, MDL_SHARED_NO_READ_WRITE);
/*
A final step is to write the query to the binlog and send ok to the
user
@@ -6756,6 +6900,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
table_list, FALSE, NULL,
written_bin_log));
err:
+ downgrade_mdl_if_lock_tables_mode(thd, mdl_ticket, MDL_SHARED_NO_READ_WRITE);
+ table->m_needs_reopen= TRUE;
DBUG_RETURN(TRUE);
}
#endif
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc
new file mode 100644
index 00000000000..fee33303a04
--- /dev/null
+++ b/sql/sql_partition_admin.cc
@@ -0,0 +1,139 @@
+/* Copyright (c) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "sql_parse.h" // check_one_table_access
+#include "sql_table.h" // mysql_alter_table, etc.
+#include "sql_lex.h" // Sql_statement
+#include "sql_truncate.h" // mysql_truncate_table,
+ // Truncate_statement
+#include "sql_admin.h" // Analyze/Check/.._table_statement
+#include "sql_partition_admin.h" // Alter_table_*_partition
+
+#ifndef WITH_PARTITION_STORAGE_ENGINE
+
+bool Partition_statement_unsupported::execute(THD *)
+{
+ DBUG_ENTER("Partition_statement_unsupported::execute");
+ /* error, partitioning support not compiled in... */
+ my_error(ER_FEATURE_DISABLED, MYF(0), "partitioning",
+ "--with-plugin-partition");
+ DBUG_RETURN(TRUE);
+}
+
+#else
+
+bool Alter_table_analyze_partition_statement::execute(THD *thd)
+{
+ bool res;
+ DBUG_ENTER("Alter_table_analyze_partition_statement::execute");
+
+ /*
+ Flag that it is an ALTER command which administrates partitions, used
+ by ha_partition
+ */
+ m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+
+ res= Analyze_table_statement::execute(thd);
+
+ DBUG_RETURN(res);
+}
+
+
+bool Alter_table_check_partition_statement::execute(THD *thd)
+{
+ bool res;
+ DBUG_ENTER("Alter_table_check_partition_statement::execute");
+
+ /*
+ Flag that it is an ALTER command which administrates partitions, used
+ by ha_partition
+ */
+ m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+
+ res= Check_table_statement::execute(thd);
+
+ DBUG_RETURN(res);
+}
+
+
+bool Alter_table_optimize_partition_statement::execute(THD *thd)
+{
+ bool res;
+ DBUG_ENTER("Alter_table_optimize_partition_statement::execute");
+
+ /*
+ Flag that it is an ALTER command which administrates partitions, used
+ by ha_partition
+ */
+ m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+
+ res= Optimize_table_statement::execute(thd);
+
+ DBUG_RETURN(res);
+}
+
+
+bool Alter_table_repair_partition_statement::execute(THD *thd)
+{
+ bool res;
+ DBUG_ENTER("Alter_table_repair_partition_statement::execute");
+
+ /*
+ Flag that it is an ALTER command which administrates partitions, used
+ by ha_partition
+ */
+ m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+
+ res= Repair_table_statement::execute(thd);
+
+ DBUG_RETURN(res);
+}
+
+
+bool Alter_table_truncate_partition_statement::execute(THD *thd)
+{
+ TABLE_LIST *first_table= thd->lex->select_lex.table_list.first;
+ bool res;
+ enum_sql_command original_sql_command;
+ DBUG_ENTER("Alter_table_truncate_partition_statement::execute");
+
+ /*
+ Execute TRUNCATE PARTITION just like TRUNCATE TABLE.
+ Some storage engines (InnoDB, partition) checks thd_sql_command,
+ so we set it to SQLCOM_TRUNCATE during the execution.
+ */
+ original_sql_command= m_lex->sql_command;
+ m_lex->sql_command= SQLCOM_TRUNCATE;
+
+ /*
+ Flag that it is an ALTER command which administrates partitions, used
+ by ha_partition.
+ */
+ m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+
+ /*
+ Fix the lock types (not the same as ordinary ALTER TABLE).
+ */
+ first_table->lock_type= TL_WRITE;
+ first_table->mdl_request.set_type(MDL_SHARED_NO_READ_WRITE);
+
+ /* execute as a TRUNCATE TABLE */
+ res= Truncate_statement::execute(thd);
+
+ m_lex->sql_command= original_sql_command;
+ DBUG_RETURN(res);
+}
+
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
diff --git a/sql/sql_partition_admin.h b/sql/sql_partition_admin.h
new file mode 100644
index 00000000000..36bafec4202
--- /dev/null
+++ b/sql/sql_partition_admin.h
@@ -0,0 +1,236 @@
+/* Copyright (c) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SQL_PARTITION_ADMIN_H
+#define SQL_PARTITION_ADMIN_H
+
+#ifndef WITH_PARTITION_STORAGE_ENGINE
+
+/**
+ Stub class that returns a error if the partition storage engine is
+ not supported.
+*/
+class Partition_statement_unsupported : public Sql_statement
+{
+public:
+ Partition_statement_unsupported(LEX *lex)
+ : Sql_statement(lex)
+ {}
+
+ ~Partition_statement_unsupported()
+ {}
+
+ bool execute(THD *thd);
+};
+
+
+class Alter_table_analyze_partition_statement :
+ public Partition_statement_unsupported
+{
+public:
+ Alter_table_analyze_partition_statement(LEX *lex)
+ : Partition_statement_unsupported(lex)
+ {}
+
+ ~Alter_table_analyze_partition_statement()
+ {}
+};
+
+
+class Alter_table_check_partition_statement :
+ public Partition_statement_unsupported
+{
+public:
+ Alter_table_check_partition_statement(LEX *lex)
+ : Partition_statement_unsupported(lex)
+ {}
+
+ ~Alter_table_check_partition_statement()
+ {}
+};
+
+
+class Alter_table_optimize_partition_statement :
+ public Partition_statement_unsupported
+{
+public:
+ Alter_table_optimize_partition_statement(LEX *lex)
+ : Partition_statement_unsupported(lex)
+ {}
+
+ ~Alter_table_optimize_partition_statement()
+ {}
+};
+
+
+class Alter_table_repair_partition_statement :
+ public Partition_statement_unsupported
+{
+public:
+ Alter_table_repair_partition_statement(LEX *lex)
+ : Partition_statement_unsupported(lex)
+ {}
+
+ ~Alter_table_repair_partition_statement()
+ {}
+};
+
+
+class Alter_table_truncate_partition_statement :
+ public Partition_statement_unsupported
+{
+public:
+ Alter_table_truncate_partition_statement(LEX *lex)
+ : Partition_statement_unsupported(lex)
+ {}
+
+ ~Alter_table_truncate_partition_statement()
+ {}
+};
+
+
+#else
+
+/**
+ Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement.
+*/
+class Alter_table_analyze_partition_statement : public Analyze_table_statement
+{
+public:
+ /**
+ Constructor, used to represent a ALTER TABLE ANALYZE PARTITION statement.
+ @param lex the LEX structure for this statement.
+ */
+ Alter_table_analyze_partition_statement(LEX *lex)
+ : Analyze_table_statement(lex)
+ {}
+
+ ~Alter_table_analyze_partition_statement()
+ {}
+
+ /**
+ Execute a ALTER TABLE ANALYZE PARTITION statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+
+/**
+ Class that represents the ALTER TABLE t1 CHECK PARTITION p statement.
+*/
+class Alter_table_check_partition_statement : public Check_table_statement
+{
+public:
+ /**
+ Constructor, used to represent a ALTER TABLE CHECK PARTITION statement.
+ @param lex the LEX structure for this statement.
+ */
+ Alter_table_check_partition_statement(LEX *lex)
+ : Check_table_statement(lex)
+ {}
+
+ ~Alter_table_check_partition_statement()
+ {}
+
+ /**
+ Execute a ALTER TABLE CHECK PARTITION statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+
+/**
+ Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement.
+*/
+class Alter_table_optimize_partition_statement : public Optimize_table_statement
+{
+public:
+ /**
+ Constructor, used to represent a ALTER TABLE OPTIMIZE PARTITION statement.
+ @param lex the LEX structure for this statement.
+ */
+ Alter_table_optimize_partition_statement(LEX *lex)
+ : Optimize_table_statement(lex)
+ {}
+
+ ~Alter_table_optimize_partition_statement()
+ {}
+
+ /**
+ Execute a ALTER TABLE OPTIMIZE PARTITION statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+
+/**
+ Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement.
+*/
+class Alter_table_repair_partition_statement : public Repair_table_statement
+{
+public:
+ /**
+ Constructor, used to represent a ALTER TABLE REPAIR PARTITION statement.
+ @param lex the LEX structure for this statement.
+ */
+ Alter_table_repair_partition_statement(LEX *lex)
+ : Repair_table_statement(lex)
+ {}
+
+ ~Alter_table_repair_partition_statement()
+ {}
+
+ /**
+ Execute a ALTER TABLE REPAIR PARTITION statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+
+/**
+ Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement.
+*/
+class Alter_table_truncate_partition_statement : public Truncate_statement
+{
+public:
+ /**
+ Constructor, used to represent a ALTER TABLE TRUNCATE PARTITION statement.
+ @param lex the LEX structure for this statement.
+ */
+ Alter_table_truncate_partition_statement(LEX *lex)
+ : Truncate_statement(lex)
+ {}
+
+ ~Alter_table_truncate_partition_statement()
+ {}
+
+ /**
+ Execute a ALTER TABLE TRUNCATE PARTITION statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
+#endif /* SQL_PARTITION_ADMIN_H */
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index f749fbec4fb..05ff973cba0 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -29,7 +29,7 @@
#include "records.h" // init_read_record, end_read_record
#include <my_pthread.h>
#include <my_getopt.h>
-#include <mysql/plugin_audit.h>
+#include "sql_audit.h"
#include <mysql/plugin_auth.h>
#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
#define REPORT_TO_LOG 1
@@ -1397,8 +1397,9 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
READ_RECORD read_record_info;
int error;
THD *new_thd= &thd;
+ bool result;
#ifdef EMBEDDED_LIBRARY
- bool table_exists;
+ No_such_table_error_handler error_handler;
#endif /* EMBEDDED_LIBRARY */
DBUG_ENTER("plugin_load");
@@ -1414,13 +1415,18 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
When building an embedded library, if the mysql.plugin table
does not exist, we silently ignore the missing table
*/
- if (check_if_table_exists(new_thd, &tables, &table_exists))
- table_exists= FALSE;
- if (!table_exists)
+ new_thd->push_internal_handler(&error_handler);
+#endif /* EMBEDDED_LIBRARY */
+
+ result= open_and_lock_tables(new_thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT);
+
+#ifdef EMBEDDED_LIBRARY
+ new_thd->pop_internal_handler();
+ if (error_handler.safely_trapped_errors())
goto end;
#endif /* EMBEDDED_LIBRARY */
- if (open_and_lock_tables(new_thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
+ if (result)
{
DBUG_PRINT("error",("Can't open plugin table"));
sql_print_error("Can't open the mysql.plugin table. Please "
@@ -1707,6 +1713,27 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl
MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(TRUE);
+ /*
+ Pre-acquire audit plugins for events that may potentially occur
+ during [UN]INSTALL PLUGIN.
+
+ When audit event is triggered, audit subsystem acquires interested
+ plugins by walking through plugin list. Evidently plugin list
+ iterator protects plugin list by acquiring LOCK_plugin, see
+ plugin_foreach_with_mask().
+
+ On the other hand [UN]INSTALL PLUGIN is acquiring LOCK_plugin
+ rather for a long time.
+
+ When audit event is triggered during [UN]INSTALL PLUGIN, plugin
+ list iterator acquires the same lock (within the same thread)
+ second time.
+
+ This hack should be removed when LOCK_plugin is fixed so it
+ protects only what it supposed to protect.
+ */
+ mysql_audit_acquire_plugins(thd, MYSQL_AUDIT_GENERAL_CLASS);
+
mysql_mutex_lock(&LOCK_plugin);
mysql_rwlock_wrlock(&LOCK_system_variables_hash);
@@ -1787,6 +1814,27 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
if (! (table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(TRUE);
+ /*
+ Pre-acquire audit plugins for events that may potentially occur
+ during [UN]INSTALL PLUGIN.
+
+ When audit event is triggered, audit subsystem acquires interested
+ plugins by walking through plugin list. Evidently plugin list
+ iterator protects plugin list by acquiring LOCK_plugin, see
+ plugin_foreach_with_mask().
+
+ On the other hand [UN]INSTALL PLUGIN is acquiring LOCK_plugin
+ rather for a long time.
+
+ When audit event is triggered during [UN]INSTALL PLUGIN, plugin
+ list iterator acquires the same lock (within the same thread)
+ second time.
+
+ This hack should be removed when LOCK_plugin is fixed so it
+ protects only what it supposed to protect.
+ */
+ mysql_audit_acquire_plugins(thd, MYSQL_AUDIT_GENERAL_CLASS);
+
mysql_mutex_lock(&LOCK_plugin);
if (!(plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)))
{
@@ -3029,11 +3077,11 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
Allocate temporary space for the value of the tristate.
This option will have a limited lifetime and is not used beyond
server initialization.
- GET_ENUM value is an unsigned integer.
+ GET_ENUM value is an unsigned long integer.
*/
options[0].value= options[1].value=
- (uchar **)alloc_root(mem_root, sizeof(uint));
- *((uint*) options[0].value)= (uint) options[0].def_value;
+ (uchar **)alloc_root(mem_root, sizeof(ulong));
+ *((ulong*) options[0].value)= (ulong) options[0].def_value;
options+= 2;
}
@@ -3332,7 +3380,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
list is always the <plugin name> option value.
*/
if (!tmp->is_mandatory)
- plugin_load_policy= (enum_plugin_load_policy)*(uint*)opts[0].value;
+ plugin_load_policy= (enum_plugin_load_policy)*(ulong*)opts[0].value;
}
disable_plugin= (plugin_load_policy == PLUGIN_OFF);
diff --git a/sql/sql_plugin_services.h b/sql/sql_plugin_services.h
index 7491ddab79d..f39e22f1e21 100644
--- a/sql/sql_plugin_services.h
+++ b/sql/sql_plugin_services.h
@@ -36,9 +36,23 @@ static struct thd_alloc_service_st thd_alloc_handler= {
thd_make_lex_string
};
+static struct thd_wait_service_st thd_wait_handler= {
+ thd_wait_begin,
+ thd_wait_end
+};
+
+static struct my_thread_scheduler_service my_thread_scheduler_handler= {
+ my_thread_scheduler_set,
+ my_thread_scheduler_reset,
+};
+
+
static struct st_service_ref list_of_services[]=
{
{ "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler },
- { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler }
+ { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler },
+ { "thd_wait_service", VERSION_thd_wait, &thd_wait_handler },
+ { "my_thread_scheduler_service",
+ VERSION_my_thread_scheduler, &my_thread_scheduler_handler },
};
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index a77dbe2dab4..366c46d9c92 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -883,7 +883,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
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))
+ else if (! is_param_long_data_type(param))
DBUG_RETURN(1);
res= param->query_val_str(&str);
if (param->convert_str_value(thd))
@@ -929,7 +929,7 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array,
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))
+ else if (! is_param_long_data_type(param))
DBUG_RETURN(1);
if (param->convert_str_value(stmt->thd))
DBUG_RETURN(1); /* out of memory */
@@ -1717,14 +1717,6 @@ static bool mysql_test_create_table(Prepared_statement *stmt)
if (create_table_precheck(thd, tables, create_table))
DBUG_RETURN(TRUE);
- /*
- The open and lock strategies will be set again once the
- statement is executed. These values are only meaningful
- for the prepare phase.
- */
- create_table->open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
- create_table->lock_strategy= TABLE_LIST::OTLS_NONE;
-
if (select_lex->item_list.elements)
{
/* Base table and temporary table are not in the same name space. */
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
new file mode 100644
index 00000000000..bf38af78536
--- /dev/null
+++ b/sql/sql_reload.cc
@@ -0,0 +1,427 @@
+/* Copyright (c) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "sql_reload.h"
+#include "sql_priv.h"
+#include "mysqld.h" // select_errors
+#include "sql_class.h" // THD
+#include "sql_acl.h" // acl_reload
+#include "sql_servers.h" // servers_reload
+#include "sql_connect.h" // reset_mqh
+#include "sql_base.h" // close_cached_tables
+#include "sql_db.h" // my_dbopt_cleanup
+#include "hostname.h" // hostname_cache_refresh
+#include "sql_repl.h" // reset_master, reset_slave
+#include "debug_sync.h"
+
+
+/**
+ Reload/resets privileges and the different caches.
+
+ @param thd Thread handler (can be NULL!)
+ @param options What should be reset/reloaded (tables, privileges, slave...)
+ @param tables Tables to flush (if any)
+ @param write_to_binlog True if we can write to the binlog.
+
+ @note Depending on 'options', it may be very bad to write the
+ query to the binlog (e.g. FLUSH SLAVE); this is a
+ pointer where reload_acl_and_cache() will put 0 if
+ it thinks we really should not write to the binlog.
+ Otherwise it will put 1.
+
+ @return Error status code
+ @retval 0 Ok
+ @retval !=0 Error; thd->killed is set or thd->is_error() is true
+*/
+
+bool reload_acl_and_cache(THD *thd, unsigned long options,
+ TABLE_LIST *tables, bool *write_to_binlog)
+{
+ bool result=0;
+ select_errors=0; /* Write if more errors */
+ bool tmp_write_to_binlog= 1;
+
+ DBUG_ASSERT(!thd || !thd->in_sub_stmt);
+
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (options & REFRESH_GRANT)
+ {
+ THD *tmp_thd= 0;
+ /*
+ If reload_acl_and_cache() is called from SIGHUP handler we have to
+ allocate temporary THD for execution of acl_reload()/grant_reload().
+ */
+ if (!thd && (thd= (tmp_thd= new THD)))
+ {
+ thd->thread_stack= (char*) &tmp_thd;
+ thd->store_globals();
+ }
+
+ if (thd)
+ {
+ bool reload_acl_failed= acl_reload(thd);
+ bool reload_grants_failed= grant_reload(thd);
+ bool reload_servers_failed= servers_reload(thd);
+
+ if (reload_acl_failed || reload_grants_failed || reload_servers_failed)
+ {
+ result= 1;
+ /*
+ When an error is returned, my_message may have not been called and
+ the client will hang waiting for a response.
+ */
+ my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed");
+ }
+ }
+
+ if (tmp_thd)
+ {
+ delete tmp_thd;
+ /* Remember that we don't have a THD */
+ my_pthread_setspecific_ptr(THR_THD, 0);
+ thd= 0;
+ }
+ reset_mqh((LEX_USER *)NULL, TRUE);
+ }
+#endif
+ if (options & REFRESH_LOG)
+ {
+ /*
+ Flush the normal query log, the update log, the binary log,
+ the slow query log, the relay log (if it exists) and the log
+ tables.
+ */
+
+ options|= REFRESH_BINARY_LOG;
+ options|= REFRESH_RELAY_LOG;
+ options|= REFRESH_SLOW_LOG;
+ options|= REFRESH_GENERAL_LOG;
+ options|= REFRESH_ENGINE_LOG;
+ options|= REFRESH_ERROR_LOG;
+ }
+
+ if (options & REFRESH_ERROR_LOG)
+ if (flush_error_log())
+ result= 1;
+
+ if ((options & REFRESH_SLOW_LOG) && opt_slow_log)
+ logger.flush_slow_log();
+
+ if ((options & REFRESH_GENERAL_LOG) && opt_log)
+ logger.flush_general_log();
+
+ if (options & REFRESH_ENGINE_LOG)
+ if (ha_flush_logs(NULL))
+ result= 1;
+
+ if (options & REFRESH_BINARY_LOG)
+ {
+ /*
+ Writing this command to the binlog may result in infinite loops
+ when doing mysqlbinlog|mysql, and anyway it does not really make
+ sense to log it automatically (would cause more trouble to users
+ than it would help them)
+ */
+ tmp_write_to_binlog= 0;
+ if (mysql_bin_log.is_open())
+ mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE);
+ }
+ if (options & REFRESH_RELAY_LOG)
+ {
+#ifdef HAVE_REPLICATION
+ mysql_mutex_lock(&LOCK_active_mi);
+ rotate_relay_log(active_mi);
+ mysql_mutex_unlock(&LOCK_active_mi);
+#endif
+ }
+#ifdef HAVE_QUERY_CACHE
+ if (options & REFRESH_QUERY_CACHE_FREE)
+ {
+ query_cache.pack(); // FLUSH QUERY CACHE
+ options &= ~REFRESH_QUERY_CACHE; // Don't flush cache, just free memory
+ }
+ if (options & (REFRESH_TABLES | REFRESH_QUERY_CACHE))
+ {
+ query_cache.flush(); // RESET QUERY CACHE
+ }
+#endif /*HAVE_QUERY_CACHE*/
+
+ DBUG_ASSERT(!thd || thd->locked_tables_mode ||
+ !thd->mdl_context.has_locks() ||
+ thd->handler_tables_hash.records ||
+ thd->global_read_lock.is_acquired());
+
+ /*
+ Note that if REFRESH_READ_LOCK bit is set then REFRESH_TABLES is set too
+ (see sql_yacc.yy)
+ */
+ if (options & (REFRESH_TABLES | REFRESH_READ_LOCK))
+ {
+ if ((options & REFRESH_READ_LOCK) && thd)
+ {
+ /*
+ On the first hand we need write lock on the tables to be flushed,
+ on the other hand we must not try to aspire a global read lock
+ if we have a write locked table as this would lead to a deadlock
+ when trying to reopen (and re-lock) the table after the flush.
+ */
+ if (thd->locked_tables_mode)
+ {
+ my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
+ return 1;
+ }
+ /*
+ Writing to the binlog could cause deadlocks, as we don't log
+ UNLOCK TABLES
+ */
+ tmp_write_to_binlog= 0;
+ if (thd->global_read_lock.lock_global_read_lock(thd))
+ return 1; // Killed
+ if (close_cached_tables(thd, tables,
+ ((options & REFRESH_FAST) ? FALSE : TRUE),
+ thd->variables.lock_wait_timeout))
+ result= 1;
+
+ if (thd->global_read_lock.make_global_read_lock_block_commit(thd)) // Killed
+ {
+ /* Don't leave things in a half-locked state */
+ thd->global_read_lock.unlock_global_read_lock(thd);
+ return 1;
+ }
+ }
+ else
+ {
+ if (thd && thd->locked_tables_mode)
+ {
+ /*
+ If we are under LOCK TABLES we should have a write
+ lock on tables which we are going to flush.
+ */
+ if (tables)
+ {
+ for (TABLE_LIST *t= tables; t; t= t->next_local)
+ if (!find_table_for_mdl_upgrade(thd->open_tables, t->db,
+ t->table_name, FALSE))
+ return 1;
+ }
+ else
+ {
+ for (TABLE *tab= thd->open_tables; tab; tab= tab->next)
+ {
+ if (! tab->mdl_ticket->is_upgradable_or_exclusive())
+ {
+ my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),
+ tab->s->table_name.str);
+ return 1;
+ }
+ }
+ }
+ }
+
+ if (close_cached_tables(thd, tables,
+ ((options & REFRESH_FAST) ? FALSE : TRUE),
+ (thd ? thd->variables.lock_wait_timeout :
+ LONG_TIMEOUT)))
+ result= 1;
+ }
+ my_dbopt_cleanup();
+ }
+ if (options & REFRESH_HOSTS)
+ hostname_cache_refresh();
+ if (thd && (options & REFRESH_STATUS))
+ refresh_status(thd);
+ if (options & REFRESH_THREADS)
+ flush_thread_cache();
+#ifdef HAVE_REPLICATION
+ if (options & REFRESH_MASTER)
+ {
+ DBUG_ASSERT(thd);
+ tmp_write_to_binlog= 0;
+ if (reset_master(thd))
+ {
+ result=1;
+ }
+ }
+#endif
+#ifdef OPENSSL
+ if (options & REFRESH_DES_KEY_FILE)
+ {
+ if (des_key_file && load_des_key_file(des_key_file))
+ result= 1;
+ }
+#endif
+#ifdef HAVE_REPLICATION
+ if (options & REFRESH_SLAVE)
+ {
+ tmp_write_to_binlog= 0;
+ mysql_mutex_lock(&LOCK_active_mi);
+ if (reset_slave(thd, active_mi))
+ result=1;
+ mysql_mutex_unlock(&LOCK_active_mi);
+ }
+#endif
+ if (options & REFRESH_USER_RESOURCES)
+ reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */
+ *write_to_binlog= tmp_write_to_binlog;
+ /*
+ If the query was killed then this function must fail.
+ */
+ return result || (thd ? thd->killed : 0);
+}
+
+
+/**
+ Implementation of FLUSH TABLES <table_list> WITH READ LOCK.
+
+ In brief: take exclusive locks, expel tables from the table
+ cache, reopen the tables, enter the 'LOCKED TABLES' mode,
+ downgrade the locks.
+ Note: the function is written to be called from
+ mysql_execute_command(), it is not reusable in arbitrary
+ execution context.
+
+ Required privileges
+ -------------------
+ Since the statement implicitly enters LOCK TABLES mode,
+ it requires LOCK TABLES privilege on every table.
+ But since the rest of FLUSH commands require
+ the global RELOAD_ACL, it also requires RELOAD_ACL.
+
+ Compatibility with the global read lock
+ ---------------------------------------
+ We don't wait for the GRL, since neither the
+ 5.1 combination that this new statement is intended to
+ replace (LOCK TABLE <list> WRITE; FLUSH TABLES;),
+ nor FLUSH TABLES WITH READ LOCK do.
+ @todo: this is not implemented, Dmitry disagrees.
+ Currently we wait for GRL in another connection,
+ but are compatible with a GRL in our own connection.
+
+ Behaviour under LOCK TABLES
+ ---------------------------
+ Bail out: i.e. don't perform an implicit UNLOCK TABLES.
+ This is not consistent with LOCK TABLES statement, but is
+ in line with behaviour of FLUSH TABLES WITH READ LOCK, and we
+ try to not introduce any new statements with implicit
+ semantics.
+
+ Compatibility with parallel updates
+ -----------------------------------
+ As a result, we will wait for all open transactions
+ against the tables to complete. After the lock downgrade,
+ new transactions will be able to read the tables, but not
+ write to them.
+
+ Differences from FLUSH TABLES <list>
+ -------------------------------------
+ - you can't flush WITH READ LOCK a non-existent table
+ - you can't flush WITH READ LOCK under LOCK TABLES
+ - currently incompatible with the GRL (@todo: fix)
+
+ Effect on views and temporary tables.
+ ------------------------------------
+ You can only apply this command to existing base tables.
+ If a view with such name exists, ER_WRONG_OBJECT is returned.
+ If a temporary table with such name exists, it's ignored:
+ if there is a base table, it's used, otherwise ER_NO_SUCH_TABLE
+ is returned.
+
+ Implicit commit
+ ---------------
+ This statement causes an implicit commit before and
+ after it.
+
+ HANDLER SQL
+ -----------
+ If this connection has HANDLERs open against
+ some of the tables being FLUSHed, these handlers
+ are implicitly flushed (lose their position).
+*/
+
+bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
+{
+ Lock_tables_prelocking_strategy lock_tables_prelocking_strategy;
+ TABLE_LIST *table_list;
+ MDL_request_list mdl_requests;
+
+ /*
+ This is called from SQLCOM_FLUSH, the transaction has
+ been committed implicitly.
+ */
+
+ if (thd->locked_tables_mode)
+ {
+ my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
+ goto error;
+ }
+
+ /*
+ Acquire SNW locks on tables to be flushed. We can't use
+ lock_table_names() here as this call will also acquire global IX
+ and database-scope IX locks on the tables, and this will make
+ this statement incompatible with FLUSH TABLES WITH READ LOCK.
+ */
+ for (table_list= all_tables; table_list;
+ table_list= table_list->next_global)
+ mdl_requests.push_front(&table_list->mdl_request);
+
+ if (thd->mdl_context.acquire_locks(&mdl_requests,
+ thd->variables.lock_wait_timeout))
+ goto error;
+
+ DEBUG_SYNC(thd,"flush_tables_with_read_lock_after_acquire_locks");
+
+ for (table_list= all_tables; table_list;
+ table_list= table_list->next_global)
+ {
+ /* Request removal of table from cache. */
+ tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+ table_list->db,
+ table_list->table_name, FALSE);
+
+ /* Skip views and temporary tables. */
+ table_list->required_type= FRMTYPE_TABLE; /* Don't try to flush views. */
+ table_list->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */
+ }
+
+ /*
+ Before opening and locking tables the below call also waits
+ for old shares to go away, so the fact that we don't pass
+ MYSQL_LOCK_IGNORE_FLUSH flag to it is important.
+ */
+ if (open_and_lock_tables(thd, all_tables, FALSE,
+ MYSQL_OPEN_HAS_MDL_LOCK,
+ &lock_tables_prelocking_strategy) ||
+ thd->locked_tables_list.init_locked_tables(thd))
+ {
+ goto error;
+ }
+ thd->variables.option_bits|= OPTION_TABLE_LOCK;
+
+ /*
+ We don't downgrade MDL_SHARED_NO_WRITE here as the intended
+ post effect of this call is identical to LOCK TABLES <...> READ,
+ and we didn't use thd->in_lock_talbes and
+ thd->sql_command= SQLCOM_LOCK_TABLES hacks to enter the LTM.
+ */
+
+ return FALSE;
+
+error:
+ return TRUE;
+}
+
+
+
diff --git a/sql/sql_reload.h b/sql/sql_reload.h
new file mode 100644
index 00000000000..0df5485c907
--- /dev/null
+++ b/sql/sql_reload.h
@@ -0,0 +1,26 @@
+#ifndef SQL_RELOAD_INCLUDED
+#define SQL_RELOAD_INCLUDED
+/* Copyright (c) 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+class THD;
+struct TABLE_LIST;
+
+bool reload_acl_and_cache(THD *thd, unsigned long options,
+ TABLE_LIST *tables, bool *write_to_binlog);
+
+bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables);
+
+#endif
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 301b22bd70e..97f8e46d052 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -147,13 +147,15 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
MYSQL_OPEN_SKIP_TEMPORARY))
goto err;
- mysql_mutex_lock(&LOCK_open);
-
for (ren_table= table_list; ren_table; ren_table= ren_table->next_local)
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, ren_table->db,
- ren_table->table_name);
+ ren_table->table_name, FALSE);
error=0;
+ /*
+ An exclusive lock on table names is satisfactory to ensure
+ no other thread accesses this table.
+ */
if ((ren_table=rename_tables(thd,table_list,0)))
{
/* Rename didn't succeed; rename back the tables in reverse order */
@@ -175,17 +177,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
error= 1;
}
- /*
- An exclusive lock on table names is satisfactory to ensure
- no other thread accesses this table.
- However, NDB assumes that handler::rename_tables is called under
- LOCK_open. And it indeed is, from ALTER TABLE.
- TODO: remove this limitation.
- We still should unlock LOCK_open as early as possible, to provide
- higher concurrency - query_cache_invalidate can take minutes to
- complete.
- */
- mysql_mutex_unlock(&LOCK_open);
if (!silent && !error)
{
@@ -197,8 +188,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
if (!error)
query_cache_invalidate3(thd, table_list, 0);
- thd->mdl_context.release_transactional_locks();
-
err:
thd->global_read_lock.start_waiting_global_read_lock(thd);
DBUG_RETURN(error || binlog_error);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ccfd93a1bc8..29a78cb31dc 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -6914,6 +6914,8 @@ bool error_if_full_join(JOIN *join)
{
if (tab->type == JT_ALL && (!tab->select || !tab->select->quick))
{
+ /* This error should not be ignored. */
+ join->select_lex->no_error= FALSE;
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
return(1);
@@ -12721,7 +12723,9 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (!end_of_records)
{
copy_fields(&join->tmp_table_param);
- copy_funcs(join->tmp_table_param.items_to_copy);
+ if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd))
+ DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
+
if (!join->having || join->having->val_int())
{
int error;
@@ -12811,7 +12815,8 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
memcpy(table->record[0]+key_part->offset, group->buff, 1);
}
init_tmptable_sum_functions(join->sum_funcs);
- copy_funcs(join->tmp_table_param.items_to_copy);
+ if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd))
+ DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
if ((error=table->file->ha_write_row(table->record[0])))
{
if (create_myisam_from_heap(join->thd, table, &join->tmp_table_param,
@@ -12846,7 +12851,8 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
init_tmptable_sum_functions(join->sum_funcs);
copy_fields(&join->tmp_table_param); // Groups are copied twice.
- copy_funcs(join->tmp_table_param.items_to_copy);
+ if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd))
+ DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
if (!(error=table->file->ha_write_row(table->record[0])))
join->send_records++; // New group
@@ -12933,7 +12939,8 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (idx < (int) join->send_group_parts)
{
copy_fields(&join->tmp_table_param);
- copy_funcs(join->tmp_table_param.items_to_copy);
+ if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd))
+ DBUG_RETURN(NESTED_LOOP_ERROR);
if (init_sum_functions(join->sum_funcs, join->sum_funcs_end[idx+1]))
DBUG_RETURN(NESTED_LOOP_ERROR);
if (join->procedure)
@@ -13236,6 +13243,34 @@ ok:
}
+/**
+ Find shortest key suitable for full table scan.
+
+ @param table Table to scan
+ @param usable_keys Allowed keys
+
+ @note
+ As far as
+ 1) clustered primary key entry data set is a set of all record
+ fields (key fields and not key fields) and
+ 2) secondary index entry data is a union of its key fields and
+ primary key fields (at least InnoDB and its derivatives don't
+ duplicate primary key fields there, even if the primary and
+ the secondary keys have a common subset of key fields),
+ then secondary index entry data is always a subset of primary key entry.
+ Unfortunately, key_info[nr].key_length doesn't show the length
+ of key/pointer pair but a sum of key field lengths only, thus
+ we can't estimate index IO volume comparing only this key_length
+ value of secondary keys and clustered PK.
+ So, try secondary keys first, and choose PK only if there are no
+ usable secondary covering keys or found best secondary key include
+ all table fields (i.e. same as PK):
+
+ @return
+ MAX_KEY no suitable key found
+ key index otherwise
+*/
+
uint find_shortest_key(TABLE *table, const key_map *usable_keys)
{
uint best= MAX_KEY;
@@ -13248,23 +13283,6 @@ uint find_shortest_key(TABLE *table, const key_map *usable_keys)
uint min_length= (uint) ~0;
for (uint nr=0; nr < table->s->keys ; nr++)
{
- /*
- As far as
- 1) clustered primary key entry data set is a set of all record
- fields (key fields and not key fields) and
- 2) secondary index entry data is a union of its key fields and
- primary key fields (at least InnoDB and its derivatives don't
- duplicate primary key fields there, even if the primary and
- the secondary keys have a common subset of key fields),
- then secondary index entry data is always a subset of primary key
- entry, and the PK is always longer.
- Unfortunately, key_info[nr].key_length doesn't show the length
- of key/pointer pair but a sum of key field lengths only, thus
- we can't estimate index IO volume comparing only this key_length
- value of seconday keys and clustered PK.
- So, try secondary keys first, and choose PK only if there are no
- usable secondary covering keys:
- */
if (nr == usable_clustered_pk)
continue;
if (usable_keys->is_set(nr))
@@ -13277,7 +13295,20 @@ uint find_shortest_key(TABLE *table, const key_map *usable_keys)
}
}
}
- return best != MAX_KEY ? best : usable_clustered_pk;
+ if (usable_clustered_pk != MAX_KEY)
+ {
+ /*
+ If the primary key is clustered and found shorter key covers all table
+ fields then primary key scan normally would be faster because amount of
+ data to scan is the same but PK is clustered.
+ It's safe to compare key parts with table fields since duplicate key
+ parts aren't allowed.
+ */
+ if (best == MAX_KEY ||
+ table->key_info[best].key_parts >= table->s->fields)
+ best= usable_clustered_pk;
+ }
+ return best;
}
/**
@@ -15805,14 +15836,39 @@ update_sum_func(Item_sum **func_ptr)
return 0;
}
-/** Copy result of functions to record in tmp_table. */
+/**
+ Copy result of functions to record in tmp_table.
-void
-copy_funcs(Item **func_ptr)
+ Uses the thread pointer to check for errors in
+ some of the val_xxx() methods called by the
+ save_in_result_field() function.
+ TODO: make the Item::val_xxx() return error code
+
+ @param func_ptr array of the function Items to copy to the tmp table
+ @param thd pointer to the current thread for error checking
+ @retval
+ FALSE if OK
+ @retval
+ TRUE on error
+*/
+
+bool
+copy_funcs(Item **func_ptr, const THD *thd)
{
Item *func;
for (; (func = *func_ptr) ; func_ptr++)
+ {
func->save_in_result_field(1);
+ /*
+ Need to check the THD error state because Item::val_xxx() don't
+ return error code, but can generate errors
+ TODO: change it for a real status check when Item::val_xxx()
+ are extended to return status code.
+ */
+ if (thd->is_error())
+ return TRUE;
+ }
+ return FALSE;
}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 40f9e6d4054..77fff4ee24c 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -606,7 +606,7 @@ bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
List<Item> &new_list1, List<Item> &new_list2,
uint elements, List<Item> &fields);
void copy_fields(TMP_TABLE_PARAM *param);
-void copy_funcs(Item **func_ptr);
+bool copy_funcs(Item **func_ptr, const THD *thd);
bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
int error, bool ignore_last_dupp_error);
uint find_shortest_key(TABLE *table, const key_map *usable_keys);
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index cfbf8e96719..bc845ed2cdd 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -628,7 +628,7 @@ int drop_server(THD *thd, LEX_SERVER_OPTIONS *server_options)
/* close the servers table before we call closed_cached_connection_tables */
close_mysql_tables(thd);
- if (close_cached_connection_tables(thd, TRUE, &name))
+ if (close_cached_connection_tables(thd, &name))
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_UNKNOWN_ERROR, "Server connection in use");
@@ -1057,7 +1057,7 @@ int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options)
/* close the servers table before we call closed_cached_connection_tables */
close_mysql_tables(thd);
- if (close_cached_connection_tables(thd, FALSE, &name))
+ if (close_cached_connection_tables(thd, &name))
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_UNKNOWN_ERROR, "Server connection in use");
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 4d58db2e36c..6b24e3db7bc 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1815,6 +1815,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if ((thd_info->db=tmp->db)) // Safe test
thd_info->db=thd->strdup(thd_info->db);
thd_info->command=(int) tmp->command;
+ mysql_mutex_lock(&tmp->LOCK_thd_data);
if ((mysys_var= tmp->mysys_var))
mysql_mutex_lock(&mysys_var->mutex);
thd_info->proc_info= (char*) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0);
@@ -1822,16 +1823,15 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if (mysys_var)
mysql_mutex_unlock(&mysys_var->mutex);
- thd_info->start_time= tmp->start_time;
thd_info->query=0;
/* Lock THD mutex that protects its data when looking at it. */
- mysql_mutex_lock(&tmp->LOCK_thd_data);
if (tmp->query())
{
uint length= min(max_query_length, tmp->query_length());
thd_info->query= (char*) thd->strmake(tmp->query(),length);
}
mysql_mutex_unlock(&tmp->LOCK_thd_data);
+ thd_info->start_time= tmp->start_time;
thread_infos.append(thd_info);
}
}
@@ -1918,6 +1918,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[3]->set_notnull();
}
+ mysql_mutex_lock(&tmp->LOCK_thd_data);
if ((mysys_var= tmp->mysys_var))
mysql_mutex_lock(&mysys_var->mutex);
/* COMMAND */
@@ -1938,6 +1939,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
if (mysys_var)
mysql_mutex_unlock(&mysys_var->mutex);
+ mysql_mutex_unlock(&tmp->LOCK_thd_data);
/* INFO */
/* Lock THD mutex that protects its data when looking at it. */
@@ -3273,8 +3275,8 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
/*
TODO: investigate if in this particular situation we can get by
- simply obtaining internal lock of data-dictionary (ATM it
- is LOCK_open) instead of obtaning full-blown metadata lock.
+ simply obtaining internal lock of the data-dictionary
+ instead of obtaining full-blown metadata lock.
*/
if (try_acquire_high_prio_shared_mdl_lock(thd, &table_list, can_deadlock))
{
@@ -7490,13 +7492,16 @@ int finalize_schema_table(st_plugin_int *plugin)
ST_SCHEMA_TABLE *schema_table= (ST_SCHEMA_TABLE *)plugin->data;
DBUG_ENTER("finalize_schema_table");
- if (schema_table && plugin->plugin->deinit)
+ if (schema_table)
{
- DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
- if (plugin->plugin->deinit(NULL))
+ if (plugin->plugin->deinit)
{
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
+ DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
+ if (plugin->plugin->deinit(NULL))
+ {
+ DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
+ plugin->name.str));
+ }
}
my_free(schema_table);
}
@@ -7657,7 +7662,7 @@ static bool show_create_trigger_impl(THD *thd,
*/
static
-TABLE_LIST *get_trigger_table_impl(THD *thd, const sp_name *trg_name)
+TABLE_LIST *get_trigger_table(THD *thd, const sp_name *trg_name)
{
char trn_path_buff[FN_REFLEN];
LEX_STRING trn_path= { trn_path_buff, 0 };
@@ -7694,39 +7699,6 @@ TABLE_LIST *get_trigger_table_impl(THD *thd, const sp_name *trg_name)
return table;
}
-/**
- Read TRN and TRG files to obtain base table name for the specified
- trigger name and construct TABE_LIST object for the base table. Acquire
- LOCK_open when doing this.
-
- @param thd Thread context.
- @param trg_name Trigger name.
-
- @return TABLE_LIST object corresponding to the base table.
-*/
-
-static
-TABLE_LIST *get_trigger_table(THD *thd, const sp_name *trg_name)
-{
- /* Acquire LOCK_open (stop the server). */
-
- mysql_mutex_lock(&LOCK_open);
-
- /*
- Load base table name from the TRN-file and create TABLE_LIST object.
- */
-
- TABLE_LIST *lst= get_trigger_table_impl(thd, trg_name);
-
- /* Release LOCK_open (continue the server). */
-
- mysql_mutex_unlock(&LOCK_open);
-
- /* That's it. */
-
- return lst;
-}
-
/**
SHOW CREATE TRIGGER high-level implementation.
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 762eebba031..4b7dab243d2 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -31,9 +31,12 @@
** String functions
*****************************************************************************/
-bool String::real_alloc(uint32 arg_length)
+bool String::real_alloc(uint32 length)
{
- arg_length=ALIGN_SIZE(arg_length+1);
+ uint32 arg_length= ALIGN_SIZE(length + 1);
+ DBUG_ASSERT(arg_length > length);
+ if (arg_length <= length)
+ return TRUE; /* Overflow */
str_length=0;
if (Alloced_length < arg_length)
{
@@ -56,6 +59,9 @@ bool String::real_alloc(uint32 arg_length)
bool String::realloc(uint32 alloc_length)
{
uint32 len=ALIGN_SIZE(alloc_length+1);
+ DBUG_ASSERT(len > alloc_length);
+ if (len <= alloc_length)
+ return TRUE; /* Overflow */
if (Alloced_length < len)
{
char *new_ptr;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 02a874ce62f..3f0a0326c84 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -51,7 +51,6 @@
#include "sql_parse.h"
#include "sql_show.h"
#include "transaction.h"
-#include "keycaches.h"
#include "datadict.h" // dd_frm_type()
#ifdef __WIN__
@@ -78,10 +77,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
uint *db_options,
handler *file, KEY **key_info_buffer,
uint *key_count, int select_field_count);
-static bool
-mysql_prepare_alter_table(THD *thd, TABLE *table,
- HA_CREATE_INFO *create_info,
- Alter_info *alter_info);
/**
@@ -1086,6 +1081,7 @@ static bool get_free_ddl_log_entry(DDL_LOG_MEMORY_ENTRY **active_entry,
*/
used_entry->next_log_entry= first_used;
used_entry->prev_log_entry= NULL;
+ used_entry->next_active_log_entry= NULL;
global_ddl_log.first_used= used_entry;
if (first_used)
first_used->prev_log_entry= used_entry;
@@ -1723,7 +1719,6 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
completing this we write a new phase to the log entry that will
deactivate it.
*/
- mysql_mutex_lock(&LOCK_open);
if (mysql_file_delete(key_file_frm, frm_name, MYF(MY_WME)) ||
#ifdef WITH_PARTITION_STORAGE_ENGINE
lpt->table->file->ha_create_handler_files(path, shadow_path,
@@ -1779,12 +1774,12 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
#endif
err:
- mysql_mutex_unlock(&LOCK_open);
#ifdef WITH_PARTITION_STORAGE_ENGINE
deactivate_ddl_log_entry(part_info->frm_log_entry->entry_pos);
part_info->frm_log_entry= NULL;
(void) sync_ddl_log();
#endif
+ ;
}
end:
@@ -1799,6 +1794,8 @@ end:
clear_error is clear_error to be called
query Query to log
query_length Length of query
+ is_trans if the event changes either
+ a trans or non-trans engine.
RETURN VALUES
NONE
@@ -1921,18 +1918,64 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
String wrong_tables;
int error= 0;
int non_temp_tables_count= 0;
- bool some_tables_deleted=0, tmp_table_deleted=0, foreign_key_error=0;
+ bool foreign_key_error=0;
+ bool non_tmp_error= 0;
+ bool trans_tmp_table_deleted= 0, non_trans_tmp_table_deleted= 0;
+ bool non_tmp_table_deleted= 0;
String built_query;
- String built_tmp_query;
+ String built_trans_tmp_query, built_non_trans_tmp_query;
DBUG_ENTER("mysql_rm_table_part2");
- if (thd->is_current_stmt_binlog_format_row() && !dont_log_query)
+ /*
+ Prepares the drop statements that will be written into the binary
+ log as follows:
+
+ 1 - If we are not processing a "DROP TEMPORARY" it prepares a
+ "DROP".
+
+ 2 - A "DROP" may result in a "DROP TEMPORARY" but the opposite is
+ not true.
+
+ 3 - If the current format is row, the IF EXISTS token needs to be
+ appended because one does not know if CREATE TEMPORARY was previously
+ written to the binary log.
+
+ 4 - Add the IF_EXISTS token if necessary, i.e. if_exists is TRUE.
+
+ 5 - For temporary tables, there is a need to differentiate tables
+ in transactional and non-transactional storage engines. For that,
+ reason, two types of drop statements are prepared.
+
+ The need to different the type of tables when dropping a temporary
+ table stems from the fact that such drop does not commit an ongoing
+ transaction and changes to non-transactional tables must be written
+ ahead of the transaction in some circumstances.
+ */
+ if (!dont_log_query)
{
- built_query.set_charset(system_charset_info);
- if (if_exists)
- built_query.append("DROP TABLE IF EXISTS ");
+ if (!drop_temporary)
+ {
+ built_query.set_charset(system_charset_info);
+ if (if_exists)
+ built_query.append("DROP TABLE IF EXISTS ");
+ else
+ built_query.append("DROP TABLE ");
+ }
+
+ if (thd->is_current_stmt_binlog_format_row() || if_exists)
+ {
+ built_trans_tmp_query.set_charset(system_charset_info);
+ built_trans_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS ");
+ built_non_trans_tmp_query.set_charset(system_charset_info);
+ built_non_trans_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS ");
+ }
else
- built_query.append("DROP TABLE ");
+ {
+ built_trans_tmp_query.set_charset(system_charset_info);
+ built_trans_tmp_query.append("DROP TEMPORARY TABLE ");
+ built_non_trans_tmp_query.set_charset(system_charset_info);
+ built_non_trans_tmp_query.append("DROP TEMPORARY TABLE ");
+ }
}
mysql_ha_rm_tables(thd, tables);
@@ -1955,10 +1998,11 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (lock_table_names(thd, tables, NULL, thd->variables.lock_wait_timeout,
MYSQL_OPEN_SKIP_TEMPORARY))
DBUG_RETURN(1);
- mysql_mutex_lock(&LOCK_open);
for (table= tables; table; table= table->next_local)
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db, table->table_name);
- mysql_mutex_unlock(&LOCK_open);
+ {
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db, table->table_name,
+ FALSE);
+ }
}
else
{
@@ -2001,6 +2045,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table= tables; table; table= table->next_local)
{
+ bool is_trans;
char *db=table->db;
handlerton *table_type;
enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN;
@@ -2009,78 +2054,70 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
table->db, table->table_name, (long) table->table,
table->table ? (long) table->table->s : (long) -1));
+ /*
+ drop_temporary_table may return one of the following error codes:
+ . 0 - a temporary table was successfully dropped.
+ . 1 - a temporary table was not found.
+ . -1 - a temporary table is used by an outer statement.
+ */
if (table->open_type == OT_BASE_ONLY)
error= 1;
- else
- error= drop_temporary_table(thd, table);
-
- switch (error) {
- case 0:
- // removed temporary table
- tmp_table_deleted= 1;
+ else if ((error= drop_temporary_table(thd, table, &is_trans)) == -1)
+ {
+ DBUG_ASSERT(thd->in_sub_stmt);
+ goto err;
+ }
+
+ if ((drop_temporary && if_exists) || !error)
+ {
/*
- One needs to always log any temporary table drop if the current
- statement logging format is set to row. This happens because one
- might have created a temporary table while the statement logging
- format was statement and then switched to mixed or row format.
+ This handles the case of temporary tables. We have the following cases:
+
+ . "DROP TEMPORARY" was executed and a temporary table was affected
+ (i.e. drop_temporary && !error) or the if_exists was specified (i.e.
+ drop_temporary && if_exists).
+
+ . "DROP" was executed but a temporary table was affected (.i.e
+ !error).
*/
- if (thd->is_current_stmt_binlog_format_row())
+ if (!dont_log_query)
{
- if (built_tmp_query.is_empty())
- {
- built_tmp_query.set_charset(system_charset_info);
- built_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS ");
- }
+ /*
+ If there is an error, we don't know the type of the engine
+ at this point. So, we keep it in the trx-cache.
+ */
+ is_trans= error ? TRUE : is_trans;
+ if (is_trans)
+ trans_tmp_table_deleted= TRUE;
+ else
+ non_trans_tmp_table_deleted= TRUE;
- built_tmp_query.append("`");
+ String *built_ptr_query=
+ (is_trans ? &built_trans_tmp_query : &built_non_trans_tmp_query);
+ /*
+ Don't write the database name if it is the current one (or if
+ thd->db is NULL).
+ */
+ built_ptr_query->append("`");
if (thd->db == NULL || strcmp(db,thd->db) != 0)
{
- built_tmp_query.append(db);
- built_tmp_query.append("`.`");
+ built_ptr_query->append(db);
+ built_ptr_query->append("`.`");
}
- built_tmp_query.append(table->table_name);
- built_tmp_query.append("`,");
+ built_ptr_query->append(table->table_name);
+ built_ptr_query->append("`,");
}
-
- continue;
- case -1:
- DBUG_ASSERT(thd->in_sub_stmt);
- error= 1;
- goto err;
- default:
- // temporary table not found
- error= 0;
- }
-
- /* Probably a non-temporary table. */
- if (!drop_temporary)
- non_temp_tables_count++;
-
- /*
- If row-based replication is used and the table is not a
- temporary table, we add the table name to the drop statement
- being built. The string always end in a comma and the comma
- will be chopped off before being written to the binary log.
- */
- if (!drop_temporary && thd->is_current_stmt_binlog_format_row() && !dont_log_query)
- {
/*
- Don't write the database name if it is the current one (or if
- thd->db is NULL).
+ This means that a temporary table was droped and as such there
+ is no need to proceed with the code that tries to drop a regular
+ table.
*/
- built_query.append("`");
- if (thd->db == NULL || strcmp(db,thd->db) != 0)
- {
- built_query.append(db);
- built_query.append("`.`");
- }
-
- built_query.append(table->table_name);
- built_query.append("`,");
+ if (!error) continue;
}
-
- if (!drop_temporary)
+ else if (!drop_temporary)
{
+ non_temp_tables_count++;
+
if (thd->locked_tables_mode)
{
if (wait_while_table_is_used(thd, table->table, HA_EXTRA_FORCE_REOPEN))
@@ -2103,36 +2140,70 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
reg_ext,
table->internal_tmp_table ?
FN_IS_TMP : 0);
+
+ /*
+ This handles the case where a "DROP" was executed and a regular
+ table "may be" dropped as drop_temporary is FALSE and error is
+ TRUE. If the error was FALSE a temporary table was dropped and
+ regardless of the status of drop_tempoary a "DROP TEMPORARY"
+ must be used.
+ */
+ if (!dont_log_query)
+ {
+ /*
+ Note that unless if_exists is TRUE or a temporary table was deleted,
+ there is no means to know if the statement should be written to the
+ binary log. See further information on this variable in what follows.
+ */
+ non_tmp_table_deleted= (if_exists ? TRUE : non_tmp_table_deleted);
+ /*
+ Don't write the database name if it is the current one (or if
+ thd->db is NULL).
+ */
+ built_query.append("`");
+ if (thd->db == NULL || strcmp(db,thd->db) != 0)
+ {
+ built_query.append(db);
+ built_query.append("`.`");
+ }
+
+ built_query.append(table->table_name);
+ built_query.append("`,");
+ }
}
- /*
- TODO: Investigate what should be done to remove this lock completely.
- Is exclusive meta-data lock enough ?
- */
DEBUG_SYNC(thd, "rm_table_part2_before_delete_table");
DBUG_EXECUTE_IF("sleep_before_part2_delete_table",
my_sleep(100000););
- mysql_mutex_lock(&LOCK_open);
+ error= 0;
if (drop_temporary ||
((access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias)) ||
(!drop_view &&
dd_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
{
- // Table was not found on disk and table can't be created from engine
+ /*
+ One of the following cases happened:
+ . "DROP TEMPORARY" but a temporary table was not found.
+ . "DROP" but table was not found on disk and table can't be
+ created from engine.
+ . ./sql/datadict.cc +32 /Alfranio - TODO: We need to test this.
+ */
if (if_exists)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
table->table_name);
else
+ {
+ non_tmp_error = (drop_temporary ? non_tmp_error : TRUE);
error= 1;
+ }
}
else
{
char *end;
/*
Cannot use the db_type from the table, since that might have changed
- while waiting for the exclusive name lock. We are under LOCK_open,
- so reading from the frm-file is safe.
+ while waiting for the exclusive name lock.
*/
if (frm_db_type == DB_TYPE_UNKNOWN)
{
@@ -2157,7 +2228,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (error == HA_ERR_ROW_IS_REFERENCED)
{
/* the table is referenced by a foreign key constraint */
- foreign_key_error=1;
+ foreign_key_error= 1;
}
if (!error || error == ENOENT || error == HA_ERR_NO_SUCH_TABLE)
{
@@ -2166,14 +2237,14 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
strmov(end,reg_ext);
if (!(new_error= mysql_file_delete(key_file_frm, path, MYF(MY_WME))))
{
- some_tables_deleted=1;
+ non_tmp_table_deleted= TRUE;
new_error= Table_triggers_list::drop_all_triggers(thd, db,
table->table_name);
}
error|= new_error;
}
+ non_tmp_error= error ? TRUE : non_tmp_error;
}
- mysql_mutex_unlock(&LOCK_open);
if (error)
{
if (wrong_tables.length())
@@ -2187,11 +2258,12 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
my_printf_error(ER_BAD_TABLE_ERROR,
ER(ER_BAD_TABLE_ERROR), MYF(0),
table->table_name););
-
}
DEBUG_SYNC(thd, "rm_table_part2_before_binlog");
- thd->thread_specific_used|= tmp_table_deleted;
+ thd->thread_specific_used|= (trans_tmp_table_deleted ||
+ non_trans_tmp_table_deleted);
error= 0;
+err:
if (wrong_tables.length())
{
if (!foreign_key_error)
@@ -2202,85 +2274,48 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
error= 1;
}
- if (some_tables_deleted || tmp_table_deleted || !error)
+ if (non_trans_tmp_table_deleted ||
+ trans_tmp_table_deleted || non_tmp_table_deleted)
{
query_cache_invalidate3(thd, tables, 0);
if (!dont_log_query && mysql_bin_log.is_open())
{
- if (!thd->is_current_stmt_binlog_format_row() ||
- (non_temp_tables_count > 0 && !tmp_table_deleted))
+ if (non_trans_tmp_table_deleted)
{
- /*
- In this case, we are either using statement-based
- replication or using row-based replication but have only
- deleted one or more non-temporary tables (and no temporary
- tables). In this case, we can write the original query into
- the binary log.
- */
- error |= write_bin_log(thd, !error, thd->query(), thd->query_length());
+ /* Chop of the last comma */
+ built_non_trans_tmp_query.chop();
+ built_non_trans_tmp_query.append(" /* generated by server */");
+ error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
+ built_non_trans_tmp_query.ptr(),
+ built_non_trans_tmp_query.length(),
+ FALSE, FALSE, FALSE, 0);
}
- else if (thd->is_current_stmt_binlog_format_row() &&
- tmp_table_deleted)
+ if (trans_tmp_table_deleted)
{
- if (non_temp_tables_count > 0)
- {
- /*
- In this case we have deleted both temporary and
- non-temporary tables, so:
- - since we have deleted a non-temporary table we have to
- binlog the statement, but
- - since we have deleted a temporary table we cannot binlog
- the statement (since the table may have not been created on the
- slave - check "if" branch below, this might cause the slave to
- stop).
-
- Instead, we write a built statement, only containing the
- non-temporary tables, to the binary log
- */
- built_query.chop(); // Chop of the last comma
+ /* Chop of the last comma */
+ built_trans_tmp_query.chop();
+ built_trans_tmp_query.append(" /* generated by server */");
+ error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
+ built_trans_tmp_query.ptr(),
+ built_trans_tmp_query.length(),
+ TRUE, FALSE, FALSE, 0);
+ }
+ if (non_tmp_table_deleted)
+ {
+ /* Chop of the last comma */
+ built_query.chop();
built_query.append(" /* generated by server */");
- error|= write_bin_log(thd, !error, built_query.ptr(), built_query.length());
- }
-
- /*
- One needs to always log any temporary table drop if the current
- statement logging format is set to row. This happens because one
- might have created a temporary table while the statement logging
- format was statement and then switched to mixed or row format.
- */
- if (thd->is_current_stmt_binlog_format_row())
- {
- /*
- In this case we have deleted some temporary tables but we are using
- row based logging for the statement. However, thread uses mixed mode
- format, thence we need to log the dropping as we cannot tell for
- sure whether the create was logged as statement previously or not, ie,
- before switching to row mode.
- */
- built_tmp_query.chop(); // Chop of the last comma
- built_tmp_query.append(" /* generated by server */");
- /*
- We cannot call the write_bin_log as we do not care about any errors
- in the master as the statement is always DROP TEMPORARY TABLE IF EXISTS
- and as such there will be no errors in the slave.
- */
- error|= thd->binlog_query(THD::STMT_QUERY_TYPE, built_tmp_query.ptr(),
- built_tmp_query.length(), FALSE, FALSE, FALSE,
- 0);
- }
+ int error_code = (non_tmp_error ?
+ (foreign_key_error ? ER_ROW_IS_REFERENCED : ER_BAD_TABLE_ERROR) : 0);
+ error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
+ built_query.ptr(),
+ built_query.length(),
+ TRUE, FALSE, FALSE,
+ error_code);
}
-
- /*
- The remaining cases are:
- - no tables were deleted and
- - only temporary tables were deleted and row-based
- replication is used.
- In both these cases, nothing should be written to the binary
- log.
- */
}
}
-err:
+
if (!drop_temporary)
{
/*
@@ -3795,6 +3830,8 @@ void sp_prepare_create_field(THD *thd, Create_field *sql_field)
internal_tmp_table Set to 1 if this is an internal temporary table
(From ALTER TABLE)
select_field_count
+ is_trans identifies the type of engine where the table
+ was created: either trans or non-trans.
DESCRIPTION
If one creates a temporary table, this is automatically opened
@@ -3819,7 +3856,8 @@ bool mysql_create_table_no_lock(THD *thd,
HA_CREATE_INFO *create_info,
Alter_info *alter_info,
bool internal_tmp_table,
- uint select_field_count)
+ uint select_field_count,
+ bool *is_trans)
{
char path[FN_REFLEN + 1];
uint path_length;
@@ -4042,7 +4080,6 @@ bool mysql_create_table_no_lock(THD *thd,
{
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
- create_info->table_existed= 1; // Mark that table existed
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
alias);
@@ -4053,7 +4090,6 @@ bool mysql_create_table_no_lock(THD *thd,
goto err;
}
- mysql_mutex_lock(&LOCK_open);
if (!internal_tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (!access(path,F_OK))
@@ -4061,7 +4097,7 @@ bool mysql_create_table_no_lock(THD *thd,
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
goto warn;
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
- goto unlock_and_end;
+ goto err;
}
/*
We don't assert here, but check the result, because the table could be
@@ -4071,11 +4107,14 @@ bool mysql_create_table_no_lock(THD *thd,
Then she could create the table. This case is pretty obscure and
therefore we don't introduce a new error message only for it.
*/
+ mysql_mutex_lock(&LOCK_open);
if (get_cached_table_share(db, table_name))
{
+ mysql_mutex_unlock(&LOCK_open);
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
- goto unlock_and_end;
+ goto err;
}
+ mysql_mutex_unlock(&LOCK_open);
}
/*
@@ -4083,7 +4122,7 @@ bool mysql_create_table_no_lock(THD *thd,
exist in any storage engine. In such a case it should
be discovered and the error ER_TABLE_EXISTS_ERROR be returned
unless user specified CREATE TABLE IF EXISTS
- The LOCK_open mutex has been locked to make sure no
+ An exclusive metadata lock ensures that no
one else is attempting to discover the table. Since
it's not on disk as a frm file, no one could be using it!
*/
@@ -4104,17 +4143,16 @@ bool mysql_create_table_no_lock(THD *thd,
if (create_if_not_exists)
goto warn;
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
- goto unlock_and_end;
+ goto err;
break;
default:
DBUG_PRINT("info", ("error: %u from storage engine", retcode));
my_error(retcode, MYF(0),table_name);
- goto unlock_and_end;
+ goto err;
}
}
thd_proc_info(thd, "creating table");
- create_info->table_existed= 0; // Mark that table is created
#ifdef HAVE_READLINK
{
@@ -4142,7 +4180,7 @@ bool mysql_create_table_no_lock(THD *thd,
if (test_if_data_home_dir(dirpath))
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "DATA DIRECTORY");
- goto unlock_and_end;
+ goto err;
}
}
if (create_info->index_file_name)
@@ -4151,7 +4189,7 @@ bool mysql_create_table_no_lock(THD *thd,
if (test_if_data_home_dir(dirpath))
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "INDEX DIRECTORY");
- goto unlock_and_end;
+ goto err;
}
}
}
@@ -4159,7 +4197,7 @@ bool mysql_create_table_no_lock(THD *thd,
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (check_partition_dirs(thd->lex->part_info))
{
- goto unlock_and_end;
+ goto err;
}
#endif /* WITH_PARTITION_STORAGE_ENGINE */
@@ -4182,23 +4220,25 @@ bool mysql_create_table_no_lock(THD *thd,
if (rea_create_table(thd, path, db, table_name,
create_info, alter_info->create_list,
key_count, key_info_buffer, file))
- goto unlock_and_end;
+ goto err;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
+ TABLE *table= NULL;
/* Open table and put in temporary table list */
- if (!(open_temporary_table(thd, path, db, table_name, 1)))
+ if (!(table= open_temporary_table(thd, path, db, table_name, 1)))
{
(void) rm_temporary_table(create_info->db_type, path);
- goto unlock_and_end;
+ goto err;
}
+
+ if (is_trans != NULL)
+ *is_trans= table->file->has_transactions();
+
thd->thread_specific_used= TRUE;
}
error= FALSE;
-unlock_and_end:
- mysql_mutex_unlock(&LOCK_open);
-
err:
thd_proc_info(thd, "After create");
delete file;
@@ -4209,8 +4249,7 @@ warn:
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
alias);
- create_info->table_existed= 1; // Mark that table existed
- goto unlock_and_end;
+ goto err;
}
@@ -4229,6 +4268,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
Alter_info *alter_info)
{
bool result;
+ bool is_trans= FALSE;
DBUG_ENTER("mysql_create_table");
/*
@@ -4245,7 +4285,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
result= mysql_create_table_no_lock(thd, create_table->db,
create_table->table_name, create_info,
- alter_info, FALSE, 0);
+ alter_info, FALSE, 0, &is_trans);
/*
Don't write statement if:
@@ -4257,7 +4297,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
(!thd->is_current_stmt_binlog_format_row() ||
(thd->is_current_stmt_binlog_format_row() &&
!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
- result= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+ result= write_bin_log(thd, TRUE, thd->query(), thd->query_length(), is_trans);
end:
DBUG_RETURN(result);
@@ -4393,885 +4433,6 @@ mysql_rename_table(handlerton *base, const char *old_db,
}
-static int send_check_errmsg(THD *thd, TABLE_LIST* table,
- const char* operator_name, const char* errmsg)
-
-{
- Protocol *protocol= thd->protocol;
- protocol->prepare_for_resend();
- protocol->store(table->alias, system_charset_info);
- protocol->store((char*) operator_name, system_charset_info);
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- protocol->store(errmsg, system_charset_info);
- thd->clear_error();
- if (protocol->write())
- return -1;
- return 1;
-}
-
-
-static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
- HA_CHECK_OPT *check_opt)
-{
- int error= 0;
- TABLE tmp_table, *table;
- TABLE_SHARE *share;
- bool has_mdl_lock= FALSE;
- char from[FN_REFLEN],tmp[FN_REFLEN+32];
- const char **ext;
- MY_STAT stat_info;
- Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH |
- MYSQL_OPEN_HAS_MDL_LOCK |
- MYSQL_LOCK_IGNORE_TIMEOUT));
- DBUG_ENTER("prepare_for_repair");
-
- if (!(check_opt->sql_flags & TT_USEFRM))
- DBUG_RETURN(0);
-
- if (!(table= table_list->table))
- {
- char key[MAX_DBKEY_LENGTH];
- uint key_length;
- /*
- If the table didn't exist, we have a shared metadata lock
- on it that is left from mysql_admin_table()'s attempt to
- open it. Release the shared metadata lock before trying to
- acquire the exclusive lock to satisfy MDL asserts and avoid
- deadlocks.
- */
- thd->mdl_context.release_transactional_locks();
- /*
- Attempt to do full-blown table open in mysql_admin_table() has failed.
- Let us try to open at least a .FRM for this table.
- */
- my_hash_value_type hash_value;
-
- key_length= create_table_def_key(thd, key, table_list, 0);
- table_list->mdl_request.init(MDL_key::TABLE,
- table_list->db, table_list->table_name,
- MDL_EXCLUSIVE);
-
- if (lock_table_names(thd, table_list, table_list->next_global,
- thd->variables.lock_wait_timeout,
- MYSQL_OPEN_SKIP_TEMPORARY))
- DBUG_RETURN(0);
- has_mdl_lock= TRUE;
-
- hash_value= my_calc_hash(&table_def_cache, (uchar*) key, key_length);
- mysql_mutex_lock(&LOCK_open);
- if (!(share= (get_table_share(thd, table_list, key, key_length, 0,
- &error, hash_value))))
- {
- mysql_mutex_unlock(&LOCK_open);
- DBUG_RETURN(0); // Can't open frm file
- }
-
- if (open_table_from_share(thd, share, "", 0, 0, 0, &tmp_table, FALSE))
- {
- release_table_share(share);
- mysql_mutex_unlock(&LOCK_open);
- DBUG_RETURN(0); // Out of memory
- }
- mysql_mutex_unlock(&LOCK_open);
- table= &tmp_table;
- }
-
- /* A MERGE table must not come here. */
- DBUG_ASSERT(table->file->ht->db_type != DB_TYPE_MRG_MYISAM);
-
- /*
- REPAIR TABLE ... USE_FRM for temporary tables makes little sense.
- */
- if (table->s->tmp_table)
- {
- error= send_check_errmsg(thd, table_list, "repair",
- "Cannot repair temporary table from .frm file");
- goto end;
- }
-
- /*
- User gave us USE_FRM which means that the header in the index file is
- trashed.
- In this case we will try to fix the table the following way:
- - Rename the data file to a temporary name
- - Truncate the table
- - Replace the new data file with the old one
- - Run a normal repair using the new index file and the old data file
- */
-
- if (table->s->frm_version != FRM_VER_TRUE_VARCHAR)
- {
- error= send_check_errmsg(thd, table_list, "repair",
- "Failed repairing incompatible .frm file");
- goto end;
- }
-
- /*
- Check if this is a table type that stores index and data separately,
- like ISAM or MyISAM. We assume fixed order of engine file name
- extentions array. First element of engine file name extentions array
- is meta/index file extention. Second element - data file extention.
- */
- ext= table->file->bas_ext();
- if (!ext[0] || !ext[1])
- goto end; // No data file
-
- // Name of data file
- strxmov(from, table->s->normalized_path.str, ext[1], NullS);
- if (!mysql_file_stat(key_file_misc, from, &stat_info, MYF(0)))
- goto end; // Can't use USE_FRM flag
-
- my_snprintf(tmp, sizeof(tmp), "%s-%lx_%lx",
- from, current_pid, thd->thread_id);
-
- if (table_list->table)
- {
- /*
- Table was successfully open in mysql_admin_table(). Now we need
- to close it, but leave it protected by exclusive metadata lock.
- */
- if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
- goto end;
- close_all_tables_for_name(thd, table_list->table->s, FALSE);
- table_list->table= 0;
- }
- /*
- After this point we have an exclusive metadata lock on our table
- in both cases when table was successfully open in mysql_admin_table()
- and when it was open in prepare_for_repair().
- */
-
- if (my_rename(from, tmp, MYF(MY_WME)))
- {
- error= send_check_errmsg(thd, table_list, "repair",
- "Failed renaming data file");
- goto end;
- }
- if (dd_recreate_table(thd, table_list->db, table_list->table_name))
- {
- error= send_check_errmsg(thd, table_list, "repair",
- "Failed generating table from .frm file");
- goto end;
- }
- /*
- 'FALSE' for 'using_transactions' means don't postpone
- invalidation till the end of a transaction, but do it
- immediately.
- */
- query_cache_invalidate3(thd, table_list, FALSE);
- if (mysql_file_rename(key_file_misc, tmp, from, MYF(MY_WME)))
- {
- error= send_check_errmsg(thd, table_list, "repair",
- "Failed restoring .MYD file");
- goto end;
- }
-
- if (thd->locked_tables_list.reopen_tables(thd))
- goto end;
-
- /*
- Now we should be able to open the partially repaired table
- to finish the repair in the handler later on.
- */
- if (open_table(thd, table_list, thd->mem_root, &ot_ctx))
- {
- error= send_check_errmsg(thd, table_list, "repair",
- "Failed to open partially repaired table");
- goto end;
- }
-
-end:
- thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
- if (table == &tmp_table)
- {
- mysql_mutex_lock(&LOCK_open);
- closefrm(table, 1); // Free allocated memory
- mysql_mutex_unlock(&LOCK_open);
- }
- /* In case of a temporary table there will be no metadata lock. */
- if (error && has_mdl_lock)
- thd->mdl_context.release_transactional_locks();
-
- DBUG_RETURN(error);
-}
-
-
-
-/*
- RETURN VALUES
- FALSE Message sent to net (admin operation went ok)
- TRUE Message should be sent by caller
- (admin operation or network communication failed)
-*/
-static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
- HA_CHECK_OPT* check_opt,
- const char *operator_name,
- thr_lock_type lock_type,
- bool open_for_modify,
- bool no_warnings_for_error,
- uint extra_open_options,
- int (*prepare_func)(THD *, TABLE_LIST *,
- HA_CHECK_OPT *),
- int (handler::*operator_func)(THD *,
- HA_CHECK_OPT *),
- int (view_operator_func)(THD *, TABLE_LIST*))
-{
- TABLE_LIST *table;
- SELECT_LEX *select= &thd->lex->select_lex;
- List<Item> field_list;
- Item *item;
- Protocol *protocol= thd->protocol;
- LEX *lex= thd->lex;
- int result_code;
- DBUG_ENTER("mysql_admin_table");
-
- field_list.push_back(item = new Item_empty_string("Table", NAME_CHAR_LEN*2));
- item->maybe_null = 1;
- field_list.push_back(item = new Item_empty_string("Op", 10));
- item->maybe_null = 1;
- field_list.push_back(item = new Item_empty_string("Msg_type", 10));
- item->maybe_null = 1;
- field_list.push_back(item = new Item_empty_string("Msg_text", 255));
- item->maybe_null = 1;
- if (protocol->send_result_set_metadata(&field_list,
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
- DBUG_RETURN(TRUE);
-
- mysql_ha_rm_tables(thd, tables);
-
- for (table= tables; table; table= table->next_local)
- {
- char table_name[NAME_LEN*2+2];
- char* db = table->db;
- bool fatal_error=0;
- bool open_error;
-
- DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name));
- DBUG_PRINT("admin", ("extra_open_options: %u", extra_open_options));
- strxmov(table_name, db, ".", table->table_name, NullS);
- thd->open_options|= extra_open_options;
- table->lock_type= lock_type;
- /*
- To make code safe for re-execution we need to reset type of MDL
- request as code below may change it.
- To allow concurrent execution of read-only operations we acquire
- weak metadata lock for them.
- */
- table->mdl_request.set_type((lock_type >= TL_WRITE_ALLOW_WRITE) ?
- MDL_SHARED_NO_READ_WRITE : MDL_SHARED_READ);
- /* open only one table from local list of command */
- {
- TABLE_LIST *save_next_global, *save_next_local;
- save_next_global= table->next_global;
- table->next_global= 0;
- save_next_local= table->next_local;
- table->next_local= 0;
- 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.
- TODO: Investigate if we can put extra tables into argument instead of
- using lex->query_tables
- */
- lex->query_tables= table;
- lex->query_tables_last= &table->next_global;
- lex->query_tables_own_last= 0;
- thd->no_warnings_for_error= no_warnings_for_error;
- if (view_operator_func == NULL)
- table->required_type=FRMTYPE_TABLE;
-
- open_error= open_and_lock_tables(thd, table, TRUE, 0);
- thd->no_warnings_for_error= 0;
- table->next_global= save_next_global;
- table->next_local= save_next_local;
- thd->open_options&= ~extra_open_options;
- /*
- Under locked tables, we know that the table can be opened,
- so any errors opening the table are logical errors.
- In these cases it does not make sense to try to repair.
- */
- if (open_error && thd->locked_tables_mode)
- {
- result_code= HA_ADMIN_FAILED;
- goto send_result;
- }
-#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (table->table)
- {
- /*
- Set up which partitions that should be processed
- if ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION ..
- CACHE INDEX/LOAD INDEX for specified partitions
- */
- Alter_info *alter_info= &lex->alter_info;
-
- if (alter_info->flags & ALTER_ADMIN_PARTITION)
- {
- if (!table->table->part_info)
- {
- my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
- DBUG_RETURN(TRUE);
- }
- uint num_parts_found;
- uint num_parts_opt= alter_info->partition_names.elements;
- num_parts_found= set_part_state(alter_info, table->table->part_info,
- PART_ADMIN);
- if (num_parts_found != num_parts_opt &&
- (!(alter_info->flags & ALTER_ALL_PARTITION)))
- {
- char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
- size_t length;
- DBUG_PRINT("admin", ("sending non existent partition error"));
- protocol->prepare_for_resend();
- protocol->store(table_name, system_charset_info);
- protocol->store(operator_name, system_charset_info);
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- length= my_snprintf(buff, sizeof(buff),
- ER(ER_DROP_PARTITION_NON_EXISTENT),
- table_name);
- protocol->store(buff, length, system_charset_info);
- if(protocol->write())
- goto err;
- my_eof(thd);
- goto err;
- }
- }
- }
-#endif
- }
- DBUG_PRINT("admin", ("table: 0x%lx", (long) table->table));
-
- if (prepare_func)
- {
- DBUG_PRINT("admin", ("calling prepare_func"));
- switch ((*prepare_func)(thd, table, check_opt)) {
- case 1: // error, message written to net
- trans_rollback_stmt(thd);
- trans_rollback(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
- DBUG_PRINT("admin", ("simple error, admin next table"));
- continue;
- case -1: // error, message could be written to net
- /* purecov: begin inspected */
- DBUG_PRINT("admin", ("severe error, stop"));
- goto err;
- /* purecov: end */
- default: // should be 0 otherwise
- DBUG_PRINT("admin", ("prepare_func succeeded"));
- ;
- }
- }
-
- /*
- CHECK TABLE command is only command where VIEW allowed here and this
- command use only temporary teble method for VIEWs resolving => there
- can't be VIEW tree substitition of join view => if opening table
- succeed then table->table will have real TABLE pointer as value (in
- case of join view substitution table->table can be 0, but here it is
- impossible)
- */
- if (!table->table)
- {
- DBUG_PRINT("admin", ("open table failed"));
- if (thd->warning_info->is_empty())
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
- /* if it was a view will check md5 sum */
- if (table->view &&
- view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
- if (thd->stmt_da->is_error() &&
- (thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE ||
- thd->stmt_da->sql_errno() == ER_FILE_NOT_FOUND))
- /* A missing table is just issued as a failed command */
- result_code= HA_ADMIN_FAILED;
- else
- /* Default failure code is corrupt table */
- result_code= HA_ADMIN_CORRUPT;
- goto send_result;
- }
-
- if (table->view)
- {
- DBUG_PRINT("admin", ("calling view_operator_func"));
- result_code= (*view_operator_func)(thd, table);
- goto send_result;
- }
-
- if (table->schema_table)
- {
- result_code= HA_ADMIN_NOT_IMPLEMENTED;
- goto send_result;
- }
-
- if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
- {
- /* purecov: begin inspected */
- char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
- size_t length;
- enum_sql_command save_sql_command= lex->sql_command;
- DBUG_PRINT("admin", ("sending error message"));
- protocol->prepare_for_resend();
- protocol->store(table_name, system_charset_info);
- protocol->store(operator_name, system_charset_info);
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- length= my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY),
- table_name);
- protocol->store(buff, length, system_charset_info);
- trans_commit_stmt(thd);
- trans_commit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
- lex->reset_query_tables_list(FALSE);
- /*
- Restore Query_tables_list::sql_command value to make statement
- safe for re-execution.
- */
- lex->sql_command= save_sql_command;
- table->table=0; // For query cache
- if (protocol->write())
- goto err;
- thd->stmt_da->reset_diagnostics_area();
- continue;
- /* purecov: end */
- }
-
- /*
- Close all instances of the table to allow MyISAM "repair"
- to rename files.
- @todo: This code does not close all instances of the table.
- It only closes instances in other connections, but if this
- connection has LOCK TABLE t1 a READ, t1 b WRITE,
- both t1 instances will be kept open.
- There is no need to execute this branch for InnoDB, which does
- repair by recreate. There is no need to do it for OPTIMIZE,
- which doesn't move files around.
- Hence, this code should be moved to prepare_for_repair(),
- and executed only for MyISAM engine.
- */
- if (lock_type == TL_WRITE && !table->table->s->tmp_table)
- {
- if (wait_while_table_is_used(thd, table->table,
- HA_EXTRA_PREPARE_FOR_RENAME))
- goto err;
- DEBUG_SYNC(thd, "after_admin_flush");
- /* Flush entries in the query cache involving this table. */
- query_cache_invalidate3(thd, table->table, 0);
- /*
- XXX: hack: switch off open_for_modify to skip the
- flush that is made later in the execution flow.
- */
- open_for_modify= 0;
- }
-
- if (table->table->s->crashed && operator_func == &handler::ha_check)
- {
- /* purecov: begin inspected */
- DBUG_PRINT("admin", ("sending crashed warning"));
- protocol->prepare_for_resend();
- protocol->store(table_name, system_charset_info);
- protocol->store(operator_name, system_charset_info);
- protocol->store(STRING_WITH_LEN("warning"), system_charset_info);
- protocol->store(STRING_WITH_LEN("Table is marked as crashed"),
- system_charset_info);
- if (protocol->write())
- goto err;
- /* purecov: end */
- }
-
- if (operator_func == &handler::ha_repair &&
- !(check_opt->sql_flags & TT_USEFRM))
- {
- if ((table->table->file->check_old_types() == HA_ADMIN_NEEDS_ALTER) ||
- (table->table->file->ha_check_for_upgrade(check_opt) ==
- HA_ADMIN_NEEDS_ALTER))
- {
- DBUG_PRINT("admin", ("recreating table"));
- trans_rollback_stmt(thd);
- trans_rollback(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
- tmp_disable_binlog(thd); // binlogging is done by caller if wanted
- result_code= mysql_recreate_table(thd, table);
- reenable_binlog(thd);
- /*
- mysql_recreate_table() can push OK or ERROR.
- Clear 'OK' status. If there is an error, keep it:
- we will store the error message in a result set row
- and then clear.
- */
- if (thd->stmt_da->is_ok())
- thd->stmt_da->reset_diagnostics_area();
- table->table= NULL;
- result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
- goto send_result;
- }
- }
-
- DBUG_PRINT("admin", ("calling operator_func '%s'", operator_name));
- result_code = (table->table->file->*operator_func)(thd, check_opt);
- DBUG_PRINT("admin", ("operator_func returned: %d", result_code));
-
-send_result:
-
- lex->cleanup_after_one_table_open();
- thd->clear_error(); // these errors shouldn't get client
- {
- List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
- MYSQL_ERROR *err;
- while ((err= it++))
- {
- protocol->prepare_for_resend();
- protocol->store(table_name, system_charset_info);
- protocol->store((char*) operator_name, system_charset_info);
- protocol->store(warning_level_names[err->get_level()].str,
- warning_level_names[err->get_level()].length,
- system_charset_info);
- protocol->store(err->get_message_text(), system_charset_info);
- if (protocol->write())
- goto err;
- }
- thd->warning_info->clear_warning_info(thd->query_id);
- }
- protocol->prepare_for_resend();
- protocol->store(table_name, system_charset_info);
- protocol->store(operator_name, system_charset_info);
-
-send_result_message:
-
- DBUG_PRINT("info", ("result_code: %d", result_code));
- switch (result_code) {
- case HA_ADMIN_NOT_IMPLEMENTED:
- {
- char buf[MYSQL_ERRMSG_SIZE];
- size_t length=my_snprintf(buf, sizeof(buf),
- ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
- protocol->store(STRING_WITH_LEN("note"), system_charset_info);
- protocol->store(buf, length, system_charset_info);
- }
- break;
-
- case HA_ADMIN_NOT_BASE_TABLE:
- {
- char buf[MYSQL_ERRMSG_SIZE];
- size_t length= my_snprintf(buf, sizeof(buf),
- ER(ER_BAD_TABLE_ERROR), table_name);
- protocol->store(STRING_WITH_LEN("note"), system_charset_info);
- protocol->store(buf, length, system_charset_info);
- }
- break;
-
- case HA_ADMIN_OK:
- protocol->store(STRING_WITH_LEN("status"), system_charset_info);
- protocol->store(STRING_WITH_LEN("OK"), system_charset_info);
- break;
-
- case HA_ADMIN_FAILED:
- protocol->store(STRING_WITH_LEN("status"), system_charset_info);
- protocol->store(STRING_WITH_LEN("Operation failed"),
- system_charset_info);
- break;
-
- case HA_ADMIN_REJECT:
- protocol->store(STRING_WITH_LEN("status"), system_charset_info);
- protocol->store(STRING_WITH_LEN("Operation need committed state"),
- system_charset_info);
- open_for_modify= FALSE;
- break;
-
- case HA_ADMIN_ALREADY_DONE:
- protocol->store(STRING_WITH_LEN("status"), system_charset_info);
- protocol->store(STRING_WITH_LEN("Table is already up to date"),
- system_charset_info);
- break;
-
- case HA_ADMIN_CORRUPT:
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- protocol->store(STRING_WITH_LEN("Corrupt"), system_charset_info);
- fatal_error=1;
- break;
-
- case HA_ADMIN_INVALID:
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- protocol->store(STRING_WITH_LEN("Invalid argument"),
- system_charset_info);
- break;
-
- case HA_ADMIN_TRY_ALTER:
- {
- /*
- This is currently used only by InnoDB. ha_innobase::optimize() answers
- "try with alter", so here we close the table, do an ALTER TABLE,
- reopen the table and do ha_innobase::analyze() on it.
- We have to end the row, so analyze could return more rows.
- */
- trans_commit_stmt(thd);
- trans_commit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
- DEBUG_SYNC(thd, "ha_admin_try_alter");
- protocol->store(STRING_WITH_LEN("note"), system_charset_info);
- protocol->store(STRING_WITH_LEN(
- "Table does not support optimize, doing recreate + analyze instead"),
- system_charset_info);
- if (protocol->write())
- goto err;
- DBUG_PRINT("info", ("HA_ADMIN_TRY_ALTER, trying analyze..."));
- TABLE_LIST *save_next_local= table->next_local,
- *save_next_global= table->next_global;
- table->next_local= table->next_global= 0;
- tmp_disable_binlog(thd); // binlogging is done by caller if wanted
- result_code= mysql_recreate_table(thd, table);
- reenable_binlog(thd);
- /*
- mysql_recreate_table() can push OK or ERROR.
- Clear 'OK' status. If there is an error, keep it:
- we will store the error message in a result set row
- and then clear.
- */
- if (thd->stmt_da->is_ok())
- thd->stmt_da->reset_diagnostics_area();
- trans_commit_stmt(thd);
- trans_commit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
- table->table= NULL;
- if (!result_code) // recreation went ok
- {
- /* Clear the ticket released above. */
- table->mdl_request.ticket= NULL;
- DEBUG_SYNC(thd, "ha_admin_open_ltable");
- table->mdl_request.set_type(MDL_SHARED_WRITE);
- if ((table->table= open_ltable(thd, table, lock_type, 0)))
- {
- result_code= table->table->file->ha_analyze(thd, check_opt);
- if (result_code == HA_ADMIN_ALREADY_DONE)
- result_code= HA_ADMIN_OK;
- else if (result_code) // analyze failed
- table->table->file->print_error(result_code, MYF(0));
- }
- else
- result_code= -1; // open failed
- }
- /* Start a new row for the final status row */
- protocol->prepare_for_resend();
- protocol->store(table_name, system_charset_info);
- protocol->store(operator_name, system_charset_info);
- if (result_code) // either mysql_recreate_table or analyze failed
- {
- DBUG_ASSERT(thd->is_error());
- if (thd->is_error())
- {
- const char *err_msg= thd->stmt_da->message();
- if (!thd->vio_ok())
- {
- sql_print_error("%s", err_msg);
- }
- else
- {
- /* Hijack the row already in-progress. */
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- protocol->store(err_msg, system_charset_info);
- if (protocol->write())
- goto err;
- /* Start off another row for HA_ADMIN_FAILED */
- protocol->prepare_for_resend();
- protocol->store(table_name, system_charset_info);
- protocol->store(operator_name, system_charset_info);
- }
- thd->clear_error();
- }
- }
- result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
- table->next_local= save_next_local;
- table->next_global= save_next_global;
- goto send_result_message;
- }
- case HA_ADMIN_WRONG_CHECKSUM:
- {
- protocol->store(STRING_WITH_LEN("note"), system_charset_info);
- protocol->store(ER(ER_VIEW_CHECKSUM), strlen(ER(ER_VIEW_CHECKSUM)),
- system_charset_info);
- break;
- }
-
- case HA_ADMIN_NEEDS_UPGRADE:
- case HA_ADMIN_NEEDS_ALTER:
- {
- char buf[MYSQL_ERRMSG_SIZE];
- size_t length;
-
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- length=my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
- table->table_name);
- protocol->store(buf, length, system_charset_info);
- fatal_error=1;
- break;
- }
-
- default: // Probably HA_ADMIN_INTERNAL_ERROR
- {
- char buf[MYSQL_ERRMSG_SIZE];
- size_t length=my_snprintf(buf, sizeof(buf),
- "Unknown - internal error %d during operation",
- result_code);
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- protocol->store(buf, length, system_charset_info);
- fatal_error=1;
- break;
- }
- }
- if (table->table)
- {
- if (table->table->s->tmp_table)
- {
- /*
- If the table was not opened successfully, do not try to get
- status information. (Bug#47633)
- */
- if (open_for_modify && !open_error)
- table->table->file->info(HA_STATUS_CONST);
- }
- else if (open_for_modify || fatal_error)
- {
- mysql_mutex_lock(&LOCK_open);
- tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
- table->db, table->table_name);
- mysql_mutex_unlock(&LOCK_open);
- /*
- May be something modified. Consequently, we have to
- invalidate the query cache.
- */
- table->table= 0; // For query cache
- query_cache_invalidate3(thd, table, 0);
- }
- }
- /* Error path, a admin command failed. */
- trans_commit_stmt(thd);
- trans_commit_implicit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
-
- /*
- If it is CHECK TABLE v1, v2, v3, and v1, v2, v3 are views, we will run
- separate open_tables() for each CHECK TABLE argument.
- Right now we do not have a separate method to reset the prelocking
- state in the lex to the state after parsing, so each open will pollute
- this state: add elements to lex->srotuines_list, TABLE_LISTs to
- lex->query_tables. Below is a lame attempt to recover from this
- pollution.
- @todo: have a method to reset a prelocking context, or use separate
- contexts for each open.
- */
- for (Sroutine_hash_entry *rt=
- (Sroutine_hash_entry*)thd->lex->sroutines_list.first;
- rt; rt= rt->next)
- rt->mdl_request.ticket= NULL;
-
- if (protocol->write())
- goto err;
- }
-
- my_eof(thd);
- DBUG_RETURN(FALSE);
-
-err:
- trans_rollback_stmt(thd);
- trans_rollback(thd);
- close_thread_tables(thd); // Shouldn't be needed
- thd->mdl_context.release_transactional_locks();
- if (table)
- table->table=0;
- DBUG_RETURN(TRUE);
-}
-
-
-bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
-{
- DBUG_ENTER("mysql_repair_table");
- DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
- "repair", TL_WRITE, 1,
- test(check_opt->sql_flags & TT_USEFRM),
- HA_OPEN_FOR_REPAIR,
- &prepare_for_repair,
- &handler::ha_repair, 0));
-}
-
-
-bool mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
-{
- DBUG_ENTER("mysql_optimize_table");
- DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
- "optimize", TL_WRITE, 1,0,0,0,
- &handler::ha_optimize, 0));
-}
-
-
-/*
- Assigned specified indexes for a table into key cache
-
- SYNOPSIS
- mysql_assign_to_keycache()
- thd Thread object
- tables Table list (one table only)
-
- RETURN VALUES
- FALSE ok
- TRUE error
-*/
-
-bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
- LEX_STRING *key_cache_name)
-{
- HA_CHECK_OPT check_opt;
- KEY_CACHE *key_cache;
- DBUG_ENTER("mysql_assign_to_keycache");
-
- check_opt.init();
- mysql_mutex_lock(&LOCK_global_system_variables);
- if (!(key_cache= get_key_cache(key_cache_name)))
- {
- mysql_mutex_unlock(&LOCK_global_system_variables);
- my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str);
- DBUG_RETURN(TRUE);
- }
- mysql_mutex_unlock(&LOCK_global_system_variables);
- check_opt.key_cache= key_cache;
- DBUG_RETURN(mysql_admin_table(thd, tables, &check_opt,
- "assign_to_keycache", TL_READ_NO_INSERT, 0, 0,
- 0, 0, &handler::assign_to_keycache, 0));
-}
-
-
-/*
- Preload specified indexes for a table into key cache
-
- SYNOPSIS
- mysql_preload_keys()
- thd Thread object
- tables Table list (one table only)
-
- RETURN VALUES
- FALSE ok
- TRUE error
-*/
-
-bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
-{
- DBUG_ENTER("mysql_preload_keys");
- /*
- We cannot allow concurrent inserts. The storage engine reads
- directly from the index file, bypassing the cache. It could read
- outdated information if parallel inserts into cache blocks happen.
- */
- DBUG_RETURN(mysql_admin_table(thd, tables, 0,
- "preload_keys", TL_READ_NO_INSERT, 0, 0, 0, 0,
- &handler::preload_keys, 0));
-}
-
-
/*
Create a table identical to the specified table
@@ -5293,6 +4454,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
HA_CREATE_INFO local_create_info;
Alter_info local_alter_info;
bool res= TRUE;
+ bool is_trans= FALSE;
uint not_used;
DBUG_ENTER("mysql_create_like_table");
@@ -5344,7 +4506,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
if ((res= mysql_create_table_no_lock(thd, table->db, table->table_name,
&local_create_info, &local_alter_info,
- FALSE, 0)))
+ FALSE, 0, &is_trans)))
goto err;
/*
@@ -5352,11 +4514,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
non-temporary table.
*/
DBUG_ASSERT((create_info->options & HA_LEX_CREATE_TMP_TABLE) ||
- local_create_info.table_existed ||
thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db,
table->table_name,
MDL_EXCLUSIVE));
-
/*
We have to write the query before we unlock the tables.
*/
@@ -5427,7 +4587,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
Case 3 and 4 does nothing under RBR
*/
}
- else if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
+ else if (write_bin_log(thd, TRUE, thd->query(), thd->query_length(), is_trans))
goto err;
err:
@@ -5435,29 +4595,6 @@ err:
}
-bool mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
-{
- thr_lock_type lock_type = TL_READ_NO_INSERT;
-
- DBUG_ENTER("mysql_analyze_table");
- DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
- "analyze", lock_type, 1, 0, 0, 0,
- &handler::ha_analyze, 0));
-}
-
-
-bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
-{
- thr_lock_type lock_type = TL_READ_NO_INSERT;
-
- DBUG_ENTER("mysql_check_table");
- DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
- "check", lock_type,
- 0, 0, HA_OPEN_FOR_REPAIR, 0,
- &handler::ha_check, &view_checksum));
-}
-
-
/* table_list should contain just one table */
static int
mysql_discard_or_import_tablespace(THD *thd,
@@ -5568,7 +4705,7 @@ is_index_maintenance_unique (TABLE *table, Alter_info *alter_info)
/*
SYNOPSIS
- compare_tables()
+ mysql_compare_tables()
table The original table.
alter_info Alter options, fields and keys for the new
table.
@@ -5608,17 +4745,16 @@ is_index_maintenance_unique (TABLE *table, Alter_info *alter_info)
FALSE success
*/
-static
bool
-compare_tables(TABLE *table,
- Alter_info *alter_info,
- HA_CREATE_INFO *create_info,
- uint order_num,
- enum_alter_table_change_level *need_copy_table,
- KEY **key_info_buffer,
- uint **index_drop_buffer, uint *index_drop_count,
- uint **index_add_buffer, uint *index_add_count,
- uint *candidate_key_count)
+mysql_compare_tables(TABLE *table,
+ Alter_info *alter_info,
+ HA_CREATE_INFO *create_info,
+ uint order_num,
+ enum_alter_table_change_level *need_copy_table,
+ KEY **key_info_buffer,
+ uint **index_drop_buffer, uint *index_drop_count,
+ uint **index_add_buffer, uint *index_add_count,
+ uint *candidate_key_count)
{
Field **f_ptr, *field;
uint changes= 0, tmp;
@@ -5634,7 +4770,7 @@ compare_tables(TABLE *table,
*/
bool varchar= create_info->varchar;
bool not_nullable= true;
- DBUG_ENTER("compare_tables");
+ DBUG_ENTER("mysql_compare_tables");
/*
Create a copy of alter_info.
@@ -5645,7 +4781,7 @@ compare_tables(TABLE *table,
mysql_prepare_create_table. Unfortunately,
mysql_prepare_create_table performs its transformations
"in-place", that is, modifies the argument. Since we would
- like to keep compare_tables() idempotent (not altering any
+ like to keep mysql_compare_tables() idempotent (not altering any
of the arguments) we create a copy of alter_info here and
pass it to mysql_prepare_create_table, then use the result
to evaluate possibility of fast ALTER TABLE, and then
@@ -6025,7 +5161,7 @@ blob_length_by_type(enum_field_types type)
@retval FALSE success
*/
-static bool
+bool
mysql_prepare_alter_table(THD *thd, TABLE *table,
HA_CREATE_INFO *create_info,
Alter_info *alter_info)
@@ -6434,7 +5570,7 @@ err:
Important is the fact, that this function tries to do as little work as
possible, by finding out whether a intermediate table is needed to copy
data into and when finishing the altering to use it as the original table.
- For this reason the function compare_tables() is called, which decides
+ For this reason the function mysql_compare_tables() is called, which decides
based on all kind of data how similar are the new and the original
tables.
@@ -6775,7 +5911,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
else
{
*fn_ext(new_name)=0;
- mysql_mutex_lock(&LOCK_open);
if (mysql_rename_table(old_db_type,db,table_name,new_db,new_alias, 0))
error= -1;
else if (Table_triggers_list::change_table_name(thd, db, table_name,
@@ -6785,7 +5920,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
table_name, 0);
error= -1;
}
- mysql_mutex_unlock(&LOCK_open);
}
}
@@ -6872,13 +6006,13 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
enum_alter_table_change_level need_copy_table_res;
/* Check how much the tables differ. */
- if (compare_tables(table, alter_info,
- create_info, order_num,
- &need_copy_table_res,
- &key_info_buffer,
- &index_drop_buffer, &index_drop_count,
- &index_add_buffer, &index_add_count,
- &candidate_key_count))
+ if (mysql_compare_tables(table, alter_info,
+ create_info, order_num,
+ &need_copy_table_res,
+ &key_info_buffer,
+ &index_drop_buffer, &index_drop_count,
+ &index_add_buffer, &index_add_count,
+ &candidate_key_count))
goto err;
DBUG_EXECUTE_IF("alter_table_only_metadata_change", {
@@ -7140,7 +6274,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error= mysql_create_table_no_lock(thd, new_db, tmp_name,
create_info,
alter_info,
- 1, 0);
+ 1, 0, NULL);
reenable_binlog(thd);
if (error)
goto err;
@@ -7392,7 +6526,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
it should become the actual table. Later, we will recycle the old table.
However, in case of ALTER TABLE RENAME there might be no intermediate
table. This is when the old and new tables are compatible, according to
- compare_table(). Then, we need one additional call to
+ mysql_compare_table(). Then, we need one additional call to
mysql_rename_table() with flag NO_FRM_RENAME, which does nothing else but
actual rename in the SE and the FRM is not touched. Note that, if the
table is renamed and the SE is also changed, then an intermediate table
@@ -7404,7 +6538,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* This type cannot happen in regular ALTER. */
new_db_type= old_db_type= NULL;
}
- mysql_mutex_lock(&LOCK_open);
if (mysql_rename_table(old_db_type, db, table_name, db, old_name,
FN_TO_IS_TMP))
{
@@ -7431,8 +6564,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (! error)
(void) quick_rm_table(old_db_type, db, old_name, FN_IS_TMP);
- mysql_mutex_unlock(&LOCK_open);
-
if (error)
{
/* This shouldn't happen. But let us play it safe. */
@@ -7609,6 +6740,54 @@ err_with_mdl:
}
/* mysql_alter_table */
+
+
+/**
+ Prepare the transaction for the alter table's copy phase.
+*/
+
+bool mysql_trans_prepare_alter_copy_data(THD *thd)
+{
+ DBUG_ENTER("mysql_prepare_alter_copy_data");
+ /*
+ Turn off recovery logging since rollback of an alter table is to
+ delete the new table so there is no need to log the changes to it.
+
+ This needs to be done before external_lock.
+ */
+ if (ha_enable_transaction(thd, FALSE))
+ DBUG_RETURN(TRUE);
+ DBUG_RETURN(FALSE);
+}
+
+
+/**
+ Commit the copy phase of the alter table.
+*/
+
+bool mysql_trans_commit_alter_copy_data(THD *thd)
+{
+ bool error= FALSE;
+ DBUG_ENTER("mysql_commit_alter_copy_data");
+
+ if (ha_enable_transaction(thd, TRUE))
+ DBUG_RETURN(TRUE);
+
+ /*
+ Ensure that the new table is saved properly to disk before installing
+ the new .frm.
+ And that InnoDB's internal latches are released, to avoid deadlock
+ when waiting on other instances of the table before rename (Bug#54747).
+ */
+ if (trans_commit_stmt(thd))
+ error= TRUE;
+ if (trans_commit_implicit(thd))
+ error= TRUE;
+
+ DBUG_RETURN(error);
+}
+
+
static int
copy_data_between_tables(TABLE *from,TABLE *to,
List<Create_field> &create,
@@ -7635,14 +6814,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
ulonglong prev_insert_id;
DBUG_ENTER("copy_data_between_tables");
- /*
- Turn off recovery logging since rollback of an alter table is to
- delete the new table so there is no need to log the changes to it.
-
- This needs to be done before external_lock
- */
- error= ha_enable_transaction(thd, FALSE);
- if (error)
+ if (mysql_trans_prepare_alter_copy_data(thd))
DBUG_RETURN(-1);
if (!(copy= new Copy_field[to->s->fields]))
@@ -7801,20 +6973,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
}
to->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
- if (ha_enable_transaction(thd, TRUE))
- {
+ if (mysql_trans_commit_alter_copy_data(thd))
error= 1;
- goto err;
- }
-
- /*
- Ensure that the new table is saved properly to disk so that we
- can do a rename
- */
- if (trans_commit_stmt(thd))
- error=1;
- if (trans_commit_implicit(thd))
- error=1;
err:
thd->variables.sql_mode= save_sql_mode;
diff --git a/sql/sql_table.h b/sql/sql_table.h
index dca4b706605..eb0b1aa94dd 100644
--- a/sql/sql_table.h
+++ b/sql/sql_table.h
@@ -20,7 +20,6 @@
#include "my_sys.h" // pthread_mutex_t
class Alter_info;
-class Alter_info;
class Create_field;
struct TABLE_LIST;
class THD;
@@ -28,11 +27,12 @@ struct TABLE;
struct handlerton;
typedef struct st_ha_check_opt HA_CHECK_OPT;
typedef struct st_ha_create_information HA_CREATE_INFO;
+typedef struct st_key KEY;
typedef struct st_key_cache KEY_CACHE;
typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE;
-typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE;
typedef struct st_mysql_lex_string LEX_STRING;
typedef struct st_order ORDER;
+class Alter_table_change_level;
enum ddl_log_entry_code
{
@@ -138,13 +138,27 @@ bool mysql_create_table_no_lock(THD *thd, const char *db,
const char *table_name,
HA_CREATE_INFO *create_info,
Alter_info *alter_info,
- bool tmp_table, uint select_field_count);
-
+ bool tmp_table, uint select_field_count,
+ bool *is_trans);
+bool mysql_prepare_alter_table(THD *thd, TABLE *table,
+ HA_CREATE_INFO *create_info,
+ Alter_info *alter_info);
+bool mysql_trans_prepare_alter_copy_data(THD *thd);
+bool mysql_trans_commit_alter_copy_data(THD *thd);
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
HA_CREATE_INFO *create_info,
TABLE_LIST *table_list,
Alter_info *alter_info,
uint order_num, ORDER *order, bool ignore);
+bool mysql_compare_tables(TABLE *table,
+ Alter_info *alter_info,
+ HA_CREATE_INFO *create_info,
+ uint order_num,
+ Alter_table_change_level *need_copy_table,
+ KEY **key_info_buffer,
+ uint **index_drop_buffer, uint *index_drop_count,
+ uint **index_add_buffer, uint *index_add_count,
+ uint *candidate_key_count);
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list);
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
TABLE_LIST *src_table,
@@ -158,19 +172,6 @@ bool mysql_restore_table(THD* thd, TABLE_LIST* table_list);
bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
-bool mysql_check_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_repair_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
- HA_CHECK_OPT* check_opt);
-bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
- LEX_STRING *key_cache_name);
-bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
-int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
- KEY_CACHE *dst_cache);
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary);
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 501c4cf6a94..9d0614f8529 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -118,7 +118,7 @@ static void print_cached_tables(void)
printf("unused_links isn't linked properly\n");
return;
}
- } while (count++ < table_cache_count && (lnk=lnk->next) != start_link);
+ } while (count++ < cached_open_tables() && (lnk=lnk->next) != start_link);
if (lnk != start_link)
{
printf("Unused_links aren't connected\n");
@@ -416,7 +416,7 @@ static void display_table_locks(void)
void *saved_base;
DYNAMIC_ARRAY saved_table_locks;
- (void) my_init_dynamic_array(&saved_table_locks,sizeof(TABLE_LOCK_INFO), table_cache_count + 20,50);
+ (void) my_init_dynamic_array(&saved_table_locks,sizeof(TABLE_LOCK_INFO), cached_open_tables() + 20,50);
mysql_mutex_lock(&THR_LOCK_lock);
for (list= thr_lock_thread_list; list; list= list_rest(list))
{
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index a5664b00287..b81461e8371 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -394,9 +394,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
/*
We don't want perform our operations while global read lock is held
so we have to wait until its end and then prevent it from occurring
- again until we are done, unless we are under lock tables. (Acquiring
- LOCK_open is not enough because global read lock is held without holding
- LOCK_open).
+ again until we are done, unless we are under lock tables.
*/
if (!thd->locked_tables_mode &&
thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
@@ -516,11 +514,9 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
goto end;
}
- mysql_mutex_lock(&LOCK_open);
result= (create ?
table->triggers->create_trigger(thd, tables, &stmt_query):
table->triggers->drop_trigger(thd, tables, &stmt_query));
- mysql_mutex_unlock(&LOCK_open);
if (result)
goto end;
@@ -1680,9 +1676,6 @@ bool add_table_for_trigger(THD *thd,
@param db schema for table
@param name name for table
- @note
- The calling thread should hold the LOCK_open mutex;
-
@retval
False success
@retval
@@ -1912,14 +1905,10 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
/*
This method interfaces the mysql server code protected by
- either LOCK_open mutex or with an exclusive metadata lock.
- In the future, only an exclusive metadata lock will be enough.
+ an exclusive metadata lock.
*/
-#ifndef DBUG_OFF
- if (thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, old_table,
- MDL_EXCLUSIVE))
- mysql_mutex_assert_owner(&LOCK_open);
-#endif
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, old_table,
+ MDL_EXCLUSIVE));
DBUG_ASSERT(my_strcasecmp(table_alias_charset, db, new_db) ||
my_strcasecmp(table_alias_charset, old_table, new_table));
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index ee5c707cd69..a61abdafe3e 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -13,7 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include "sql_truncate.h"
#include "sql_priv.h"
#include "transaction.h"
#include "debug_sync.h"
@@ -25,6 +24,9 @@
#include "sql_handler.h" // mysql_ha_rm_tables
#include "datadict.h" // dd_recreate_table()
#include "lock.h" // MYSQL_OPEN_TEMPORARY_ONLY
+#include "sql_acl.h" // DROP_ACL
+#include "sql_parse.h" // check_one_table_access()
+#include "sql_truncate.h"
/*
@@ -242,6 +244,7 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
MDL_ticket **ticket_downgrade)
{
TABLE *table= NULL;
+ handlerton *table_type;
DBUG_ENTER("open_and_lock_table_for_truncate");
DBUG_ASSERT(table_ref->lock_type == TL_WRITE);
@@ -265,7 +268,8 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
table_ref->table_name, FALSE)))
DBUG_RETURN(TRUE);
- *hton_can_recreate= ha_check_storage_engine_flag(table->s->db_type(),
+ table_type= table->s->db_type();
+ *hton_can_recreate= ha_check_storage_engine_flag(table_type,
HTON_CAN_RECREATE);
table_ref->mdl_request.ticket= table->mdl_ticket;
}
@@ -281,11 +285,25 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
MYSQL_OPEN_SKIP_TEMPORARY))
DBUG_RETURN(TRUE);
- if (dd_check_storage_engine_flag(thd, table_ref->db, table_ref->table_name,
- HTON_CAN_RECREATE, hton_can_recreate))
+ if (dd_frm_storage_engine(thd, table_ref->db, table_ref->table_name,
+ &table_type))
DBUG_RETURN(TRUE);
+ *hton_can_recreate= ha_check_storage_engine_flag(table_type,
+ HTON_CAN_RECREATE);
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ /*
+ TODO: Add support for TRUNCATE PARTITION for NDB and other engines
+ supporting native partitioning.
+ */
+ if (thd->lex->alter_info.flags & ALTER_ADMIN_PARTITION &&
+ table_type != partition_hton)
+ {
+ my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+#endif
DEBUG_SYNC(thd, "lock_table_for_truncate");
if (*hton_can_recreate)
@@ -310,10 +328,8 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
upgrade_shared_lock_to_exclusive(table_ref->mdl_request.ticket,
timeout))
DBUG_RETURN(TRUE);
- mysql_mutex_lock(&LOCK_open);
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table_ref->db,
- table_ref->table_name);
- mysql_mutex_unlock(&LOCK_open);
+ table_ref->table_name, FALSE);
}
}
else
@@ -477,3 +493,27 @@ bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref)
DBUG_RETURN(test(error));
}
+
+bool Truncate_statement::execute(THD *thd)
+{
+ TABLE_LIST *first_table= thd->lex->select_lex.table_list.first;
+ bool res= TRUE;
+ DBUG_ENTER("Truncate_statement::execute");
+
+ if (check_one_table_access(thd, DROP_ACL, first_table))
+ goto error;
+ /*
+ Don't allow this within a transaction because we want to use
+ re-generate table
+ */
+ if (thd->in_active_multi_stmt_transaction())
+ {
+ my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
+ ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ goto error;
+ }
+ if (! (res= mysql_truncate_table(thd, first_table)))
+ my_ok(thd);
+error:
+ DBUG_RETURN(res);
+}
diff --git a/sql/sql_truncate.h b/sql/sql_truncate.h
index 11c07c7187c..b8b1d3da53d 100644
--- a/sql/sql_truncate.h
+++ b/sql/sql_truncate.h
@@ -20,4 +20,30 @@ struct TABLE_LIST;
bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref);
+/**
+ Truncate_statement represents the TRUNCATE statement.
+*/
+class Truncate_statement : public Sql_statement
+{
+public:
+ /**
+ Constructor, used to represent a ALTER TABLE statement.
+ @param lex the LEX structure for this statement.
+ */
+ Truncate_statement(LEX *lex)
+ : Sql_statement(lex)
+ {}
+
+ ~Truncate_statement()
+ {}
+
+ /**
+ Execute a TRUNCATE statement at runtime.
+ @param thd the current thread.
+ @return false on success.
+ */
+ bool execute(THD *thd);
+};
+
+
#endif
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 35478e28520..68440f6623a 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1145,57 +1145,6 @@ int mysql_multi_update_prepare(THD *thd)
}
-/**
- Implementation of the safe update options during UPDATE IGNORE. This syntax
- causes an UPDATE statement to ignore all errors. In safe update mode,
- however, we must never ignore the ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE. There
- is a special hook in my_message_sql that will otherwise delete all errors
- when the IGNORE option is specified.
-
- In the future, all IGNORE handling should be used with this class and all
- traces of the hack outlined below should be removed.
-
- - The parser detects IGNORE option and sets thd->lex->ignore= 1
-
- - In JOIN::optimize, if this is set, then
- thd->lex->current_select->no_error gets set.
-
- - In my_message_sql(), if the flag above is set then any error is
- unconditionally converted to a warning.
-
- We are moving in the direction of using Internal_error_handler subclasses
- to do all such error tweaking, please continue this effort if new bugs
- appear.
- */
-class Safe_dml_handler : public Internal_error_handler {
-
-private:
- bool m_handled_error;
-
-public:
- explicit Safe_dml_handler() : m_handled_error(FALSE) {}
-
- bool handle_condition(THD *thd,
- uint sql_errno,
- const char* sqlstate,
- MYSQL_ERROR::enum_warning_level level,
- const char* msg,
- MYSQL_ERROR ** cond_hdl)
- {
- if (level == MYSQL_ERROR::WARN_LEVEL_ERROR &&
- sql_errno == ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE)
- {
- thd->stmt_da->set_error_status(thd, sql_errno, msg, sqlstate);
- m_handled_error= TRUE;
- return TRUE;
- }
- return FALSE;
- }
-
- bool handled_error() { return m_handled_error; }
-
-};
-
/*
Setup multi-update handling and call SELECT to do the join
*/
@@ -1229,11 +1178,6 @@ bool mysql_multi_update(THD *thd,
List<Item> total_list;
- Safe_dml_handler handler;
- bool using_handler= thd->variables.option_bits & OPTION_SAFE_UPDATES;
- if (using_handler)
- thd->push_internal_handler(&handler);
-
res= mysql_select(thd, &select_lex->ref_pointer_array,
table_list, select_lex->with_wild,
total_list,
@@ -1243,21 +1187,9 @@ bool mysql_multi_update(THD *thd,
OPTION_SETUP_TABLES_DONE,
*result, unit, select_lex);
- if (using_handler)
- {
- Internal_error_handler *top_handler;
- top_handler= thd->pop_internal_handler();
- DBUG_ASSERT(&handler == top_handler);
- }
-
DBUG_PRINT("info",("res: %d report_error: %d", res, (int) thd->is_error()));
res|= thd->is_error();
- /*
- Todo: remove below code and make Safe_dml_handler do error processing
- instead. That way we can return the actual error instead of
- ER_UNKNOWN_ERROR.
- */
- if (unlikely(res) && (!using_handler || !handler.handled_error()))
+ if (unlikely(res))
{
/* If we had a another error reported earlier then this will be ignored */
(*result)->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR));
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index be13349b5a1..5fdf7b8d850 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -433,8 +433,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
goto err;
lex->link_first_table_back(view, link_to_local);
- view->open_strategy= TABLE_LIST::OPEN_STUB;
- view->lock_strategy= TABLE_LIST::OTLS_NONE;
view->open_type= OT_BASE_ONLY;
if (open_and_lock_tables(thd, lex->query_tables, TRUE, 0))
@@ -658,7 +656,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
goto err;
}
- mysql_mutex_lock(&LOCK_open);
res= mysql_register_view(thd, view, mode);
if (mysql_bin_log.is_open())
@@ -705,7 +702,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
res= TRUE;
}
- mysql_mutex_unlock(&LOCK_open);
if (mode != VIEW_CREATE_NEW)
query_cache_invalidate3(thd, view, 0);
thd->global_read_lock.start_waiting_global_read_lock(thd);
@@ -1656,10 +1652,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
MYSQL_OPEN_SKIP_TEMPORARY))
DBUG_RETURN(TRUE);
- mysql_mutex_lock(&LOCK_open);
for (view= views; view; view= view->next_local)
{
- TABLE_SHARE *share;
frm_type_enum type= FRMTYPE_ERROR;
build_table_filename(path, sizeof(path) - 1,
view->db, view->table_name, reg_ext, 0);
@@ -1698,16 +1692,12 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
some_views_deleted= TRUE;
/*
- For a view, there is only one table_share object which should never
- be used outside of LOCK_open
+ For a view, there is a TABLE_SHARE object, but its
+ ref_count never goes above 1. Remove it from the table
+ definition cache, in case the view was cached.
*/
- if ((share= get_cached_table_share(view->db, view->table_name)))
- {
- DBUG_ASSERT(share->ref_count == 0);
- share->ref_count++;
- share->version= 0;
- release_table_share(share);
- }
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, view->db, view->table_name,
+ FALSE);
query_cache_invalidate3(thd, view, 0);
sp_cache_invalidate();
}
@@ -1732,8 +1722,6 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
something_wrong= 1;
}
- mysql_mutex_unlock(&LOCK_open);
-
if (something_wrong)
{
DBUG_RETURN(TRUE);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 9c712484faa..731e54ef6d8 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -51,6 +51,10 @@
#include "sp_pcontext.h"
#include "sp_rcontext.h"
#include "sp.h"
+#include "sql_alter.h" // Alter_table*_statement
+#include "sql_truncate.h" // Truncate_statement
+#include "sql_admin.h" // Analyze/Check..._table_stmt
+#include "sql_partition_admin.h" // Alter_table_*_partition_stmt
#include "sql_signal.h"
#include "event_parse_data.h"
#include <myisam.h>
@@ -1422,6 +1426,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <table>
table_ident table_ident_nodb references xid
+ table_ident_opt_wild
%type <simple_string>
remember_name remember_end opt_db text_or_password
@@ -2028,6 +2033,12 @@ create:
TL_OPTION_UPDATING,
TL_WRITE, MDL_EXCLUSIVE))
MYSQL_YYABORT;
+ /*
+ For CREATE TABLE, an non-existing table is not an error.
+ Instruct open_tables() to just take an MDL lock if the
+ table does not exist.
+ */
+ lex->query_tables->open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
lex->alter_info.reset();
lex->col_list.empty();
lex->change=NullS;
@@ -6173,9 +6184,20 @@ alter:
lex->no_write_to_binlog= 0;
lex->create_info.storage_media= HA_SM_DEFAULT;
lex->create_last_non_select_table= lex->last_table();
+ DBUG_ASSERT(!lex->m_stmt);
}
alter_commands
- {}
+ {
+ THD *thd= YYTHD;
+ LEX *lex= thd->lex;
+ if (!lex->m_stmt)
+ {
+ /* Create a generic ALTER TABLE statment. */
+ lex->m_stmt= new (thd->mem_root) Alter_table_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
+ }
+ }
| ALTER DATABASE ident_or_empty
{
Lex->create_info.default_table_charset= NULL;
@@ -6394,38 +6416,54 @@ alter_commands:
| OPTIMIZE PARTITION_SYM opt_no_write_to_binlog
all_or_alt_part_name_list
{
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_OPTIMIZE;
- lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+ THD *thd= YYTHD;
+ LEX *lex= thd->lex;
lex->no_write_to_binlog= $3;
lex->check_opt.init();
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root)
+ Alter_table_optimize_partition_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
}
opt_no_write_to_binlog
| ANALYZE_SYM PARTITION_SYM opt_no_write_to_binlog
all_or_alt_part_name_list
{
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_ANALYZE;
- lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+ THD *thd= YYTHD;
+ LEX *lex= thd->lex;
lex->no_write_to_binlog= $3;
lex->check_opt.init();
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root)
+ Alter_table_analyze_partition_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
}
| CHECK_SYM PARTITION_SYM all_or_alt_part_name_list
{
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_CHECK;
- lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+ THD *thd= YYTHD;
+ LEX *lex= thd->lex;
lex->check_opt.init();
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root)
+ Alter_table_check_partition_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
}
opt_mi_check_type
| REPAIR PARTITION_SYM opt_no_write_to_binlog
all_or_alt_part_name_list
{
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_REPAIR;
- lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+ THD *thd= YYTHD;
+ LEX *lex= thd->lex;
lex->no_write_to_binlog= $3;
lex->check_opt.init();
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root)
+ Alter_table_repair_partition_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
}
opt_mi_repair_type
| COALESCE PARTITION_SYM opt_no_write_to_binlog real_ulong_num
@@ -6437,12 +6475,14 @@ alter_commands:
}
| TRUNCATE_SYM PARTITION_SYM all_or_alt_part_name_list
{
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_TRUNCATE;
- lex->alter_info.flags|= ALTER_ADMIN_PARTITION;
+ THD *thd= YYTHD;
+ LEX *lex= thd->lex;
lex->check_opt.init();
- lex->query_tables->mdl_request.set_type(MDL_SHARED_NO_READ_WRITE);
- lex->query_tables->lock_type= TL_WRITE;
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root)
+ Alter_table_truncate_partition_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
}
| reorg_partition_rule
;
@@ -6879,7 +6919,14 @@ repair:
YYPS->m_lock_type= TL_UNLOCK;
}
table_list opt_mi_repair_type
- {}
+ {
+ THD *thd= YYTHD;
+ LEX* lex= thd->lex;
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root) Repair_table_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
+ }
;
opt_mi_repair_type:
@@ -6910,7 +6957,14 @@ analyze:
YYPS->m_lock_type= TL_UNLOCK;
}
table_list
- {}
+ {
+ THD *thd= YYTHD;
+ LEX* lex= thd->lex;
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root) Analyze_table_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
+ }
;
binlog_base64_event:
@@ -6938,7 +6992,14 @@ check:
YYPS->m_lock_type= TL_UNLOCK;
}
table_list opt_mi_check_type
- {}
+ {
+ THD *thd= YYTHD;
+ LEX* lex= thd->lex;
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root) Check_table_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
+ }
;
opt_mi_check_type:
@@ -6972,7 +7033,14 @@ optimize:
YYPS->m_lock_type= TL_UNLOCK;
}
table_list
- {}
+ {
+ THD *thd= YYTHD;
+ LEX* lex= thd->lex;
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root) Optimize_table_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
+ }
;
opt_no_write_to_binlog:
@@ -10305,7 +10373,7 @@ table_alias_ref_list:
;
table_alias_ref:
- table_ident
+ table_ident_opt_wild
{
if (!Select->add_table_to_list(YYTHD, $1, NULL,
TL_OPTION_UPDATING | TL_OPTION_ALIAS,
@@ -10699,7 +10767,14 @@ truncate:
YYPS->m_mdl_type= MDL_SHARED_NO_READ_WRITE;
}
table_name
- {}
+ {
+ THD *thd= YYTHD;
+ LEX* lex= thd->lex;
+ DBUG_ASSERT(!lex->m_stmt);
+ lex->m_stmt= new (thd->mem_root) Truncate_statement(lex);
+ if (lex->m_stmt == NULL)
+ MYSQL_YYABORT;
+ }
;
opt_table_sym:
@@ -11203,9 +11278,8 @@ opt_with_read_lock:
{
TABLE_LIST *tables= Lex->query_tables;
Lex->type|= REFRESH_READ_LOCK;
- /* We acquire an X lock currently and then downgrade. */
for (; tables; tables= tables->next_global)
- tables->mdl_request.set_type(MDL_EXCLUSIVE);
+ tables->mdl_request.set_type(MDL_SHARED_NO_WRITE);
}
;
@@ -12089,6 +12163,21 @@ table_ident:
}
;
+table_ident_opt_wild:
+ ident opt_wild
+ {
+ $$= new Table_ident($1);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | ident '.' ident opt_wild
+ {
+ $$= new Table_ident(YYTHD, $1,$3,0);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ ;
+
table_ident_nodb:
ident
{
@@ -14017,6 +14106,7 @@ view_tail:
TL_IGNORE,
MDL_EXCLUSIVE))
MYSQL_YYABORT;
+ lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB;
}
view_list_opt AS view_select
;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 6c456825aa1..69a01259fc0 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -145,7 +145,7 @@ static Sys_var_ulong Sys_pfs_max_mutex_instances(
"performance_schema_max_mutex_instances",
"Maximum number of instrumented MUTEX objects.",
READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_sizing),
- CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024),
DEFAULT(PFS_MAX_MUTEX),
BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
@@ -161,7 +161,7 @@ static Sys_var_ulong Sys_pfs_max_rwlock_instances(
"performance_schema_max_rwlock_instances",
"Maximum number of instrumented RWLOCK objects.",
READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_sizing),
- CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024),
DEFAULT(PFS_MAX_RWLOCK),
BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
@@ -1500,7 +1500,8 @@ static bool fix_read_only(sys_var *self, THD *thd, enum_var_type type)
can cause to wait on a read lock, it's required for the client application
to unlock everything, and acceptable for the server to wait on all locks.
*/
- if ((result= close_cached_tables(thd, NULL, FALSE, TRUE)))
+ if ((result= close_cached_tables(thd, NULL, TRUE,
+ thd->variables.lock_wait_timeout)))
goto end_with_read_lock;
if ((result= thd->global_read_lock.make_global_read_lock_block_commit(thd)))
@@ -1624,14 +1625,17 @@ static Sys_var_charptr Sys_socket(
READ_ONLY GLOBAL_VAR(mysqld_unix_port), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(0));
-#ifdef HAVE_THR_SETCONCURRENCY
+/*
+ thread_concurrency is a no-op on all platforms since
+ MySQL 5.1. It will be removed in the context of
+ WL#5265
+*/
static Sys_var_ulong Sys_thread_concurrency(
"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",
READ_ONLY GLOBAL_VAR(concurrency), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 512), DEFAULT(DEFAULT_CONCURRENCY), BLOCK_SIZE(1));
-#endif
static Sys_var_ulong Sys_thread_stack(
"thread_stack", "The stack size for each thread",
@@ -1677,19 +1681,13 @@ static Sys_var_ulong Sys_trans_prealloc_size(
static const char *thread_handling_names[]=
{
- "one-thread-per-connection", "no-threads",
-#if HAVE_POOL_OF_THREADS == 1
- "pool-of-threads",
-#endif
+ "one-thread-per-connection", "no-threads", "loaded-dynamically",
0
};
static Sys_var_enum Sys_thread_handling(
"thread_handling",
"Define threads usage for handling queries, one of "
- "one-thread-per-connection, no-threads"
-#if HAVE_POOL_OF_THREADS == 1
- ", pool-of-threads"
-#endif
+ "one-thread-per-connection, no-threads, loaded-dynamically"
, READ_ONLY GLOBAL_VAR(thread_handling), CMD_LINE(REQUIRED_ARG),
thread_handling_names, DEFAULT(0));
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index 9dc6890a84e..3db89b3b4fa 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -271,28 +271,28 @@ public:
deprecated_version, substitute)
{
option.var_type= GET_ENUM;
- global_var(uint)= def_val;
+ global_var(ulong)= def_val;
DBUG_ASSERT(def_val < typelib.count);
- DBUG_ASSERT(size == sizeof(uint));
+ DBUG_ASSERT(size == sizeof(ulong));
}
bool session_update(THD *thd, set_var *var)
{
- session_var(thd, uint)= var->save_result.ulonglong_value;
+ session_var(thd, ulong)= var->save_result.ulonglong_value;
return false;
}
bool global_update(THD *thd, set_var *var)
{
- global_var(uint)= var->save_result.ulonglong_value;
+ global_var(ulong)= var->save_result.ulonglong_value;
return false;
}
void session_save_default(THD *thd, set_var *var)
- { var->save_result.ulonglong_value= global_var(uint); }
+ { var->save_result.ulonglong_value= global_var(ulong); }
void global_save_default(THD *thd, set_var *var)
{ var->save_result.ulonglong_value= option.def_value; }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
- { return (uchar*)typelib.type_names[session_var(thd, uint)]; }
+ { return (uchar*)typelib.type_names[session_var(thd, ulong)]; }
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
- { return (uchar*)typelib.type_names[global_var(uint)]; }
+ { return (uchar*)typelib.type_names[global_var(ulong)]; }
};
/**
diff --git a/sql/table.cc b/sql/table.cc
index 67f49195b73..7d16ad7974e 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -34,6 +34,7 @@
#include <m_ctype.h>
#include "my_md5.h"
#include "sql_select.h"
+#include "mdl.h" // MDL_wait_for_graph_visitor
/* INFORMATION_SCHEMA name */
LEX_STRING INFORMATION_SCHEMA_NAME= {C_STRING_WITH_LEN("information_schema")};
@@ -325,6 +326,7 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
share->used_tables.empty();
share->free_tables.empty();
+ share->m_flush_tickets.empty();
memcpy((char*) &share->mem_root, (char*) &mem_root, sizeof(mem_root));
mysql_mutex_init(key_TABLE_SHARE_LOCK_ha_data,
@@ -389,52 +391,92 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
share->used_tables.empty();
share->free_tables.empty();
+ share->m_flush_tickets.empty();
DBUG_VOID_RETURN;
}
+/**
+ Release resources (plugins) used by the share and free its memory.
+ TABLE_SHARE is self-contained -- it's stored in its own MEM_ROOT.
+ Free this MEM_ROOT.
+*/
+
+void TABLE_SHARE::destroy()
+{
+ uint idx;
+ KEY *info_it;
+
+ /* The mutex is initialized only for shares that are part of the TDC */
+ if (tmp_table == NO_TMP_TABLE)
+ mysql_mutex_destroy(&LOCK_ha_data);
+ my_hash_free(&name_hash);
+
+ plugin_unlock(NULL, db_plugin);
+ db_plugin= NULL;
+
+ /* Release fulltext parsers */
+ info_it= key_info;
+ for (idx= keys; idx; idx--, info_it++)
+ {
+ if (info_it->flags & HA_USES_PARSER)
+ {
+ plugin_unlock(NULL, info_it->parser);
+ info_it->flags= 0;
+ }
+ }
+ /*
+ Make a copy since the share is allocated in its own root,
+ and free_root() updates its argument after freeing the memory.
+ */
+ MEM_ROOT own_root= mem_root;
+ free_root(&own_root, MYF(0));
+}
+
/*
Free table share and memory used by it
SYNOPSIS
free_table_share()
share Table share
-
- NOTES
- share->mutex must be locked when we come here if it's not a temp table
*/
void free_table_share(TABLE_SHARE *share)
{
- MEM_ROOT mem_root;
- uint idx;
- KEY *key_info;
DBUG_ENTER("free_table_share");
DBUG_PRINT("enter", ("table: %s.%s", share->db.str, share->table_name.str));
DBUG_ASSERT(share->ref_count == 0);
- /* The mutex is initialized only for shares that are part of the TDC */
- if (share->tmp_table == NO_TMP_TABLE)
- mysql_mutex_destroy(&share->LOCK_ha_data);
- my_hash_free(&share->name_hash);
-
- plugin_unlock(NULL, share->db_plugin);
- share->db_plugin= NULL;
-
- /* Release fulltext parsers */
- key_info= share->key_info;
- for (idx= share->keys; idx; idx--, key_info++)
+ if (share->m_flush_tickets.is_empty())
{
- if (key_info->flags & HA_USES_PARSER)
- {
- plugin_unlock(NULL, key_info->parser);
- key_info->flags= 0;
- }
+ /*
+ No threads are waiting for this share to be flushed (the
+ share is not old, is for a temporary table, or just nobody
+ happens to be waiting for it). Destroy it.
+ */
+ share->destroy();
+ }
+ else
+ {
+ Wait_for_flush_list::Iterator it(share->m_flush_tickets);
+ Wait_for_flush *ticket;
+ /*
+ We're about to iterate over a list that is used
+ concurrently. Make sure this never happens without a lock.
+ */
+ mysql_mutex_assert_owner(&LOCK_open);
+
+ while ((ticket= it++))
+ (void) ticket->get_ctx()->m_wait.set_status(MDL_wait::GRANTED);
+ /*
+ If there are threads waiting for this share to be flushed,
+ the last one to receive the notification will destroy the
+ share. At this point the share is removed from the table
+ definition cache, so is OK to proceed here without waiting
+ for this thread to do the work.
+ */
}
- /* We must copy mem_root from share because share is allocated through it */
- memcpy((char*) &mem_root, (char*) &share->mem_root, sizeof(mem_root));
- free_root(&mem_root, MYF(0)); // Free's share
DBUG_VOID_RETURN;
}
@@ -2995,6 +3037,225 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
}
+/**
+ Traverse portion of wait-for graph which is reachable through edge
+ represented by this flush ticket in search for deadlocks.
+
+ @retval TRUE A deadlock is found. A victim is remembered
+ by the visitor.
+ @retval FALSE Success, no deadlocks.
+*/
+
+bool Wait_for_flush::accept_visitor(MDL_wait_for_graph_visitor *gvisitor)
+{
+ return m_share->visit_subgraph(this, gvisitor);
+}
+
+
+uint Wait_for_flush::get_deadlock_weight() const
+{
+ return m_deadlock_weight;
+}
+
+
+/**
+ Traverse portion of wait-for graph which is reachable through this
+ table share in search for deadlocks.
+
+ @param waiting_ticket Ticket representing wait for this share.
+ @param dvisitor Deadlock detection visitor.
+
+ @retval TRUE A deadlock is found. A victim is remembered
+ by the visitor.
+ @retval FALSE No deadlocks, it's OK to begin wait.
+*/
+
+bool TABLE_SHARE::visit_subgraph(Wait_for_flush *wait_for_flush,
+ MDL_wait_for_graph_visitor *gvisitor)
+{
+ TABLE *table;
+ MDL_context *src_ctx= wait_for_flush->get_ctx();
+ bool result= TRUE;
+
+ /*
+ To protect used_tables list from being concurrently modified
+ while we are iterating through it we acquire LOCK_open.
+ This does not introduce deadlocks in the deadlock detector
+ because we won't try to acquire LOCK_open while
+ holding a write-lock on MDL_lock::m_rwlock.
+ */
+ if (gvisitor->m_lock_open_count++ == 0)
+ {
+ /*
+ To circumvent bug #56405 "Deadlock in the MDL deadlock detector"
+ we don't try to lock LOCK_open mutex if some thread doing
+ deadlock detection already owns it and current search depth is
+ greater than 0. Instead we report a deadlock.
+
+ TODO/FIXME: The proper fix for this bug is to use rwlocks for
+ protection of table shares/instead of LOCK_open.
+ Unfortunately it requires more effort/has significant
+ performance effect.
+ */
+ mysql_mutex_lock(&LOCK_dd_owns_lock_open);
+ if (gvisitor->m_current_search_depth > 0 && dd_owns_lock_open > 0)
+ {
+ mysql_mutex_unlock(&LOCK_dd_owns_lock_open);
+ --gvisitor->m_lock_open_count;
+ gvisitor->abort_traversal(src_ctx);
+ return TRUE;
+ }
+ ++dd_owns_lock_open;
+ mysql_mutex_unlock(&LOCK_dd_owns_lock_open);
+ mysql_mutex_lock(&LOCK_open);
+ }
+
+ I_P_List_iterator <TABLE, TABLE_share> tables_it(used_tables);
+
+ /*
+ In case of multiple searches running in parallel, avoid going
+ over the same loop twice and shortcut the search.
+ Do it after taking the lock to weed out unnecessary races.
+ */
+ if (src_ctx->m_wait.get_status() != MDL_wait::EMPTY)
+ {
+ result= FALSE;
+ goto end;
+ }
+
+ ++gvisitor->m_current_search_depth;
+ if (gvisitor->enter_node(src_ctx))
+ {
+ --gvisitor->m_current_search_depth;
+ goto end;
+ }
+
+ while ((table= tables_it++))
+ {
+ if (gvisitor->inspect_edge(&table->in_use->mdl_context))
+ {
+ goto end_leave_node;
+ }
+ }
+
+ tables_it.rewind();
+ while ((table= tables_it++))
+ {
+ if (table->in_use->mdl_context.visit_subgraph(gvisitor))
+ {
+ goto end_leave_node;
+ }
+ }
+
+ result= FALSE;
+
+end_leave_node:
+ gvisitor->leave_node(src_ctx);
+ --gvisitor->m_current_search_depth;
+
+end:
+ if (gvisitor->m_lock_open_count-- == 1)
+ {
+ mysql_mutex_unlock(&LOCK_open);
+ mysql_mutex_lock(&LOCK_dd_owns_lock_open);
+ --dd_owns_lock_open;
+ mysql_mutex_unlock(&LOCK_dd_owns_lock_open);
+ }
+
+ return result;
+}
+
+
+/**
+ Wait until the subject share is removed from the table
+ definition cache and make sure it's destroyed.
+
+ @param mdl_context MDL context for thread which is going to wait.
+ @param abstime Timeout for waiting as absolute time value.
+ @param deadlock_weight Weight of this wait for deadlock detector.
+
+ @pre LOCK_open is write locked, the share is used (has
+ non-zero reference count), is marked for flush and
+ this connection does not reference the share.
+ LOCK_open will be unlocked temporarily during execution.
+
+ @retval FALSE - Success.
+ @retval TRUE - Error (OOM, deadlock, timeout, etc...).
+*/
+
+bool TABLE_SHARE::wait_for_old_version(THD *thd, struct timespec *abstime,
+ uint deadlock_weight)
+{
+ MDL_context *mdl_context= &thd->mdl_context;
+ Wait_for_flush ticket(mdl_context, this, deadlock_weight);
+ MDL_wait::enum_wait_status wait_status;
+
+ mysql_mutex_assert_owner(&LOCK_open);
+ /*
+ We should enter this method only when share's version is not
+ up to date and the share is referenced. Otherwise our
+ thread will never be woken up from wait.
+ */
+ DBUG_ASSERT(version != refresh_version && ref_count != 0);
+
+ m_flush_tickets.push_front(&ticket);
+
+ mdl_context->m_wait.reset_status();
+
+ mysql_mutex_unlock(&LOCK_open);
+
+ mdl_context->will_wait_for(&ticket);
+
+ mdl_context->find_deadlock();
+
+ wait_status= mdl_context->m_wait.timed_wait(thd, abstime, TRUE,
+ "Waiting for table flush");
+
+ mdl_context->done_waiting_for();
+
+ mysql_mutex_lock(&LOCK_open);
+
+ m_flush_tickets.remove(&ticket);
+
+ if (m_flush_tickets.is_empty() && ref_count == 0)
+ {
+ /*
+ If our thread was the last one using the share,
+ we must destroy it here.
+ */
+ destroy();
+ }
+
+ /*
+ In cases when our wait was aborted by KILL statement,
+ a deadlock or a timeout, the share might still be referenced,
+ so we don't delete it. Note, that we can't determine this
+ condition by checking wait_status alone, since, for example,
+ a timeout can happen after all references to the table share
+ were released, but before the share is removed from the
+ cache and we receive the notification. This is why
+ we first destroy the share, and then look at
+ wait_status.
+ */
+ switch (wait_status)
+ {
+ case MDL_wait::GRANTED:
+ return FALSE;
+ case MDL_wait::VICTIM:
+ my_error(ER_LOCK_DEADLOCK, MYF(0));
+ return TRUE;
+ case MDL_wait::TIMEOUT:
+ my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
+ return TRUE;
+ case MDL_wait::KILLED:
+ return TRUE;
+ default:
+ DBUG_ASSERT(0);
+ return TRUE;
+ }
+}
+
+
/*
Create Item_field for each column in the table.
diff --git a/sql/table.h b/sql/table.h
index 7579a8a6df3..45b9aa3e699 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -43,7 +43,6 @@ class Security_context;
struct TABLE_LIST;
class ACL_internal_schema_access;
class ACL_internal_table_access;
-struct TABLE_LIST;
class Field;
/*
@@ -205,7 +204,6 @@ typedef struct st_order {
struct st_order *next;
Item **item; /* Point at item in select fields */
Item *item_ptr; /* Storage for initial item */
- Item **item_copy; /* For SPs; the original item ptr */
int counter; /* position in SELECT list, correct
only if counter_used is true*/
bool asc; /* true if ascending */
@@ -508,7 +506,46 @@ public:
};
-/*
+/**
+ Class representing the fact that some thread waits for table
+ share to be flushed. Is used to represent information about
+ such waits in MDL deadlock detector.
+*/
+
+class Wait_for_flush : public MDL_wait_for_subgraph
+{
+ MDL_context *m_ctx;
+ TABLE_SHARE *m_share;
+ uint m_deadlock_weight;
+public:
+ Wait_for_flush(MDL_context *ctx_arg, TABLE_SHARE *share_arg,
+ uint deadlock_weight_arg)
+ : m_ctx(ctx_arg), m_share(share_arg),
+ m_deadlock_weight(deadlock_weight_arg)
+ {}
+
+ MDL_context *get_ctx() const { return m_ctx; }
+
+ virtual bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor);
+
+ virtual uint get_deadlock_weight() const;
+
+ /**
+ Pointers for participating in the list of waiters for table share.
+ */
+ Wait_for_flush *next_in_share;
+ Wait_for_flush **prev_in_share;
+};
+
+
+typedef I_P_List <Wait_for_flush,
+ I_P_List_adapter<Wait_for_flush,
+ &Wait_for_flush::next_in_share,
+ &Wait_for_flush::prev_in_share> >
+ Wait_for_flush_list;
+
+
+/**
This structure is shared between different table objects. There is one
instance of table share per one table in the database.
*/
@@ -662,6 +699,11 @@ struct TABLE_SHARE
/** Instrumentation for this table share. */
PSI_table_share *m_psi;
+ /**
+ List of tickets representing threads waiting for the share to be flushed.
+ */
+ Wait_for_flush_list m_flush_tickets;
+
/*
Set share's table cache key and update its db and table name appropriately.
@@ -731,10 +773,8 @@ struct TABLE_SHARE
}
- /*
- Must all TABLEs be reopened?
- */
- inline bool needs_reopen() const
+ /** Is this table share being expelled from the table definition cache? */
+ inline bool has_old_version() const
{
return version != refresh_version;
}
@@ -837,6 +877,13 @@ struct TABLE_SHARE
return (tmp_table == SYSTEM_TMP_TABLE || is_view) ? 0 : table_map_id;
}
+ bool visit_subgraph(Wait_for_flush *waiting_ticket,
+ MDL_wait_for_graph_visitor *gvisitor);
+
+ bool wait_for_old_version(THD *thd, struct timespec *abstime,
+ uint deadlock_weight);
+ /** Release resources and free memory occupied by the table share. */
+ void destroy();
};
@@ -1084,9 +1131,7 @@ public:
read_set= &def_read_set;
write_set= &def_write_set;
}
- /*
- Is this instance of the table should be reopen?
- */
+ /** Should this instance of the table be reopened? */
inline bool needs_reopen()
{ return !db_stat || m_needs_reopen; }
@@ -1588,23 +1633,6 @@ struct TABLE_LIST
/* Don't associate a table share. */
OPEN_STUB
} open_strategy;
- /**
- Indicates the locking strategy for the object being opened.
- */
- enum
- {
- /*
- Take metadata lock specified by 'mdl_request' member before
- the object is opened. Do nothing after that.
- */
- OTLS_NONE= 0,
- /*
- Take (exclusive) metadata lock specified by 'mdl_request' member
- before object is opened. If opening is successful, downgrade to
- a shared lock.
- */
- OTLS_DOWNGRADE_IF_EXISTS
- } lock_strategy;
/* For transactional locking. */
int lock_timeout; /* NOWAIT or WAIT [X] */
bool lock_transactional; /* If transactional lock requested. */
diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
index 537d5f51184..2549589b0c7 100644
--- a/storage/innobase/btr/btr0cur.c
+++ b/storage/innobase/btr/btr0cur.c
@@ -3153,6 +3153,7 @@ btr_cur_add_path_info(
{
btr_path_t* slot;
rec_t* rec;
+ page_t* page;
ut_a(cursor->path_arr);
@@ -3175,8 +3176,155 @@ btr_cur_add_path_info(
slot = cursor->path_arr + (root_height - height);
+ page = page_align(rec);
+
slot->nth_rec = page_rec_get_n_recs_before(rec);
- slot->n_recs = page_get_n_recs(page_align(rec));
+ slot->n_recs = page_get_n_recs(page);
+ slot->page_no = page_get_page_no(page);
+ slot->page_level = btr_page_get_level_low(page);
+}
+
+/*******************************************************************//**
+Estimate the number of rows between slot1 and slot2 for any level on a
+B-tree. This function starts from slot1->page and reads a few pages to
+the right, counting their records. If we reach slot2->page quickly then
+we know exactly how many records there are between slot1 and slot2 and
+we set is_n_rows_exact to TRUE. If we cannot reach slot2->page quickly
+then we calculate the average number of records in the pages scanned
+so far and assume that all pages that we did not scan up to slot2->page
+contain the same number of records, then we multiply that average to
+the number of pages between slot1->page and slot2->page (which is
+n_rows_on_prev_level). In this case we set is_n_rows_exact to FALSE.
+@return number of rows (exact or estimated) */
+static
+ib_int64_t
+btr_estimate_n_rows_in_range_on_level(
+/*==================================*/
+ dict_index_t* index, /*!< in: index */
+ btr_path_t* slot1, /*!< in: left border */
+ btr_path_t* slot2, /*!< in: right border */
+ ib_int64_t n_rows_on_prev_level, /*!< in: number of rows
+ on the previous level for the
+ same descend paths; used to
+ determine the numbe of pages
+ on this level */
+ ibool* is_n_rows_exact) /*!< out: TRUE if the returned
+ value is exact i.e. not an
+ estimation */
+{
+ ulint space;
+ ib_int64_t n_rows;
+ ulint n_pages_read;
+ ulint page_no;
+ ulint zip_size;
+ ulint level;
+
+ space = dict_index_get_space(index);
+
+ n_rows = 0;
+ n_pages_read = 0;
+
+ /* Assume by default that we will scan all pages between
+ slot1->page_no and slot2->page_no */
+ *is_n_rows_exact = TRUE;
+
+ /* add records from slot1->page_no which are to the right of
+ the record which serves as a left border of the range, if any */
+ if (slot1->nth_rec < slot1->n_recs) {
+ n_rows += slot1->n_recs - slot1->nth_rec;
+ }
+
+ /* add records from slot2->page_no which are to the left of
+ the record which servers as a right border of the range, if any */
+ if (slot2->nth_rec > 1) {
+ n_rows += slot2->nth_rec - 1;
+ }
+
+ /* count the records in the pages between slot1->page_no and
+ slot2->page_no (non inclusive), if any */
+
+ zip_size = fil_space_get_zip_size(space);
+
+ /* Do not read more than this number of pages in order not to hurt
+ performance with this code which is just an estimation. If we read
+ this many pages before reaching slot2->page_no then we estimate the
+ average from the pages scanned so far */
+ #define N_PAGES_READ_LIMIT 10
+
+ page_no = slot1->page_no;
+ level = slot1->page_level;
+
+ do {
+ mtr_t mtr;
+ page_t* page;
+ buf_block_t* block;
+
+ mtr_start(&mtr);
+
+ /* fetch the page */
+ block = buf_page_get(space, zip_size, page_no, RW_S_LATCH,
+ &mtr);
+
+ page = buf_block_get_frame(block);
+
+ /* It is possible that the tree has been reorganized in the
+ meantime and this is a different page. If this happens the
+ calculated estimate will be bogus, which is not fatal as
+ this is only an estimate. We are sure that a page with
+ page_no exists because InnoDB never frees pages, only
+ reuses them. */
+ if (fil_page_get_type(page) != FIL_PAGE_INDEX
+ || btr_page_get_index_id(page) != index->id
+ || btr_page_get_level_low(page) != level) {
+
+ /* The page got reused for something else */
+ goto inexact;
+ }
+
+ n_pages_read++;
+
+ if (page_no != slot1->page_no) {
+ /* Do not count the records on slot1->page_no,
+ we already counted them before this loop. */
+ n_rows += page_get_n_recs(page);
+ }
+
+ page_no = btr_page_get_next(page, &mtr);
+
+ mtr_commit(&mtr);
+
+ if (n_pages_read == N_PAGES_READ_LIMIT
+ || page_no == FIL_NULL) {
+ /* Either we read too many pages or
+ we reached the end of the level without passing
+ through slot2->page_no, the tree must have changed
+ in the meantime */
+ goto inexact;
+ }
+
+ } while (page_no != slot2->page_no);
+
+ return(n_rows);
+
+inexact:
+
+ *is_n_rows_exact = FALSE;
+
+ /* We did interrupt before reaching slot2->page */
+
+ if (n_pages_read > 0) {
+ /* The number of pages on this level is
+ n_rows_on_prev_level, multiply it by the
+ average number of recs per page so far */
+ n_rows = n_rows_on_prev_level
+ * n_rows / n_pages_read;
+ } else {
+ /* The tree changed before we could even
+ start with slot1->page_no */
+ n_rows = 10;
+ }
+
+ return(n_rows);
}
/*******************************************************************//**
@@ -3201,6 +3349,7 @@ btr_estimate_n_rows_in_range(
ibool diverged_lot;
ulint divergence_level;
ib_int64_t n_rows;
+ ibool is_n_rows_exact;
ulint i;
mtr_t mtr;
@@ -3243,6 +3392,7 @@ btr_estimate_n_rows_in_range(
/* We have the path information for the range in path1 and path2 */
n_rows = 1;
+ is_n_rows_exact = TRUE;
diverged = FALSE; /* This becomes true when the path is not
the same any more */
diverged_lot = FALSE; /* This becomes true when the paths are
@@ -3258,7 +3408,7 @@ btr_estimate_n_rows_in_range(
if (slot1->nth_rec == ULINT_UNDEFINED
|| slot2->nth_rec == ULINT_UNDEFINED) {
- if (i > divergence_level + 1) {
+ if (i > divergence_level + 1 && !is_n_rows_exact) {
/* In trees whose height is > 1 our algorithm
tends to underestimate: multiply the estimate
by 2: */
@@ -3270,7 +3420,9 @@ btr_estimate_n_rows_in_range(
to over 1 / 2 of the estimated rows in the whole
table */
- if (n_rows > index->table->stat_n_rows / 2) {
+ if (n_rows > index->table->stat_n_rows / 2
+ && !is_n_rows_exact) {
+
n_rows = index->table->stat_n_rows / 2;
/* If there are just 0 or 1 rows in the table,
@@ -3296,10 +3448,15 @@ btr_estimate_n_rows_in_range(
divergence_level = i;
}
} else {
- /* Maybe the tree has changed between
- searches */
-
- return(10);
+ /* It is possible that
+ slot1->nth_rec >= slot2->nth_rec
+ if, for example, we have a single page
+ tree which contains (inf, 5, 6, supr)
+ and we select where x > 20 and x < 30;
+ in this case slot1->nth_rec will point
+ to the supr record and slot2->nth_rec
+ will point to 6 */
+ n_rows = 0;
}
} else if (diverged && !diverged_lot) {
@@ -3323,8 +3480,9 @@ btr_estimate_n_rows_in_range(
}
} else if (diverged_lot) {
- n_rows = (n_rows * (slot1->n_recs + slot2->n_recs))
- / 2;
+ n_rows = btr_estimate_n_rows_in_range_on_level(
+ index, slot1, slot2, n_rows,
+ &is_n_rows_exact);
}
}
}
diff --git a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
index 06cc48c7c60..fb667bcae82 100644
--- a/storage/innobase/btr/btr0sea.c
+++ b/storage/innobase/btr/btr0sea.c
@@ -1746,6 +1746,7 @@ function_exit:
}
}
+#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/********************************************************************//**
Validates the search system.
@return TRUE if ok */
@@ -1913,3 +1914,4 @@ btr_search_validate(void)
return(ok);
}
+#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
index 3737627301f..7b51fc60fcc 100644
--- a/storage/innobase/buf/buf0flu.c
+++ b/storage/innobase/buf/buf0flu.c
@@ -43,6 +43,8 @@ Created 11/11/1995 Heikki Tuuri
#include "log0log.h"
#include "os0file.h"
#include "trx0sys.h"
+#include "mysql/plugin.h"
+#include "mysql/service_thd_wait.h"
/**********************************************************************
These statistics are generated for heuristics used in estimating the
@@ -1248,8 +1250,12 @@ buf_flush_try_neighbors(
/*====================*/
ulint space, /*!< in: space id */
ulint offset, /*!< in: page offset */
- enum buf_flush flush_type) /*!< in: BUF_FLUSH_LRU or
+ enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU or
BUF_FLUSH_LIST */
+ ulint n_flushed, /*!< in: number of pages
+ flushed so far in this batch */
+ ulint n_to_flush) /*!< in: maximum number of pages
+ we are allowed to flush */
{
ulint i;
ulint low;
@@ -1290,6 +1296,21 @@ buf_flush_try_neighbors(
buf_page_t* bpage;
+ if ((count + n_flushed) >= n_to_flush) {
+
+ /* We have already flushed enough pages and
+ should call it a day. There is, however, one
+ exception. If the page whose neighbors we
+ are flushing has not been flushed yet then
+ we'll try to flush the victim that we
+ selected originally. */
+ if (i <= offset) {
+ i = offset;
+ } else {
+ break;
+ }
+ }
+
buf_pool = buf_pool_get(space, i);
buf_pool_mutex_enter(buf_pool);
@@ -1357,6 +1378,8 @@ buf_flush_page_and_try_neighbors(
buf_page_in_file(bpage) */
enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU
or BUF_FLUSH_LIST */
+ ulint n_to_flush, /*!< in: number of pages to
+ flush */
ulint* count) /*!< in/out: number of pages
flushed */
{
@@ -1390,7 +1413,11 @@ buf_flush_page_and_try_neighbors(
mutex_exit(block_mutex);
/* Try to flush also all the neighbors */
- *count += buf_flush_try_neighbors(space, offset, flush_type);
+ *count += buf_flush_try_neighbors(space,
+ offset,
+ flush_type,
+ *count,
+ n_to_flush);
buf_pool_mutex_enter(buf_pool);
flushed = TRUE;
@@ -1430,7 +1457,7 @@ buf_flush_LRU_list_batch(
a page that isn't ready for flushing. */
while (bpage != NULL
&& !buf_flush_page_and_try_neighbors(
- bpage, BUF_FLUSH_LRU, &count)) {
+ bpage, BUF_FLUSH_LRU, max, &count)) {
bpage = UT_LIST_GET_PREV(LRU, bpage);
}
@@ -1511,7 +1538,7 @@ buf_flush_flush_list_batch(
while (bpage != NULL
&& len > 0
&& !buf_flush_page_and_try_neighbors(
- bpage, BUF_FLUSH_LIST, &count)) {
+ bpage, BUF_FLUSH_LIST, min_n, &count)) {
buf_flush_list_mutex_enter(buf_pool);
@@ -1719,10 +1746,14 @@ buf_flush_wait_batch_end(
buf_pool = buf_pool_from_array(i);
+ thd_wait_begin(NULL, THD_WAIT_DISKIO);
os_event_wait(buf_pool->no_flush[type]);
+ thd_wait_end(NULL);
}
} else {
+ thd_wait_begin(NULL, THD_WAIT_DISKIO);
os_event_wait(buf_pool->no_flush[type]);
+ thd_wait_end(NULL);
}
}
diff --git a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
index 99a56bf91bc..82b45172988 100644
--- a/storage/innobase/buf/buf0rea.c
+++ b/storage/innobase/buf/buf0rea.c
@@ -37,6 +37,8 @@ Created 11/5/1995 Heikki Tuuri
#include "os0file.h"
#include "srv0start.h"
#include "srv0srv.h"
+#include "mysql/plugin.h"
+#include "mysql/service_thd_wait.h"
/** The linear read-ahead area size */
#define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA
@@ -135,6 +137,7 @@ buf_read_page_low(
ut_ad(buf_page_in_file(bpage));
+ thd_wait_begin(NULL, THD_WAIT_DISKIO);
if (zip_size) {
*err = fil_io(OS_FILE_READ | wake_later,
sync, space, zip_size, offset, 0, zip_size,
@@ -146,6 +149,7 @@ buf_read_page_low(
sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
((buf_block_t*) bpage)->frame, bpage);
}
+ thd_wait_end(NULL);
ut_a(*err == DB_SUCCESS);
if (sync) {
diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
index 20a18c72a39..6bd15f0556a 100644
--- a/storage/innobase/dict/dict0load.c
+++ b/storage/innobase/dict/dict0load.c
@@ -1175,23 +1175,23 @@ static const char* dict_load_index_id_err = "SYS_INDEXES.TABLE_ID mismatch";
/********************************************************************//**
Loads an index definition from a SYS_INDEXES record to dict_index_t.
-If "cached" is set to "TRUE", we will create a dict_index_t structure
-and fill it accordingly. Otherwise, the dict_index_t will
-be supplied by the caller and filled with information read from
-the record.
-@return error message, or NULL on success */
+If allocate=TRUE, we will create a dict_index_t structure and fill it
+accordingly. If allocated=FALSE, the dict_index_t will be supplied by
+the caller and filled with information read from the record. @return
+error message, or NULL on success */
UNIV_INTERN
const char*
dict_load_index_low(
/*================*/
byte* table_id, /*!< in/out: table id (8 bytes),
- an "in" value if cached=TRUE
- and "out" when cached=FALSE */
+ an "in" value if allocate=TRUE
+ and "out" when allocate=FALSE */
const char* table_name, /*!< in: table name */
mem_heap_t* heap, /*!< in/out: temporary memory heap */
const rec_t* rec, /*!< in: SYS_INDEXES record */
- ibool cached, /*!< in: TRUE = add to cache,
- FALSE = do not */
+ ibool allocate, /*!< in: TRUE=allocate *index,
+ FALSE=fill in a pre-allocated
+ *index */
dict_index_t** index) /*!< out,own: index, or NULL */
{
const byte* field;
@@ -1203,8 +1203,8 @@ dict_load_index_low(
ulint type;
ulint space;
- if (cached) {
- /* If "cached" is set to TRUE, no dict_index_t will
+ if (allocate) {
+ /* If allocate=TRUE, no dict_index_t will
be supplied. Initialize "*index" to NULL */
*index = NULL;
}
@@ -1223,7 +1223,7 @@ err_len:
return("incorrect column length in SYS_INDEXES");
}
- if (!cached) {
+ if (!allocate) {
/* We are reading a SYS_INDEXES record. Copy the table_id */
memcpy(table_id, (const char*)field, 8);
} else if (memcmp(field, table_id, 8)) {
@@ -1279,7 +1279,7 @@ err_len:
goto err_len;
}
- if (cached) {
+ if (allocate) {
*index = dict_mem_index_create(table_name, name_buf,
space, type, n_fields);
} else {
diff --git a/storage/innobase/ha/ha0ha.c b/storage/innobase/ha/ha0ha.c
index f9e798012f8..7f11917de0a 100644
--- a/storage/innobase/ha/ha0ha.c
+++ b/storage/innobase/ha/ha0ha.c
@@ -354,6 +354,7 @@ ha_remove_all_nodes_to_page(
#endif
}
+#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/*************************************************************//**
Validates a given range of the cells in hash table.
@return TRUE if ok */
@@ -400,6 +401,7 @@ ha_validate(
return(ok);
}
+#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
/*************************************************************//**
Prints info of a hash table. */
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index ab9df9a0272..a004cba9603 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -425,7 +425,7 @@ static MYSQL_THDVAR_BOOL(table_locks, PLUGIN_VAR_OPCMDARG,
static MYSQL_THDVAR_BOOL(strict_mode, PLUGIN_VAR_OPCMDARG,
"Use strict mode when evaluating create options.",
- NULL, NULL, TRUE);
+ NULL, NULL, FALSE);
static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG,
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
@@ -807,6 +807,20 @@ thd_lock_wait_timeout(
return(THDVAR((THD*) thd, lock_wait_timeout));
}
+/******************************************************************//**
+Set the time waited for the lock for the current query. */
+extern "C" UNIV_INTERN
+void
+thd_set_lock_wait_time(
+/*===================*/
+ void* thd, /*!< in: thread handle (THD*) */
+ ulint value) /*!< in: time waited for the lock */
+{
+ if (thd) {
+ thd_storage_lock_wait((THD*)thd, value);
+ }
+}
+
/********************************************************************//**
Obtain the InnoDB transaction of a MySQL thread.
@return reference to transaction pointer */
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
index dc8e61e5070..a048de0e884 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
@@ -55,6 +55,7 @@ Created 7/19/1997 Heikki Tuuri
#include "lock0lock.h"
#include "log0recv.h"
#include "que0que.h"
+#include "srv0start.h" /* srv_shutdown_state */
/* STRUCTURE OF AN INSERT BUFFER RECORD
@@ -395,8 +396,10 @@ ibuf_tree_root_get(
mtr_t* mtr) /*!< in: mtr */
{
buf_block_t* block;
+ page_t* root;
ut_ad(ibuf_inside());
+ ut_ad(mutex_own(&ibuf_mutex));
mtr_x_lock(dict_index_get_lock(ibuf->index), mtr);
@@ -405,7 +408,13 @@ ibuf_tree_root_get(
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
- return(buf_block_get_frame(block));
+ root = buf_block_get_frame(block);
+
+ ut_ad(page_get_space_id(root) == IBUF_SPACE_ID);
+ ut_ad(page_get_page_no(root) == FSP_IBUF_TREE_ROOT_PAGE_NO);
+ ut_ad(ibuf->empty == (page_get_n_recs(root) == 0));
+
+ return(root);
}
#ifdef UNIV_IBUF_COUNT_DEBUG
@@ -482,8 +491,6 @@ ibuf_size_update(
/* the '1 +' is the ibuf header page */
ibuf->size = ibuf->seg_size - (1 + ibuf->free_list_len);
-
- ibuf->empty = page_get_n_recs(root) == 0;
}
/******************************************************************//**
@@ -554,6 +561,7 @@ ibuf_init_at_db_start(void)
ibuf_size_update(root, &mtr);
mutex_exit(&ibuf_mutex);
+ ibuf->empty = (page_get_n_recs(root) == 0);
mtr_commit(&mtr);
ibuf_exit();
@@ -1350,10 +1358,18 @@ ibuf_add_ops(
const ulint* ops) /*!< in: operation counts */
{
+#ifndef HAVE_ATOMIC_BUILTINS
+ ut_ad(mutex_own(&ibuf_mutex));
+#endif /* !HAVE_ATOMIC_BUILTINS */
+
ulint i;
for (i = 0; i < IBUF_OP_COUNT; i++) {
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_atomic_increment_ulint(&arr[i], ops[i]);
+#else /* HAVE_ATOMIC_BUILTINS */
arr[i] += ops[i];
+#endif /* HAVE_ATOMIC_BUILTINS */
}
}
@@ -2017,9 +2033,9 @@ ibuf_data_too_much_free(void)
/*********************************************************************//**
Allocates a new page from the ibuf file segment and adds it to the free
list.
-@return DB_SUCCESS, or DB_STRONG_FAIL if no space left */
+@return TRUE on success, FALSE if no space left */
static
-ulint
+ibool
ibuf_add_free_page(void)
/*====================*/
{
@@ -2055,10 +2071,10 @@ ibuf_add_free_page(void)
header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, 0, FSP_UP,
&mtr);
- if (page_no == FIL_NULL) {
+ if (UNIV_UNLIKELY(page_no == FIL_NULL)) {
mtr_commit(&mtr);
- return(DB_STRONG_FAIL);
+ return(FALSE);
}
{
@@ -2096,16 +2112,16 @@ ibuf_add_free_page(void)
bitmap_page = ibuf_bitmap_get_map_page(
IBUF_SPACE_ID, page_no, zip_size, &mtr);
+ mutex_exit(&ibuf_mutex);
+
ibuf_bitmap_page_set_bits(
bitmap_page, page_no, zip_size, IBUF_BITMAP_IBUF, TRUE, &mtr);
mtr_commit(&mtr);
- mutex_exit(&ibuf_mutex);
-
ibuf_exit();
- return(DB_SUCCESS);
+ return(TRUE);
}
/*********************************************************************//**
@@ -2135,20 +2151,17 @@ ibuf_remove_free_page(void)
header_page = ibuf_header_page_get(&mtr);
/* Prevent pessimistic inserts to insert buffer trees for a while */
- mutex_enter(&ibuf_pessimistic_insert_mutex);
-
ibuf_enter();
-
+ mutex_enter(&ibuf_pessimistic_insert_mutex);
mutex_enter(&ibuf_mutex);
if (!ibuf_data_too_much_free()) {
mutex_exit(&ibuf_mutex);
+ mutex_exit(&ibuf_pessimistic_insert_mutex);
ibuf_exit();
- mutex_exit(&ibuf_pessimistic_insert_mutex);
-
mtr_commit(&mtr);
return;
@@ -2158,6 +2171,8 @@ ibuf_remove_free_page(void)
root = ibuf_tree_root_get(&mtr2);
+ mutex_exit(&ibuf_mutex);
+
page_no = flst_get_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
&mtr2).page;
@@ -2166,7 +2181,6 @@ ibuf_remove_free_page(void)
is a level 2 page. */
mtr_commit(&mtr2);
- mutex_exit(&ibuf_mutex);
ibuf_exit();
@@ -2209,17 +2223,19 @@ ibuf_remove_free_page(void)
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
+ mutex_exit(&ibuf_pessimistic_insert_mutex);
+
ibuf->seg_size--;
ibuf->free_list_len--;
- mutex_exit(&ibuf_pessimistic_insert_mutex);
-
/* Set the bit indicating that this page is no more an ibuf tree page
(level 2 page) */
bitmap_page = ibuf_bitmap_get_map_page(
IBUF_SPACE_ID, page_no, zip_size, &mtr);
+ mutex_exit(&ibuf_mutex);
+
ibuf_bitmap_page_set_bits(
bitmap_page, page_no, zip_size, IBUF_BITMAP_IBUF, FALSE, &mtr);
@@ -2228,8 +2244,6 @@ ibuf_remove_free_page(void)
#endif
mtr_commit(&mtr);
- mutex_exit(&ibuf_mutex);
-
ibuf_exit();
}
@@ -2270,17 +2284,16 @@ ibuf_free_excess_pages(void)
for (i = 0; i < 4; i++) {
- mutex_enter(&ibuf_mutex);
-
- if (!ibuf_data_too_much_free()) {
+ ibool too_much_free;
- mutex_exit(&ibuf_mutex);
+ mutex_enter(&ibuf_mutex);
+ too_much_free = ibuf_data_too_much_free();
+ mutex_exit(&ibuf_mutex);
+ if (!too_much_free) {
return;
}
- mutex_exit(&ibuf_mutex);
-
ibuf_remove_free_page();
}
}
@@ -2476,18 +2489,20 @@ ibuf_contract_ext(
ulint page_nos[IBUF_MAX_N_PAGES_MERGED];
ulint space_ids[IBUF_MAX_N_PAGES_MERGED];
ib_int64_t space_versions[IBUF_MAX_N_PAGES_MERGED];
- ulint n_stored;
ulint sum_sizes;
mtr_t mtr;
*n_pages = 0;
ut_ad(!ibuf_inside());
- mutex_enter(&ibuf_mutex);
+ /* We perform a dirty read of ibuf->empty, without latching
+ the insert buffer root page. We trust this dirty read except
+ when a slow shutdown is being executed. During a slow
+ shutdown, the insert buffer merge must be completed. */
- if (ibuf->empty) {
+ if (UNIV_UNLIKELY(ibuf->empty)
+ && UNIV_LIKELY(!srv_shutdown_state)) {
ibuf_is_empty:
- mutex_exit(&ibuf_mutex);
#if 0 /* TODO */
if (srv_shutdown_state) {
@@ -2519,13 +2534,14 @@ ibuf_is_empty:
ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
if (page_get_n_recs(btr_pcur_get_page(&pcur)) == 0) {
- /* When the ibuf tree is emptied completely, the last record
- is removed using an optimistic delete and ibuf_size_update
- is not called, causing ibuf->empty to remain FALSE. If we do
- not reset it to TRUE here then database shutdown will hang
- in the loop in ibuf_contract_for_n_pages. */
-
- ibuf->empty = TRUE;
+ /* If a B-tree page is empty, it must be the root page
+ and the whole B-tree must be empty. InnoDB does not
+ allow empty B-tree pages other than the root. */
+ ut_ad(ibuf->empty);
+ ut_ad(page_get_space_id(btr_pcur_get_page(&pcur))
+ == IBUF_SPACE_ID);
+ ut_ad(page_get_page_no(btr_pcur_get_page(&pcur))
+ == FSP_IBUF_TREE_ROOT_PAGE_NO);
ibuf_exit();
@@ -2535,14 +2551,12 @@ ibuf_is_empty:
goto ibuf_is_empty;
}
- mutex_exit(&ibuf_mutex);
-
sum_sizes = ibuf_get_merge_page_nos(TRUE, btr_pcur_get_rec(&pcur),
space_ids, space_versions,
- page_nos, &n_stored);
+ page_nos, n_pages);
#if 0 /* defined UNIV_IBUF_DEBUG */
fprintf(stderr, "Ibuf contract sync %lu pages %lu volume %lu\n",
- sync, n_stored, sum_sizes);
+ sync, *n_pages, sum_sizes);
#endif
ibuf_exit();
@@ -2550,8 +2564,7 @@ ibuf_is_empty:
btr_pcur_close(&pcur);
buf_read_ibuf_merge_pages(sync, space_ids, space_versions, page_nos,
- n_stored);
- *n_pages = n_stored;
+ *n_pages);
return(sum_sizes + 1);
}
@@ -2621,33 +2634,33 @@ ibuf_contract_after_insert(
ibool sync;
ulint sum_sizes;
ulint size;
-
- mutex_enter(&ibuf_mutex);
-
- if (ibuf->size < ibuf->max_size + IBUF_CONTRACT_ON_INSERT_NON_SYNC) {
- mutex_exit(&ibuf_mutex);
-
+ ulint max_size;
+
+ /* Perform dirty reads of ibuf->size and ibuf->max_size, to
+ reduce ibuf_mutex contention. ibuf->max_size remains constant
+ after ibuf_init_at_db_start(), but ibuf->size should be
+ protected by ibuf_mutex. Given that ibuf->size fits in a
+ machine word, this should be OK; at worst we are doing some
+ excessive ibuf_contract() or occasionally skipping a
+ ibuf_contract(). */
+ size = ibuf->size;
+ max_size = ibuf->max_size;
+
+ if (size < max_size + IBUF_CONTRACT_ON_INSERT_NON_SYNC) {
return;
}
- sync = FALSE;
-
- if (ibuf->size >= ibuf->max_size + IBUF_CONTRACT_ON_INSERT_SYNC) {
-
- sync = TRUE;
- }
-
- mutex_exit(&ibuf_mutex);
+ sync = (size >= max_size + IBUF_CONTRACT_ON_INSERT_SYNC);
/* Contract at least entry_size many bytes */
sum_sizes = 0;
size = 1;
- while ((size > 0) && (sum_sizes < entry_size)) {
+ do {
size = ibuf_contract(sync);
sum_sizes += size;
- }
+ } while (size > 0 && sum_sizes < entry_size);
}
/*********************************************************************//**
@@ -3265,7 +3278,7 @@ ibuf_set_entry_counter(
/*********************************************************************//**
Buffer an operation in the insert/delete buffer, instead of doing it
directly to the disk page, if this is possible.
-@return DB_SUCCESS, DB_FAIL, DB_STRONG_FAIL */
+@return DB_SUCCESS, DB_STRONG_FAIL or other error */
static
ulint
ibuf_insert_low(
@@ -3295,6 +3308,7 @@ ibuf_insert_low(
rec_t* ins_rec;
ibool old_bit_value;
page_t* bitmap_page;
+ buf_block_t* block;
page_t* root;
ulint err;
ibool do_merge;
@@ -3315,13 +3329,17 @@ ibuf_insert_low(
do_merge = FALSE;
- mutex_enter(&ibuf_mutex);
-
+ /* Perform dirty reads of ibuf->size and ibuf->max_size, to
+ reduce ibuf_mutex contention. ibuf->max_size remains constant
+ after ibuf_init_at_db_start(), but ibuf->size should be
+ protected by ibuf_mutex. Given that ibuf->size fits in a
+ machine word, this should be OK; at worst we are doing some
+ excessive ibuf_contract() or occasionally skipping a
+ ibuf_contract(). */
if (ibuf->size >= ibuf->max_size + IBUF_CONTRACT_DO_NOT_INSERT) {
/* Insert buffer is now too big, contract it but do not try
to insert */
- mutex_exit(&ibuf_mutex);
#ifdef UNIV_IBUF_DEBUG
fputs("Ibuf too big\n", stderr);
@@ -3332,40 +3350,6 @@ ibuf_insert_low(
return(DB_STRONG_FAIL);
}
- mutex_exit(&ibuf_mutex);
-
- if (mode == BTR_MODIFY_TREE) {
- mutex_enter(&ibuf_pessimistic_insert_mutex);
-
- ibuf_enter();
-
- mutex_enter(&ibuf_mutex);
-
- while (!ibuf_data_enough_free_for_insert()) {
-
- mutex_exit(&ibuf_mutex);
-
- ibuf_exit();
-
- mutex_exit(&ibuf_pessimistic_insert_mutex);
-
- err = ibuf_add_free_page();
-
- if (err == DB_STRONG_FAIL) {
-
- return(err);
- }
-
- mutex_enter(&ibuf_pessimistic_insert_mutex);
-
- ibuf_enter();
-
- mutex_enter(&ibuf_mutex);
- }
- } else {
- ibuf_enter();
- }
-
heap = mem_heap_create(512);
/* Build the entry which contains the space id and the page number
@@ -3384,6 +3368,31 @@ ibuf_insert_low(
the new entry to it without exceeding the free space limit for the
page. */
+ if (mode == BTR_MODIFY_TREE) {
+ for (;;) {
+ ibuf_enter();
+ mutex_enter(&ibuf_pessimistic_insert_mutex);
+ mutex_enter(&ibuf_mutex);
+
+ if (UNIV_LIKELY(ibuf_data_enough_free_for_insert())) {
+
+ break;
+ }
+
+ mutex_exit(&ibuf_mutex);
+ mutex_exit(&ibuf_pessimistic_insert_mutex);
+ ibuf_exit();
+
+ if (UNIV_UNLIKELY(!ibuf_add_free_page())) {
+
+ mem_heap_free(heap);
+ return(DB_STRONG_FAIL);
+ }
+ }
+ } else {
+ ibuf_enter();
+ }
+
mtr_start(&mtr);
btr_pcur_open(ibuf->index, ibuf_entry, PAGE_CUR_LE, mode, &pcur, &mtr);
@@ -3417,9 +3426,14 @@ ibuf_insert_low(
before mtr_commit(&mtr). We must not mtr_commit(&mtr)
until after the IBUF_OP_DELETE has been buffered. */
- err = DB_STRONG_FAIL;
+fail_exit:
+ if (mode == BTR_MODIFY_TREE) {
+ mutex_exit(&ibuf_mutex);
+ mutex_exit(&ibuf_pessimistic_insert_mutex);
+ }
- goto function_exit;
+ err = DB_STRONG_FAIL;
+ goto func_exit;
}
/* After this point, the page could still be loaded to the
@@ -3465,9 +3479,7 @@ ibuf_insert_low(
space_ids, space_versions,
page_nos, &n_stored);
- err = DB_STRONG_FAIL;
-
- goto function_exit;
+ goto fail_exit;
}
}
@@ -3478,11 +3490,9 @@ ibuf_insert_low(
&& !ibuf_set_entry_counter(ibuf_entry, space, page_no, &pcur,
mode == BTR_MODIFY_PREV, &mtr)) {
bitmap_fail:
- err = DB_STRONG_FAIL;
-
mtr_commit(&bitmap_mtr);
- goto function_exit;
+ goto fail_exit;
}
/* Set the bitmap bit denoting that the insert buffer contains
@@ -3506,10 +3516,19 @@ bitmap_fail:
err = btr_cur_optimistic_insert(BTR_NO_LOCKING_FLAG, cursor,
ibuf_entry, &ins_rec,
&dummy_big_rec, 0, thr, &mtr);
- if (err == DB_SUCCESS && op != IBUF_OP_DELETE) {
- /* Update the page max trx id field */
- page_update_max_trx_id(btr_cur_get_block(cursor), NULL,
- thr_get_trx(thr)->id, &mtr);
+ block = btr_cur_get_block(cursor);
+ ut_ad(buf_block_get_space(block) == IBUF_SPACE_ID);
+
+ /* If this is the root page, update ibuf->empty. */
+ if (UNIV_UNLIKELY(buf_block_get_page_no(block)
+ == FSP_IBUF_TREE_ROOT_PAGE_NO)) {
+ const page_t* root = buf_block_get_frame(block);
+
+ ut_ad(page_get_space_id(root) == IBUF_SPACE_ID);
+ ut_ad(page_get_page_no(root)
+ == FSP_IBUF_TREE_ROOT_PAGE_NO);
+
+ ibuf->empty = (page_get_n_recs(root) == 0);
}
} else {
ut_ad(mode == BTR_MODIFY_TREE);
@@ -3526,16 +3545,22 @@ bitmap_fail:
cursor,
ibuf_entry, &ins_rec,
&dummy_big_rec, 0, thr, &mtr);
- if (err == DB_SUCCESS && op != IBUF_OP_DELETE) {
- /* Update the page max trx id field */
- page_update_max_trx_id(btr_cur_get_block(cursor), NULL,
- thr_get_trx(thr)->id, &mtr);
- }
-
+ mutex_exit(&ibuf_pessimistic_insert_mutex);
ibuf_size_update(root, &mtr);
+ mutex_exit(&ibuf_mutex);
+ ibuf->empty = (page_get_n_recs(root) == 0);
+
+ block = btr_cur_get_block(cursor);
+ ut_ad(buf_block_get_space(block) == IBUF_SPACE_ID);
}
-function_exit:
+ if (err == DB_SUCCESS && op != IBUF_OP_DELETE) {
+ /* Update the page max trx id field */
+ page_update_max_trx_id(block, NULL,
+ thr_get_trx(thr)->id, &mtr);
+ }
+
+func_exit:
#ifdef UNIV_IBUF_COUNT_DEBUG
if (err == DB_SUCCESS) {
fprintf(stderr,
@@ -3547,11 +3572,6 @@ function_exit:
ibuf_count_get(space, page_no) + 1);
}
#endif
- if (mode == BTR_MODIFY_TREE) {
-
- mutex_exit(&ibuf_mutex);
- mutex_exit(&ibuf_pessimistic_insert_mutex);
- }
mtr_commit(&mtr);
btr_pcur_close(&pcur);
@@ -3559,16 +3579,8 @@ function_exit:
mem_heap_free(heap);
- if (err == DB_SUCCESS) {
- mutex_enter(&ibuf_mutex);
-
- ibuf->empty = FALSE;
-
- mutex_exit(&ibuf_mutex);
-
- if (mode == BTR_MODIFY_TREE) {
- ibuf_contract_after_insert(entry_size);
- }
+ if (err == DB_SUCCESS && mode == BTR_MODIFY_TREE) {
+ ibuf_contract_after_insert(entry_size);
}
if (do_merge) {
@@ -4075,6 +4087,22 @@ ibuf_delete_rec(
success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);
if (success) {
+ if (UNIV_UNLIKELY(!page_get_n_recs(btr_pcur_get_page(pcur)))) {
+ /* If a B-tree page is empty, it must be the root page
+ and the whole B-tree must be empty. InnoDB does not
+ allow empty B-tree pages other than the root. */
+ root = btr_pcur_get_page(pcur);
+
+ ut_ad(page_get_space_id(root) == IBUF_SPACE_ID);
+ ut_ad(page_get_page_no(root)
+ == FSP_IBUF_TREE_ROOT_PAGE_NO);
+
+ /* ibuf->empty is protected by the root page latch.
+ Before the deletion, it had to be FALSE. */
+ ut_ad(!ibuf->empty);
+ ibuf->empty = TRUE;
+ }
+
#ifdef UNIV_IBUF_COUNT_DEBUG
fprintf(stderr,
"Decrementing ibuf count of space %lu page %lu\n"
@@ -4102,6 +4130,7 @@ ibuf_delete_rec(
if (!ibuf_restore_pos(space, page_no, search_tuple,
BTR_MODIFY_TREE, pcur, mtr)) {
+ mutex_exit(&ibuf_mutex);
goto func_exit;
}
@@ -4115,13 +4144,14 @@ ibuf_delete_rec(
ibuf_count_set(space, page_no, ibuf_count_get(space, page_no) - 1);
#endif
ibuf_size_update(root, mtr);
+ mutex_exit(&ibuf_mutex);
+
+ ibuf->empty = (page_get_n_recs(root) == 0);
btr_pcur_commit_specify_mtr(pcur, mtr);
func_exit:
btr_pcur_close(pcur);
- mutex_exit(&ibuf_mutex);
-
return(TRUE);
}
@@ -4495,6 +4525,11 @@ reset_bit:
btr_pcur_close(&pcur);
mem_heap_free(heap);
+#ifdef HAVE_ATOMIC_BUILTINS
+ os_atomic_increment_ulint(&ibuf->n_merges, 1);
+ ibuf_add_ops(ibuf->n_merged_ops, mops);
+ ibuf_add_ops(ibuf->n_discarded_ops, dops);
+#else /* HAVE_ATOMIC_BUILTINS */
/* Protect our statistics keeping from race conditions */
mutex_enter(&ibuf_mutex);
@@ -4503,6 +4538,7 @@ reset_bit:
ibuf_add_ops(ibuf->n_discarded_ops, dops);
mutex_exit(&ibuf_mutex);
+#endif /* HAVE_ATOMIC_BUILTINS */
if (update_ibuf_bitmap && !tablespace_being_deleted) {
@@ -4604,10 +4640,14 @@ leave_loop:
mtr_commit(&mtr);
btr_pcur_close(&pcur);
+#ifdef HAVE_ATOMIC_BUILTINS
+ ibuf_add_ops(ibuf->n_discarded_ops, dops);
+#else /* HAVE_ATOMIC_BUILTINS */
/* Protect our statistics keeping from race conditions */
mutex_enter(&ibuf_mutex);
ibuf_add_ops(ibuf->n_discarded_ops, dops);
mutex_exit(&ibuf_mutex);
+#endif /* HAVE_ATOMIC_BUILTINS */
ibuf_exit();
@@ -4627,37 +4667,18 @@ ibuf_is_empty(void)
mtr_t mtr;
ibuf_enter();
-
- mutex_enter(&ibuf_mutex);
-
mtr_start(&mtr);
+ mutex_enter(&ibuf_mutex);
root = ibuf_tree_root_get(&mtr);
-
- if (page_get_n_recs(root) == 0) {
-
- is_empty = TRUE;
-
- if (ibuf->empty == FALSE) {
- fprintf(stderr,
- "InnoDB: Warning: insert buffer tree is empty"
- " but the data struct does not\n"
- "InnoDB: know it. This condition is legal"
- " if the master thread has not yet\n"
- "InnoDB: run to completion.\n");
- }
- } else {
- ut_a(ibuf->empty == FALSE);
-
- is_empty = FALSE;
- }
-
- mtr_commit(&mtr);
-
mutex_exit(&ibuf_mutex);
+ is_empty = (page_get_n_recs(root) == 0);
+ mtr_commit(&mtr);
ibuf_exit();
+ ut_a(is_empty == ibuf->empty);
+
return(is_empty);
}
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index 757477838ee..7cafa6e0df5 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -615,6 +615,11 @@ struct btr_path_struct{
order); value ULINT_UNDEFINED
denotes array end */
ulint n_recs; /*!< number of records on the page */
+ ulint page_no; /*!< no of the page containing the record */
+ ulint page_level; /*!< level of the page, if later we fetch
+ the page under page_no and it is no different
+ level then we know that the tree has been
+ reorganized */
};
#define BTR_PATH_ARRAY_N_SLOTS 250 /*!< size of path array (in slots) */
diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h
index 20a2be7f877..6493689a969 100644
--- a/storage/innobase/include/btr0sea.h
+++ b/storage/innobase/include/btr0sea.h
@@ -180,6 +180,7 @@ btr_search_update_hash_on_delete(
btr_cur_t* cursor);/*!< in: cursor which was positioned on the
record to delete using btr_cur_search_...,
the record is not yet deleted */
+#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/********************************************************************//**
Validates the search system.
@return TRUE if ok */
@@ -187,6 +188,9 @@ UNIV_INTERN
ibool
btr_search_validate(void);
/*======================*/
+#else
+# define btr_search_validate() TRUE
+#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
/** Flag: has the search system been enabled?
Protected by btr_search_latch and btr_search_enabled_mutex. */
diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h
index 6a718a464ab..05d3532d59a 100644
--- a/storage/innobase/include/dict0load.h
+++ b/storage/innobase/include/dict0load.h
@@ -116,19 +116,23 @@ dict_load_column_low(
const rec_t* rec); /*!< in: SYS_COLUMNS record */
/********************************************************************//**
Loads an index definition from a SYS_INDEXES record to dict_index_t.
-@return error message, or NULL on success */
+If allocate=TRUE, we will create a dict_index_t structure and fill it
+accordingly. If allocated=FALSE, the dict_index_t will be supplied by
+the caller and filled with information read from the record. @return
+error message, or NULL on success */
UNIV_INTERN
const char*
dict_load_index_low(
/*================*/
- byte* table_id, /*!< in/out: table id (8 bytes_,
- an "in" value if cached=TRUE
- and "out" when cached=FALSE */
+ byte* table_id, /*!< in/out: table id (8 bytes),
+ an "in" value if allocate=TRUE
+ and "out" when allocate=FALSE */
const char* table_name, /*!< in: table name */
mem_heap_t* heap, /*!< in/out: temporary memory heap */
const rec_t* rec, /*!< in: SYS_INDEXES record */
- ibool cached, /*!< in: TRUE = add to cache
- FALSE = do not */
+ ibool allocate, /*!< in: TRUE=allocate *index,
+ FALSE=fill in a pre-allocated
+ *index */
dict_index_t** index); /*!< out,own: index, or NULL */
/********************************************************************//**
Loads an index field definition from a SYS_FIELDS record to
diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h
index 1ffbd3440aa..3299000bf3c 100644
--- a/storage/innobase/include/ha0ha.h
+++ b/storage/innobase/include/ha0ha.h
@@ -186,6 +186,7 @@ ha_remove_all_nodes_to_page(
hash_table_t* table, /*!< in: hash table */
ulint fold, /*!< in: fold value */
const page_t* page); /*!< in: buffer page */
+#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/*************************************************************//**
Validates a given range of the cells in hash table.
@return TRUE if ok */
@@ -196,6 +197,7 @@ ha_validate(
hash_table_t* table, /*!< in: hash table */
ulint start_index, /*!< in: start index */
ulint end_index); /*!< in: end index */
+#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
/*************************************************************//**
Prints info of a hash table. */
UNIV_INTERN
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index a9ee1d66b99..b75002944bd 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -267,5 +267,13 @@ thd_lock_wait_timeout(
/*==================*/
void* thd); /*!< in: thread handle (THD*), or NULL to query
the global innodb_lock_wait_timeout */
+/******************************************************************//**
+Add up the time waited for the lock for the current query. */
+UNIV_INTERN
+void
+thd_set_lock_wait_time(
+/*===================*/
+ void* thd, /*!< in: thread handle (THD*) */
+ ulint value); /*!< in: time waited for the lock */
#endif
diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic
index aee27cf9739..e3fa6e3e929 100644
--- a/storage/innobase/include/ibuf0ibuf.ic
+++ b/storage/innobase/include/ibuf0ibuf.ic
@@ -46,11 +46,12 @@ struct ibuf_struct{
ulint seg_size; /*!< allocated pages of the file
segment containing ibuf header and
tree */
- ibool empty; /*!< after an insert to the ibuf tree
- is performed, this is set to FALSE,
- and if a contract operation finds
- the tree empty, this is set to
- TRUE */
+ ibool empty; /*!< Protected by the page
+ latch of the root page of the
+ insert buffer tree
+ (FSP_IBUF_TREE_ROOT_PAGE_NO). TRUE
+ if and only if the insert
+ buffer tree is empty. */
ulint free_list_len; /*!< length of the free list */
ulint height; /*!< tree height */
dict_index_t* index; /*!< insert buffer index */
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index ac87942f255..5a5af76e175 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -254,8 +254,10 @@ by one. */
option off; also some ibuf tests are suppressed */
/* Linkage specifier for non-static InnoDB symbols (variables and functions)
-that are only referenced from within InnoDB, not from MySQL */
-#if defined(__GNUC__) && (__GNUC__ >= 4) || defined(__INTEL_COMPILER)
+that are only referenced from within InnoDB, not from MySQL. We disable the
+GCC visibility directive on all Sun operating systems because there is no
+easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */
+#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(sun) || defined(__INTEL_COMPILER)
# define UNIV_INTERN __attribute__((visibility ("hidden")))
#else
# define UNIV_INTERN
diff --git a/storage/innobase/plug.in b/storage/innobase/plug.in
index 4ca1b520526..9367b70c52e 100644
--- a/storage/innobase/plug.in
+++ b/storage/innobase/plug.in
@@ -15,7 +15,7 @@
#
MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine],
- [Transactional Tables using InnoDB], [max,max-no-ndb])
+ [Transactional Tables using InnoDB], [default,max,max-no-ndb])
MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase])
MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a])
MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la])
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index 97d699dde99..b2da43c188b 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -84,6 +84,8 @@ Created 10/8/1995 Heikki Tuuri
#include "ha_prototypes.h"
#include "trx0i_s.h"
#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
+#include "mysql/plugin.h"
+#include "mysql/service_thd_wait.h"
/* This is set to TRUE if the MySQL user has set it in MySQL; currently
affects only FOREIGN KEY definition parsing */
@@ -1232,7 +1234,9 @@ retry:
trx->op_info = "waiting in InnoDB queue";
+ thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);
os_event_wait(slot->event);
+ thd_wait_end(trx->mysql_thd);
trx->op_info = "";
@@ -1597,7 +1601,9 @@ srv_suspend_mysql_thread(
/* Suspend this thread and wait for the event. */
+ thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);
os_event_wait(event);
+ thd_wait_end(trx->mysql_thd);
/* After resuming, reacquire the data dictionary latch if
necessary. */
@@ -1643,6 +1649,9 @@ srv_suspend_mysql_thread(
start_time != -1 && finish_time != -1) {
srv_n_lock_max_wait_time = diff_time;
}
+
+ /* Record the lock wait time for this thread */
+ thd_set_lock_wait_time(trx->mysql_thd, diff_time);
}
if (trx->was_chosen_as_deadlock_victim) {
diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c
index 1467cc56759..e8d81cbbbb1 100644
--- a/storage/myisam/ft_stopwords.c
+++ b/storage/myisam/ft_stopwords.c
@@ -18,6 +18,10 @@
#include "ftdefs.h"
#include "my_handler.h"
+
+static CHARSET_INFO *ft_stopword_cs= NULL;
+
+
typedef struct st_ft_stopwords
{
const char * pos;
@@ -29,7 +33,7 @@ static TREE *stopwords3=NULL;
static int FT_STOPWORD_cmp(void* cmp_arg __attribute__((unused)),
FT_STOPWORD *w1, FT_STOPWORD *w2)
{
- return ha_compare_text(default_charset_info,
+ return ha_compare_text(ft_stopword_cs,
(uchar *)w1->pos,w1->len,
(uchar *)w2->pos,w2->len,0,0);
}
@@ -59,6 +63,14 @@ int ft_init_stopwords()
0,
(ft_stopword_file ? (tree_element_free)&FT_STOPWORD_free : 0),
NULL);
+ /*
+ Stopword engine currently does not support tricky
+ character sets UCS2, UTF16, UTF32.
+ Use latin1 to compare stopwords in case of these character sets.
+ It's also fine to use latin1 with the built-in stopwords.
+ */
+ ft_stopword_cs= default_charset_info->mbminlen == 1 ?
+ default_charset_info : &my_charset_latin1;
}
if (ft_stopword_file)
@@ -80,7 +92,7 @@ int ft_init_stopwords()
goto err0;
len=my_read(fd, buffer, len, MYF(MY_WME));
end=start+len;
- while (ft_simple_get_word(default_charset_info, &start, end, &w, TRUE))
+ while (ft_simple_get_word(ft_stopword_cs, &start, end, &w, TRUE))
{
if (ft_add_stopword(my_strndup((char*) w.pos, w.len, MYF(0))))
goto err1;
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index bce42b64e99..75038fce070 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -253,18 +253,17 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
pos=old;
if (keyseg->flag & HA_SPACE_PACK)
{
- uchar *end=pos+length;
if (type == HA_KEYTYPE_NUM)
{
- while (pos < end && pos[0] == ' ')
- pos++;
+ uchar *end= pos + length;
+ while (pos < end && pos[0] == ' ')
+ pos++;
+ length= (uint) (end - pos);
}
else if (type != HA_KEYTYPE_BINARY)
{
- while (end > pos && end[-1] == ' ')
- end--;
+ length= cs->cset->lengthsp(cs, (char*) pos, length);
}
- length=(uint) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
memcpy((uchar*) key,pos,(size_t) char_length);
diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c
index 073b127f1a3..55967fc9001 100644
--- a/storage/myisam/mi_static.c
+++ b/storage/myisam/mi_static.c
@@ -33,9 +33,9 @@ uint myisam_quick_table_bits=9;
ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0;
#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS)
-uint myisam_concurrent_insert= 2;
+ulong myisam_concurrent_insert= 2;
#else
-uint myisam_concurrent_insert= 0;
+ulong myisam_concurrent_insert= 0;
#endif
ulonglong myisam_max_temp_length= MAX_FILE_SIZE;
ulong myisam_data_pointer_size=4;
diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt
index 5cd651a35bd..a3999da4ba1 100644
--- a/storage/perfschema/CMakeLists.txt
+++ b/storage/perfschema/CMakeLists.txt
@@ -38,15 +38,15 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
table_all_instr.h
table_events_waits.h
table_events_waits_summary.h
+ table_ews_global_by_event_name.h
table_file_instances.h
table_file_summary.h
table_performance_timers.h
- table_processlist.h
table_setup_consumers.h
table_setup_instruments.h
- table_setup_objects.h
table_setup_timers.h
table_sync_instances.h
+ table_threads.h
ha_perfschema.cc
pfs.cc
pfs_column_values.cc
@@ -60,15 +60,15 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
table_all_instr.cc
table_events_waits.cc
table_events_waits_summary.cc
+ table_ews_global_by_event_name.cc
table_file_instances.cc
table_file_summary.cc
table_performance_timers.cc
- table_processlist.cc
table_setup_consumers.cc
table_setup_instruments.cc
- table_setup_objects.cc
table_setup_timers.cc
table_sync_instances.cc
+ table_threads.cc
pfs_atomic.cc
pfs_check.cc
)
diff --git a/storage/perfschema/Makefile.am b/storage/perfschema/Makefile.am
index 374415cfdfd..762f5b85790 100644
--- a/storage/perfschema/Makefile.am
+++ b/storage/perfschema/Makefile.am
@@ -39,12 +39,12 @@ noinst_HEADERS = ha_perfschema.h pfs_engine_table.h pfs.h pfs_server.h \
table_setup_instruments.h table_performance_timers.h \
table_setup_timers.h \
table_setup_consumers.h table_events_waits.h \
- pfs_events_waits.h pfs_timer.h table_processlist.h \
+ pfs_events_waits.h pfs_timer.h table_threads.h \
table_sync_instances.h \
table_events_waits_summary.h pfs_stat.h \
- table_all_instr.h \
+ table_ews_global_by_event_name.h table_all_instr.h \
table_file_instances.h table_file_summary.h \
- table_setup_objects.h pfs_lock.h pfs_atomic.h
+ pfs_lock.h pfs_atomic.h
PSE_SOURCES = ha_perfschema.cc pfs_engine_table.cc pfs.cc pfs_server.cc \
pfs_global.cc pfs_instr_class.cc pfs_instr.cc \
@@ -52,12 +52,12 @@ PSE_SOURCES = ha_perfschema.cc pfs_engine_table.cc pfs.cc pfs_server.cc \
table_setup_instruments.cc table_performance_timers.cc \
table_setup_timers.cc \
table_setup_consumers.cc table_events_waits.cc \
- pfs_events_waits.cc pfs_timer.cc table_processlist.cc \
+ pfs_events_waits.cc pfs_timer.cc table_threads.cc \
table_sync_instances.cc \
table_events_waits_summary.cc \
- table_all_instr.cc \
+ table_ews_global_by_event_name.cc table_all_instr.cc \
table_file_instances.cc table_file_summary.cc \
- table_setup_objects.cc pfs_atomic.cc pfs_check.cc
+ pfs_atomic.cc pfs_check.cc
EXTRA_LIBRARIES = libperfschema.a
noinst_LIBRARIES = @plugin_perfschema_static_target@
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 0fac734f7a0..e5e324d6c6b 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -20,6 +20,7 @@
#include "my_global.h"
#include "my_pthread.h"
+#include "my_atomic.h"
#include "sql_plugin.h"
#include "mysql/plugin.h"
#include "ha_perfschema.h"
@@ -28,6 +29,17 @@
#include "pfs_instr_class.h"
#include "pfs_instr.h"
+#ifdef MY_ATOMIC_MODE_DUMMY
+/*
+ The performance schema can can not function with MY_ATOMIC_MODE_DUMMY,
+ a fully functional implementation of MY_ATOMIC should be used instead.
+ If the build fails with this error message:
+ - either use a different ./configure --with-atomic-ops option
+ - or do not build with the performance schema.
+*/
+#error "The performance schema needs a functional MY_ATOMIC implementation."
+#endif
+
handlerton *pfs_hton= NULL;
static handler* pfs_create_handler(handlerton *hton,
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 60ef2a3b194..139064ab212 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1628,16 +1628,23 @@ static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc)
if (rc == 0)
{
/* Thread safe: we are protected by the instrumented mutex */
- PFS_single_stat_chain *stat;
PFS_mutex *mutex= pfs_locker->m_target.m_mutex;
+ PFS_single_stat_chain *stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, mutex->m_class);
mutex->m_owner= wait->m_thread;
mutex->m_last_locked= wait->m_timer_end;
- ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
- aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time);
- stat= find_per_thread_mutex_class_wait_stat(wait->m_thread,
- mutex->m_class);
- aggregate_single_stat_chain(stat, wait_time);
+ /* If timed then aggregate stats, else increment the value counts only */
+ if (wait->m_timer_state == TIMER_STATE_TIMED)
+ {
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(stat, wait_time);
+ }
+ else
+ {
+ increment_single_stat_chain(&mutex->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
}
wait->m_thread->m_wait_locker_count--;
}
@@ -1683,18 +1690,26 @@ static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc)
The statistics generated are not safe, which is why they are
just statistics, not facts.
*/
- PFS_single_stat_chain *stat;
PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock;
+ PFS_single_stat_chain *stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class);
+
if (rwlock->m_readers == 0)
rwlock->m_last_read= wait->m_timer_end;
rwlock->m_writer= NULL;
rwlock->m_readers++;
- ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
- aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time);
- stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread,
- rwlock->m_class);
- aggregate_single_stat_chain(stat, wait_time);
+ /* If timed then aggregate stats, else increment the value counts only */
+ if (wait->m_timer_state == TIMER_STATE_TIMED)
+ {
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(stat, wait_time);
+ }
+ else
+ {
+ increment_single_stat_chain(&rwlock->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
}
wait->m_thread->m_wait_locker_count--;
}
@@ -1734,19 +1749,26 @@ static void end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc)
if (rc == 0)
{
/* Thread safe : we are protected by the instrumented rwlock */
- PFS_single_stat_chain *stat;
PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock;
+ PFS_single_stat_chain *stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class);
rwlock->m_writer= wait->m_thread;
rwlock->m_last_written= wait->m_timer_end;
/* Reset the readers stats, they could be off */
rwlock->m_readers= 0;
rwlock->m_last_read= 0;
- ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
- aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time);
- stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread,
- rwlock->m_class);
- aggregate_single_stat_chain(stat, wait_time);
+ /* If timed then aggregate stats, else increment the value counts only */
+ if (wait->m_timer_state == TIMER_STATE_TIMED)
+ {
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(stat, wait_time);
+ }
+ else
+ {
+ increment_single_stat_chain(&rwlock->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
}
wait->m_thread->m_wait_locker_count--;
}
@@ -1800,14 +1822,21 @@ static void end_cond_wait_v1(PSI_cond_locker* locker, int rc)
in condition B.
This is accepted, the data will be slightly inaccurate.
*/
- PFS_single_stat_chain *stat;
PFS_cond *cond= pfs_locker->m_target.m_cond;
+ PFS_single_stat_chain *stat= find_per_thread_cond_class_wait_stat(wait->m_thread, cond->m_class);
- ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
- aggregate_single_stat_chain(&cond->m_wait_stat, wait_time);
- stat= find_per_thread_cond_class_wait_stat(wait->m_thread,
- cond->m_class);
- aggregate_single_stat_chain(stat, wait_time);
+ /* If timed then aggregate stats, else increment the value counts only */
+ if (wait->m_timer_state == TIMER_STATE_TIMED)
+ {
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&cond->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(stat, wait_time);
+ }
+ else
+ {
+ increment_single_stat_chain(&cond->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
}
wait->m_thread->m_wait_locker_count--;
}
@@ -1851,8 +1880,17 @@ static void end_table_wait_v1(PSI_table_locker* locker)
insert_events_waits_history_long(wait);
PFS_table *table= pfs_locker->m_target.m_table;
- ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
- aggregate_single_stat_chain(&table->m_wait_stat, wait_time);
+
+ /* If timed then aggregate stats, else increment the value counts only */
+ if (wait->m_timer_state == TIMER_STATE_TIMED)
+ {
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&table->m_wait_stat, wait_time);
+ }
+ else
+ {
+ increment_single_stat_chain(&table->m_wait_stat);
+ }
/*
There is currently no per table and per thread aggregation.
@@ -1954,14 +1992,21 @@ static void end_file_wait_v1(PSI_file_locker *locker,
if (flag_events_waits_history_long)
insert_events_waits_history_long(wait);
- PFS_single_stat_chain *stat;
PFS_file *file= pfs_locker->m_target.m_file;
+ PFS_single_stat_chain *stat= find_per_thread_file_class_wait_stat(wait->m_thread, file->m_class);
- ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
- aggregate_single_stat_chain(&file->m_wait_stat, wait_time);
- stat= find_per_thread_file_class_wait_stat(wait->m_thread,
- file->m_class);
- aggregate_single_stat_chain(stat, wait_time);
+ /* If timed then aggregate stats, else increment the value counts only */
+ if (wait->m_timer_state == TIMER_STATE_TIMED)
+ {
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&file->m_wait_stat, wait_time);
+ aggregate_single_stat_chain(stat, wait_time);
+ }
+ else
+ {
+ increment_single_stat_chain(&file->m_wait_stat);
+ increment_single_stat_chain(stat);
+ }
PFS_file_class *klass= file->m_class;
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 7b6fd055729..df00811959c 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -23,11 +23,11 @@
#include "table_events_waits.h"
#include "table_setup_consumers.h"
#include "table_setup_instruments.h"
-#include "table_setup_objects.h"
#include "table_setup_timers.h"
#include "table_performance_timers.h"
-#include "table_processlist.h"
+#include "table_threads.h"
#include "table_events_waits_summary.h"
+#include "table_ews_global_by_event_name.h"
#include "table_sync_instances.h"
#include "table_file_instances.h"
#include "table_file_summary.h"
@@ -52,13 +52,12 @@ static PFS_engine_table_share *all_shares[]=
&table_events_waits_history_long::m_share,
&table_setup_consumers::m_share,
&table_setup_instruments::m_share,
- &table_setup_objects::m_share,
&table_setup_timers::m_share,
&table_performance_timers::m_share,
- &table_processlist::m_share,
+ &table_threads::m_share,
&table_events_waits_summary_by_thread_by_event_name::m_share,
- &table_events_waits_summary_by_event_name::m_share,
&table_events_waits_summary_by_instance::m_share,
+ &table_ews_global_by_event_name::m_share,
&table_file_summary_by_event_name::m_share,
&table_file_summary_by_instance::m_share,
&table_mutex_instances::m_share,
diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h
index a7af27c1038..8cb68cd52b1 100644
--- a/storage/perfschema/pfs_server.h
+++ b/storage/perfschema/pfs_server.h
@@ -25,13 +25,13 @@
#define PFS_MAX_MUTEX_CLASS 200
#endif
#ifndef PFS_MAX_MUTEX
- #define PFS_MAX_MUTEX 1000
+ #define PFS_MAX_MUTEX 1000000
#endif
#ifndef PFS_MAX_RWLOCK_CLASS
- #define PFS_MAX_RWLOCK_CLASS 20
+ #define PFS_MAX_RWLOCK_CLASS 30
#endif
#ifndef PFS_MAX_RWLOCK
- #define PFS_MAX_RWLOCK 1000
+ #define PFS_MAX_RWLOCK 1000000
#endif
#ifndef PFS_MAX_COND_CLASS
#define PFS_MAX_COND_CLASS 80
diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h
index c78d5c83039..5955a515d1a 100644
--- a/storage/perfschema/pfs_stat.h
+++ b/storage/perfschema/pfs_stat.h
@@ -83,6 +83,22 @@ inline void aggregate_single_stat_chain(PFS_single_stat_chain *stat,
while (stat);
}
+/**
+ Increment the value counts in a statistic chain.
+ Used for instruments that are 'ENABLED' but not 'TIMED'.
+ @param stat the aggregated statistic chain
+*/
+inline void increment_single_stat_chain(PFS_single_stat_chain *stat)
+{
+ do
+ {
+ if (*stat->m_control_flag)
+ stat->m_count++;
+ stat= stat->m_parent;
+ }
+ while (stat);
+}
+
/** Statistics for COND usage. */
struct PFS_cond_stat
{
diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc
index 9d0d6fe0f67..435a3500f06 100644
--- a/storage/perfschema/table_events_waits_summary.cc
+++ b/storage/perfschema/table_events_waits_summary.cc
@@ -338,144 +338,6 @@ int table_events_waits_summary_by_thread_by_event_name
return 0;
}
-THR_LOCK table_events_waits_summary_by_event_name::m_table_lock;
-
-static const TABLE_FIELD_TYPE ews_by_event_name_field_types[]=
-{
- {
- { C_STRING_WITH_LEN("EVENT_NAME") },
- { C_STRING_WITH_LEN("varchar(128)") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("COUNT_STAR") },
- { C_STRING_WITH_LEN("bigint(20)") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
- { C_STRING_WITH_LEN("bigint(20)") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
- { C_STRING_WITH_LEN("bigint(20)") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
- { C_STRING_WITH_LEN("bigint(20)") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
- { C_STRING_WITH_LEN("bigint(20)") },
- { NULL, 0}
- }
-};
-
-TABLE_FIELD_DEF
-table_events_waits_summary_by_event_name::m_field_def=
-{ 6, ews_by_event_name_field_types };
-
-PFS_engine_table_share
-table_events_waits_summary_by_event_name::m_share=
-{
- { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_EVENT_NAME") },
- &pfs_truncatable_acl,
- &table_events_waits_summary_by_event_name::create,
- NULL, /* write_row */
- &table_events_waits_summary_by_event_name::delete_all_rows,
- 1000, /* records */
- sizeof(pos_all_instr_class),
- &m_table_lock,
- &m_field_def,
- false /* checked */
-};
-
-PFS_engine_table* table_events_waits_summary_by_event_name::create(void)
-{
- return new table_events_waits_summary_by_event_name();
-}
-
-int table_events_waits_summary_by_event_name::delete_all_rows(void)
-{
- reset_instrument_class_waits();
- return 0;
-}
-
-table_events_waits_summary_by_event_name
-::table_events_waits_summary_by_event_name()
- : table_all_instr_class(&m_share)
-{}
-
-void table_events_waits_summary_by_event_name
-::make_instr_row(PFS_instr_class *klass)
-{
- m_row.m_name= klass->m_name;
- m_row.m_name_length= klass->m_name_length;
-
- m_row.m_count= klass->m_wait_stat.m_count;
- m_row.m_sum= klass->m_wait_stat.m_sum;
- m_row.m_min= klass->m_wait_stat.m_min;
- m_row.m_max= klass->m_wait_stat.m_max;
-
- if (m_row.m_count)
- m_row.m_avg= m_row.m_sum / m_row.m_count;
- else
- {
- m_row.m_min= 0;
- m_row.m_avg= 0;
- }
-}
-
-int table_events_waits_summary_by_event_name
-::read_row_values(TABLE *table, unsigned char *, Field **fields,
- bool read_all)
-{
- Field *f;
-
- /* Set the null bits */
- DBUG_ASSERT(table->s->null_bytes == 0);
-
- /*
- The row always exist,
- the instrument classes are static and never disappear.
- */
-
- for (; (f= *fields) ; fields++)
- {
- if (read_all || bitmap_is_set(table->read_set, f->field_index))
- {
- switch(f->field_index)
- {
- case 0: /* NAME */
- set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
- break;
- case 1: /* COUNT */
- set_field_ulonglong(f, m_row.m_count);
- break;
- case 2: /* SUM */
- set_field_ulonglong(f, m_row.m_sum);
- break;
- case 3: /* MIN */
- set_field_ulonglong(f, m_row.m_min);
- break;
- case 4: /* AVG */
- set_field_ulonglong(f, m_row.m_avg);
- break;
- case 5: /* MAX */
- set_field_ulonglong(f, m_row.m_max);
- break;
- default:
- DBUG_ASSERT(false);
- }
- }
- }
-
- return 0;
-}
-
THR_LOCK table_events_waits_summary_by_instance::m_table_lock;
static const TABLE_FIELD_TYPE ews_by_instance_field_types[]=
diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h
index 47ec9523d68..628bb75553f 100644
--- a/storage/perfschema/table_events_waits_summary.h
+++ b/storage/perfschema/table_events_waits_summary.h
@@ -144,58 +144,6 @@ private:
pos_events_waits_summary_by_thread_by_event_name m_next_pos;
};
-/** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME. */
-struct row_events_waits_summary_by_event_name
-{
- /** Column EVENT_NAME. */
- const char *m_name;
- /** Length in bytes of @c m_name. */
- uint m_name_length;
- /** Column COUNT_STAR. */
- ulonglong m_count;
- /** Column SUM_TIMER_WAIT. */
- ulonglong m_sum;
- /** Column MIN_TIMER_WAIT. */
- ulonglong m_min;
- /** Column AVG_TIMER_WAIT. */
- ulonglong m_avg;
- /** Column MAX_TIMER_WAIT. */
- ulonglong m_max;
-};
-
-/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME. */
-class table_events_waits_summary_by_event_name : public table_all_instr_class
-{
-public:
- /** Table share */
- static PFS_engine_table_share m_share;
- static PFS_engine_table* create();
- static int delete_all_rows();
-
-protected:
- virtual void make_instr_row(PFS_instr_class *klass);
-
- virtual int read_row_values(TABLE *table,
- unsigned char *buf,
- Field **fields,
- bool read_all);
-
- table_events_waits_summary_by_event_name();
-
-public:
- ~table_events_waits_summary_by_event_name()
- {}
-
-private:
- /** Table share lock. */
- static THR_LOCK m_table_lock;
- /** Fields definition. */
- static TABLE_FIELD_DEF m_field_def;
-
- /** Current row. */
- row_events_waits_summary_by_event_name m_row;
-};
-
/** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_INSTANCE. */
struct row_events_waits_summary_by_instance
{
diff --git a/storage/perfschema/table_ews_global_by_event_name.cc b/storage/perfschema/table_ews_global_by_event_name.cc
new file mode 100644
index 00000000000..35e744ed96b
--- /dev/null
+++ b/storage/perfschema/table_ews_global_by_event_name.cc
@@ -0,0 +1,166 @@
+/* Copyright (c) 2008, 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
+ 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,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+ @file storage/perfschema/table_ews_global_by_event_name.cc
+ Table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "pfs_instr_class.h"
+#include "pfs_column_types.h"
+#include "pfs_column_values.h"
+#include "table_ews_global_by_event_name.h"
+#include "pfs_global.h"
+
+THR_LOCK table_ews_global_by_event_name::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+ {
+ { C_STRING_WITH_LEN("EVENT_NAME") },
+ { C_STRING_WITH_LEN("varchar(128)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("COUNT_STAR") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
+ { C_STRING_WITH_LEN("bigint(20)") },
+ { NULL, 0}
+ }
+};
+
+TABLE_FIELD_DEF
+table_ews_global_by_event_name::m_field_def=
+{ 6, field_types };
+
+PFS_engine_table_share
+table_ews_global_by_event_name::m_share=
+{
+ { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME") },
+ &pfs_truncatable_acl,
+ &table_ews_global_by_event_name::create,
+ NULL, /* write_row */
+ &table_ews_global_by_event_name::delete_all_rows,
+ 1000, /* records */
+ sizeof(pos_all_instr_class),
+ &m_table_lock,
+ &m_field_def,
+ false /* checked */
+};
+
+PFS_engine_table* table_ews_global_by_event_name::create(void)
+{
+ return new table_ews_global_by_event_name();
+}
+
+int table_ews_global_by_event_name::delete_all_rows(void)
+{
+ reset_instrument_class_waits();
+ return 0;
+}
+
+table_ews_global_by_event_name
+::table_ews_global_by_event_name()
+ : table_all_instr_class(&m_share)
+{}
+
+void table_ews_global_by_event_name
+::make_instr_row(PFS_instr_class *klass)
+{
+ m_row.m_name= klass->m_name;
+ m_row.m_name_length= klass->m_name_length;
+
+ m_row.m_count= klass->m_wait_stat.m_count;
+ m_row.m_sum= klass->m_wait_stat.m_sum;
+ m_row.m_min= klass->m_wait_stat.m_min;
+ m_row.m_max= klass->m_wait_stat.m_max;
+
+ if (m_row.m_count)
+ m_row.m_avg= m_row.m_sum / m_row.m_count;
+ else
+ {
+ m_row.m_min= 0;
+ m_row.m_avg= 0;
+ }
+}
+
+int table_ews_global_by_event_name
+::read_row_values(TABLE *table, unsigned char *, Field **fields,
+ bool read_all)
+{
+ Field *f;
+
+ /* Set the null bits */
+ DBUG_ASSERT(table->s->null_bytes == 0);
+
+ /*
+ The row always exist,
+ the instrument classes are static and never disappear.
+ */
+
+ for (; (f= *fields) ; fields++)
+ {
+ if (read_all || bitmap_is_set(table->read_set, f->field_index))
+ {
+ switch(f->field_index)
+ {
+ case 0: /* NAME */
+ set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
+ break;
+ case 1: /* COUNT */
+ set_field_ulonglong(f, m_row.m_count);
+ break;
+ case 2: /* SUM */
+ set_field_ulonglong(f, m_row.m_sum);
+ break;
+ case 3: /* MIN */
+ set_field_ulonglong(f, m_row.m_min);
+ break;
+ case 4: /* AVG */
+ set_field_ulonglong(f, m_row.m_avg);
+ break;
+ case 5: /* MAX */
+ set_field_ulonglong(f, m_row.m_max);
+ break;
+ default:
+ DBUG_ASSERT(false);
+ }
+ }
+ }
+
+ return 0;
+}
+
diff --git a/storage/perfschema/table_ews_global_by_event_name.h b/storage/perfschema/table_ews_global_by_event_name.h
new file mode 100644
index 00000000000..402ed9d80de
--- /dev/null
+++ b/storage/perfschema/table_ews_global_by_event_name.h
@@ -0,0 +1,88 @@
+/* Copyright (c) 2008, 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
+ 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,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef TABLE_EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME_H
+#define TABLE_EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME_H
+
+/**
+ @file storage/perfschema/table_ews_global_by_event_name.h
+ Table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME (declarations).
+*/
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+#include "pfs_instr_class.h"
+#include "pfs_instr.h"
+#include "table_all_instr.h"
+
+/**
+ @addtogroup Performance_schema_tables
+ @{
+*/
+
+/** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME. */
+struct row_ews_global_by_event_name
+{
+ /** Column EVENT_NAME. */
+ const char *m_name;
+ /** Length in bytes of @c m_name. */
+ uint m_name_length;
+ /** Column COUNT_STAR. */
+ ulonglong m_count;
+ /** Column SUM_TIMER_WAIT. */
+ ulonglong m_sum;
+ /** Column MIN_TIMER_WAIT. */
+ ulonglong m_min;
+ /** Column AVG_TIMER_WAIT. */
+ ulonglong m_avg;
+ /** Column MAX_TIMER_WAIT. */
+ ulonglong m_max;
+};
+
+/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME. */
+class table_ews_global_by_event_name : public table_all_instr_class
+{
+public:
+ /** Table share */
+ static PFS_engine_table_share m_share;
+ static PFS_engine_table* create();
+ static int delete_all_rows();
+
+protected:
+ virtual void make_instr_row(PFS_instr_class *klass);
+
+ virtual int read_row_values(TABLE *table,
+ unsigned char *buf,
+ Field **fields,
+ bool read_all);
+
+ table_ews_global_by_event_name();
+
+public:
+ ~table_ews_global_by_event_name()
+ {}
+
+private:
+ /** Table share lock. */
+ static THR_LOCK m_table_lock;
+ /** Fields definition. */
+ static TABLE_FIELD_DEF m_field_def;
+
+ /** Current row. */
+ row_ews_global_by_event_name m_row;
+};
+
+/** @} */
+#endif
diff --git a/storage/perfschema/table_setup_objects.cc b/storage/perfschema/table_setup_objects.cc
deleted file mode 100644
index b75bece83bd..00000000000
--- a/storage/perfschema/table_setup_objects.cc
+++ /dev/null
@@ -1,281 +0,0 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
-
- 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 storage/perfschema/table_setup_objects.cc
- Table SETUP_OBJECTS (implementation).
-*/
-
-#include "sql_priv.h"
-#include "unireg.h"
-#include "pfs_instr_class.h"
-#include "pfs_column_types.h"
-#include "pfs_column_values.h"
-#include "table_setup_objects.h"
-#include "pfs_global.h"
-
-THR_LOCK table_setup_objects::m_table_lock;
-
-static const TABLE_FIELD_TYPE field_types[]=
-{
- {
- { C_STRING_WITH_LEN("OBJECT_TYPE") },
- { C_STRING_WITH_LEN("varchar(64)") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("OBJECT_SCHEMA") },
- { C_STRING_WITH_LEN("varchar(64)") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("OBJECT_NAME") },
- { C_STRING_WITH_LEN("varchar(64)") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("ENABLED") },
- { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("TIMED") },
- { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") },
- { NULL, 0}
- },
- {
- { C_STRING_WITH_LEN("AGGREGATED") },
- { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") },
- { NULL, 0}
- }
-};
-
-TABLE_FIELD_DEF
-table_setup_objects::m_field_def=
-{ 6, field_types };
-
-PFS_engine_table_share
-table_setup_objects::m_share=
-{
- { C_STRING_WITH_LEN("SETUP_OBJECTS") },
- &pfs_editable_acl,
- &table_setup_objects::create,
- table_setup_objects::write_row,
- table_setup_objects::delete_all_rows,
- 1000, /* records */
- sizeof(pos_setup_objects),
- &m_table_lock,
- &m_field_def,
- false /* checked */
-};
-
-PFS_engine_table* table_setup_objects::create(void)
-{
- return new table_setup_objects();
-}
-
-int table_setup_objects::write_row(TABLE *table, unsigned char *buf,
- Field **fields)
-{
- /* Not implemented */
- return HA_ERR_WRONG_COMMAND;
-}
-
-int table_setup_objects::delete_all_rows(void)
-{
- /* Not implemented */
- return HA_ERR_WRONG_COMMAND;
-}
-
-table_setup_objects::table_setup_objects()
- : PFS_engine_table(&m_share, &m_pos),
- m_row_exists(false), m_pos(), m_next_pos()
-{}
-
-void table_setup_objects::reset_position(void)
-{
- m_pos.reset();
- m_next_pos.reset();
-}
-
-int table_setup_objects::rnd_next(void)
-{
- PFS_table_share *table_share;
-
- for (m_pos.set_at(&m_next_pos);
- m_pos.has_more_view();
- m_pos.next_view())
- {
- switch (m_pos.m_index_1) {
- case pos_setup_objects::VIEW_TABLE:
- for ( ; m_pos.m_index_2 < table_share_max; m_pos.m_index_2++)
- {
- table_share= &table_share_array[m_pos.m_index_2];
- if (table_share->m_lock.is_populated())
- {
- make_row(table_share);
- m_next_pos.set_after(&m_pos);
- return 0;
- }
- }
- break;
- case pos_setup_objects::VIEW_EVENT:
- case pos_setup_objects::VIEW_PROCEDURE:
- case pos_setup_objects::VIEW_FUNCTION:
- default:
- break;
- }
- }
-
- return HA_ERR_END_OF_FILE;
-}
-
-int table_setup_objects::rnd_pos(const void *pos)
-{
- PFS_table_share *share;
-
- set_position(pos);
-
- switch (m_pos.m_index_1) {
- case pos_setup_objects::VIEW_TABLE:
- DBUG_ASSERT(m_pos.m_index_2 < table_share_max);
- share= &table_share_array[m_pos.m_index_2];
- if (share->m_lock.is_populated())
- {
- make_row(share);
- return 0;
- }
- break;
- case pos_setup_objects::VIEW_EVENT:
- case pos_setup_objects::VIEW_PROCEDURE:
- case pos_setup_objects::VIEW_FUNCTION:
- default:
- break;
- }
-
- return HA_ERR_RECORD_DELETED;
-}
-
-void table_setup_objects::make_row(PFS_table_share *share)
-{
- pfs_lock lock;
-
- m_row_exists= false;
- if (share == NULL)
- return;
-
- share->m_lock.begin_optimistic_lock(&lock);
-
- m_row.m_schema_name= &share->m_schema_name[0];
- m_row.m_schema_name_length= share->m_schema_name_length;
- m_row.m_object_name= &share->m_table_name[0];
- m_row.m_object_name_length= share->m_table_name_length;
- m_row.m_enabled_ptr= &share->m_enabled;
- m_row.m_timed_ptr= &share->m_timed;
- m_row.m_aggregated_ptr= &share->m_aggregated;
-
- if (share->m_lock.end_optimistic_lock(&lock))
- m_row_exists= true;
-}
-
-int table_setup_objects::read_row_values(TABLE *table,
- unsigned char *buf,
- Field **fields,
- bool read_all)
-{
- Field *f;
-
- if (unlikely(! m_row_exists))
- return HA_ERR_RECORD_DELETED;
-
- /* Set the null bits */
- DBUG_ASSERT(table->s->null_bytes == 1);
- buf[0]= 0;
-
- for (; (f= *fields) ; fields++)
- {
- if (read_all || bitmap_is_set(table->read_set, f->field_index))
- {
- switch(f->field_index)
- {
- case 0: /* OBJECT_TYPE */
- set_field_varchar_utf8(f, "TABLE", 5);
- break;
- case 1: /* OBJECT_SCHEMA */
- set_field_varchar_utf8(f, m_row.m_schema_name,
- m_row.m_schema_name_length);
- break;
- case 2: /* OBJECT_NAME */
- set_field_varchar_utf8(f, m_row.m_object_name,
- m_row.m_object_name_length);
- break;
- case 3: /* ENABLED */
- set_field_enum(f, (*m_row.m_enabled_ptr) ? ENUM_YES : ENUM_NO);
- break;
- case 4: /* TIMED */
- set_field_enum(f, (*m_row.m_timed_ptr) ? ENUM_YES : ENUM_NO);
- break;
- case 5: /* AGGREGATED */
- set_field_enum(f, (*m_row.m_aggregated_ptr) ? ENUM_YES : ENUM_NO);
- break;
- default:
- DBUG_ASSERT(false);
- }
- }
- }
-
- return 0;
-}
-
-int table_setup_objects::update_row_values(TABLE *table,
- const unsigned char *,
- unsigned char *,
- Field **fields)
-{
- Field *f;
- enum_yes_no value;
-
- for (; (f= *fields) ; fields++)
- {
- if (bitmap_is_set(table->write_set, f->field_index))
- {
- switch(f->field_index)
- {
- case 0: /* OBJECT_TYPE */
- case 1: /* OBJECT_SCHEMA */
- case 2: /* OBJECT_NAME */
- my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
- return HA_ERR_WRONG_COMMAND;
- case 3: /* ENABLED */
- value= (enum_yes_no) get_field_enum(f);
- *m_row.m_enabled_ptr= (value == ENUM_YES) ? true : false;
- break;
- case 4: /* TIMED */
- value= (enum_yes_no) get_field_enum(f);
- *m_row.m_timed_ptr= (value == ENUM_YES) ? true : false;
- break;
- case 5: /* AGGREGATED */
- value= (enum_yes_no) get_field_enum(f);
- *m_row.m_aggregated_ptr= (value == ENUM_YES) ? true : false;
- break;
- default:
- DBUG_ASSERT(false);
- }
- }
- }
-
- return 0;
-}
-
diff --git a/storage/perfschema/table_setup_objects.h b/storage/perfschema/table_setup_objects.h
deleted file mode 100644
index 994e12016a6..00000000000
--- a/storage/perfschema/table_setup_objects.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#ifndef TABLE_SETUP_OBJECTS_H
-#define TABLE_SETUP_OBJECTS_H
-
-/**
- @file storage/perfschema/table_setup_objects.h
- Table SETUP_OBJECTS (declarations).
-*/
-
-#include "pfs_instr_class.h"
-#include "pfs_engine_table.h"
-
-/**
- @addtogroup Performance_schema_tables
- @{
-*/
-
-/** A row of PERFORMANCE_SCHEMA.SETUP_OBJECTS. */
-struct row_setup_objects
-{
- /** Column SCHEMA_NAME. */
- const char *m_schema_name;
- /** Length in bytes of @c m_schema_name. */
- uint m_schema_name_length;
- /** Column OBJECT_NAME. */
- const char *m_object_name;
- /** Length in bytes of @c m_object_name. */
- uint m_object_name_length;
- /** Column ENABLED. */
- bool *m_enabled_ptr;
- /** Column TIMED. */
- bool *m_timed_ptr;
- /** Column AGGREGATED. */
- bool *m_aggregated_ptr;
-};
-
-/** Position of a cursor on PERFORMANCE_SCHEMA.SETUP_OBJECTS. */
-struct pos_setup_objects : public PFS_double_index,
- public PFS_object_view_constants
-{
- pos_setup_objects()
- : PFS_double_index(VIEW_TABLE, 0)
- {}
-
- inline void reset(void)
- {
- m_index_1= VIEW_TABLE;
- m_index_2= 0;
- }
-
- inline bool has_more_view(void)
- { return (m_index_1 <= VIEW_FUNCTION); }
-
- inline void next_view(void)
- {
- m_index_1++;
- m_index_2= 0;
- }
-};
-
-/** Table PERFORMANCE_SCHEMA.SETUP_OBJECTS. */
-class table_setup_objects : public PFS_engine_table
-{
-public:
- /** Table share. */
- static PFS_engine_table_share m_share;
- static PFS_engine_table* create();
- static int write_row(TABLE *table, unsigned char *buf, Field **fields);
- static int delete_all_rows();
-
- virtual int rnd_next();
- virtual int rnd_pos(const void *pos);
- virtual void reset_position(void);
-
-protected:
- virtual int read_row_values(TABLE *table,
- unsigned char *buf,
- Field **fields,
- bool read_all);
-
- virtual int update_row_values(TABLE *table,
- const unsigned char *old_buf,
- unsigned char *new_buf,
- Field **fields);
-
- table_setup_objects();
-
-public:
- ~table_setup_objects()
- {}
-
-private:
- void make_row(PFS_table_share *share);
-
- /** Table share lock. */
- static THR_LOCK m_table_lock;
- /** Fields definition. */
- static TABLE_FIELD_DEF m_field_def;
-
- /** Current row. */
- row_setup_objects m_row;
- /** True is the current row exists. */
- bool m_row_exists;
- /** Current position. */
- pos_setup_objects m_pos;
- /** Next position. */
- pos_setup_objects m_next_pos;
-};
-
-/** @} */
-#endif
diff --git a/storage/perfschema/table_processlist.cc b/storage/perfschema/table_threads.cc
index 06c628c5f80..bba7806cab9 100644
--- a/storage/perfschema/table_processlist.cc
+++ b/storage/perfschema/table_threads.cc
@@ -14,17 +14,17 @@
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
/**
- @file storage/perfschema/table_processlist.cc
- Table PROCESSLIST (implementation).
+ @file storage/perfschema/table_threads.cc
+ Table THREADS (implementation).
*/
#include "my_global.h"
#include "my_pthread.h"
-#include "table_processlist.h"
+#include "table_threads.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
-THR_LOCK table_processlist::m_table_lock;
+THR_LOCK table_threads::m_table_lock;
static const TABLE_FIELD_TYPE field_types[]=
{
@@ -46,15 +46,15 @@ static const TABLE_FIELD_TYPE field_types[]=
};
TABLE_FIELD_DEF
-table_processlist::m_field_def=
+table_threads::m_field_def=
{ 3, field_types };
PFS_engine_table_share
-table_processlist::m_share=
+table_threads::m_share=
{
- { C_STRING_WITH_LEN("PROCESSLIST") },
+ { C_STRING_WITH_LEN("THREADS") },
&pfs_readonly_acl,
- &table_processlist::create,
+ &table_threads::create,
NULL, /* write_row */
NULL, /* delete_all_rows */
1000, /* records */
@@ -64,23 +64,23 @@ table_processlist::m_share=
false /* checked */
};
-PFS_engine_table* table_processlist::create(void)
+PFS_engine_table* table_threads::create(void)
{
- return new table_processlist();
+ return new table_threads();
}
-table_processlist::table_processlist()
+table_threads::table_threads()
: PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(0), m_next_pos(0)
{}
-void table_processlist::reset_position(void)
+void table_threads::reset_position(void)
{
m_pos.m_index= 0;
m_next_pos.m_index= 0;
}
-int table_processlist::rnd_next(void)
+int table_threads::rnd_next(void)
{
PFS_thread *pfs;
@@ -100,7 +100,7 @@ int table_processlist::rnd_next(void)
return HA_ERR_END_OF_FILE;
}
-int table_processlist::rnd_pos(const void *pos)
+int table_threads::rnd_pos(const void *pos)
{
PFS_thread *pfs;
@@ -116,7 +116,7 @@ int table_processlist::rnd_pos(const void *pos)
return HA_ERR_RECORD_DELETED;
}
-void table_processlist::make_row(PFS_thread *pfs)
+void table_threads::make_row(PFS_thread *pfs)
{
pfs_lock lock;
PFS_thread_class *safe_class;
@@ -139,10 +139,10 @@ void table_processlist::make_row(PFS_thread *pfs)
m_row_exists= true;
}
-int table_processlist::read_row_values(TABLE *table,
- unsigned char *,
- Field **fields,
- bool read_all)
+int table_threads::read_row_values(TABLE *table,
+ unsigned char *,
+ Field **fields,
+ bool read_all)
{
Field *f;
diff --git a/storage/perfschema/table_processlist.h b/storage/perfschema/table_threads.h
index d4fe5e4af1a..9df323f6d82 100644
--- a/storage/perfschema/table_processlist.h
+++ b/storage/perfschema/table_threads.h
@@ -13,12 +13,12 @@
along with this program; if not, write to the Free Software Foundation,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#ifndef TABLE_PROCESSIST_H
-#define TABLE_PROCESSIST_H
+#ifndef TABLE_THREADS_H
+#define TABLE_THREADS_H
/**
- @file storage/perfschema/table_processlist.h
- Table PROCESSLIST (declarations).
+ @file storage/perfschema/table_threads.h
+ Table THREADS (declarations).
*/
#include "pfs_column_types.h"
@@ -31,8 +31,8 @@ struct PFS_thread;
@{
*/
-/** A row of PERFORMANCE_SCHEMA.PROCESSLIST. */
-struct row_processlist
+/** A row of PERFORMANCE_SCHEMA.THREADS. */
+struct row_threads
{
/** Column THREAD_ID. */
ulong m_thread_internal_id;
@@ -44,8 +44,8 @@ struct row_processlist
uint m_name_length;
};
-/** Table PERFORMANCE_SCHEMA.PROCESSLIST. */
-class table_processlist : public PFS_engine_table
+/** Table PERFORMANCE_SCHEMA.THREADS. */
+class table_threads : public PFS_engine_table
{
public:
/** Table share. */
@@ -63,10 +63,10 @@ protected:
bool read_all);
protected:
- table_processlist();
+ table_threads();
public:
- ~table_processlist()
+ ~table_threads()
{}
private:
@@ -78,7 +78,7 @@ private:
static TABLE_FIELD_DEF m_field_def;
/** Current row. */
- row_processlist m_row;
+ row_threads m_row;
/** True is the current row exists. */
bool m_row_exists;
/** Current position. */
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index d3b0b93a939..ecfac3170d1 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1469,7 +1469,7 @@ my_strnncoll_utf16_bin(CHARSET_INFO *cs,
}
if (s_wc != t_wc)
{
- return s_wc > t_wc ? 1 : -1;
+ return my_bincmp(s, s + s_res, t, t + t_res);
}
s+= s_res;
@@ -1511,7 +1511,7 @@ my_strnncollsp_utf16_bin(CHARSET_INFO *cs,
if (s_wc != t_wc)
{
- return s_wc > t_wc ? 1 : -1;
+ return my_bincmp(s, s + s_res, t, t + t_res);
}
s+= s_res;
@@ -1684,8 +1684,8 @@ static MY_COLLATION_HANDLER my_collation_utf16_bin_handler =
NULL, /* init */
my_strnncoll_utf16_bin,
my_strnncollsp_utf16_bin,
- my_strnxfrm_unicode,
- my_strnxfrmlen_simple,
+ my_strnxfrm_unicode_full_bin,
+ my_strnxfrmlen_unicode_full_bin,
my_like_range_utf16,
my_wildcmp_utf16_bin,
my_strcasecmp_mb2_or_mb4,
@@ -2711,8 +2711,8 @@ static MY_COLLATION_HANDLER my_collation_utf32_bin_handler =
NULL, /* init */
my_strnncoll_utf32_bin,
my_strnncollsp_utf32_bin,
- my_strnxfrm_unicode,
- my_strnxfrmlen_utf32,
+ my_strnxfrm_unicode_full_bin,
+ my_strnxfrmlen_unicode_full_bin,
my_like_range_utf32,
my_wildcmp_utf32_bin,
my_strcasecmp_mb2_or_mb4,
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index ace39130c12..76fff72290b 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1893,7 +1893,13 @@ my_wildcmp_unicode(CHARSET_INFO *cs,
/*
- This function is shared between utf8mb3/utf8mb4/ucs2/utf16/utf32
+ Store sorting weights using 2 bytes per character.
+
+ This function is shared between
+ - utf8mb3_general_ci, utf8_bin, ucs2_general_ci, ucs2_bin
+ which support BMP only (U+0000..U+FFFF).
+ - utf8mb4_general_ci, utf16_general_ci, utf32_general_ci,
+ which map all supplementary characters to weight 0xFFFD.
*/
size_t
my_strnxfrm_unicode(CHARSET_INFO *cs,
@@ -1937,6 +1943,70 @@ my_strnxfrm_unicode(CHARSET_INFO *cs,
}
+/*
+ Store sorting weights using 3 bytes per character.
+ This function is shared between utf8mb4_bin, utf16_bin, utf32_bin.
+*/
+size_t
+my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs,
+ uchar *dst, size_t dstlen,
+ const uchar *src, size_t srclen)
+{
+ my_wc_t wc;
+ uchar *de= dst + dstlen;
+ uchar *de_beg= de - 2; /* The beginning of the last chunk */
+ const uchar *se = src + srclen;
+
+ LINT_INIT(wc);
+ DBUG_ASSERT(src);
+ DBUG_ASSERT(cs->state & MY_CS_BINSORT);
+
+ while (dst < de_beg)
+ {
+ int res;
+ if ((res= cs->cset->mb_wc(cs, &wc, src, se)) <= 0)
+ break;
+ src+= res;
+ if (cs->mbminlen == 2) /* utf16_bin */
+ {
+ /*
+ Reorder code points to weights as follows:
+ U+0000..U+D7FF -> [00][00][00]..[00][D7][FF] BMP part #1
+ U+10000..U+10FFFF -> [01][00][00]..[10][FF][FF] Supplementary
+ U+E000..U+FFFF -> [20][E0][00]..[20][FF][FF] BMP part #2
+ */
+ if (wc >= 0xE000 && wc <= 0xFFFF)
+ wc+= 0x200000;
+ }
+ *dst++= (uchar) (wc >> 16);
+ *dst++= (uchar) ((wc >> 8) & 0xFF);
+ *dst++= (uchar) (wc & 0xFF);
+ }
+
+ while (dst < de_beg) /* Fill the tail with keys for space character */
+ {
+ *dst++= 0x00;
+ *dst++= 0x00;
+ *dst++= 0x20;
+ }
+
+ /* Clear the last one or two bytes, if "dstlen" was not divisible by 3 */
+ if (dst < de)
+ {
+ *dst++= 0x00;
+ if (dst < de)
+ *dst= 0x00;
+ }
+
+ return dstlen;
+}
+
+
+size_t
+my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *cs, size_t len)
+{
+ return ((len + 3) / cs->mbmaxlen) * 3;
+}
#endif /* HAVE_UNIDATA */
@@ -5067,8 +5137,8 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler =
NULL, /* init */
my_strnncoll_mb_bin,
my_strnncollsp_mb_bin,
- my_strnxfrm_unicode,
- my_strnxfrmlen_utf8mb4,
+ my_strnxfrm_unicode_full_bin,
+ my_strnxfrmlen_unicode_full_bin,
my_like_range_mb,
my_wildcmp_mb_bin,
my_strcasecmp_mb_bin,
diff --git a/support-files/my-innodb-heavy-4G.cnf.sh b/support-files/my-innodb-heavy-4G.cnf.sh
index 15e8d895667..80f1d6fe50b 100644
--- a/support-files/my-innodb-heavy-4G.cnf.sh
+++ b/support-files/my-innodb-heavy-4G.cnf.sh
@@ -109,6 +109,16 @@ binlog_cache_size = 1M
# table which could otherwise use up all memory resources.
max_heap_table_size = 64M
+# Size of the buffer used for doing full table scans.
+# Allocated per thread, if a full scan is needed.
+read_buffer_size = 2M
+
+# When reading rows in sorted order after a sort, the rows are read
+# through this buffer to avoid disk seeks. You can improve ORDER BY
+# performance a lot, if set this to a high value.
+# Allocated per thread, when needed.
+read_rnd_buffer_size = 16M
+
# Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
# queries. If sorted data does not fit into the sort buffer, a disk
# based merge sort is used instead - See the "Sort_merge_passes"
@@ -310,16 +320,6 @@ server-id = 1
# used for internal temporary disk tables.
key_buffer_size = 32M
-# Size of the buffer used for doing full table scans of MyISAM tables.
-# Allocated per thread, if a full scan is needed.
-read_buffer_size = 2M
-
-# When reading rows in sorted order after a sort, the rows are read
-# through this buffer to avoid disk seeks. You can improve ORDER BY
-# performance a lot, if set this to a high value.
-# Allocated per thread, when needed.
-read_rnd_buffer_size = 16M
-
# MyISAM uses special tree-like cache to make bulk inserts (that is,
# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
# INFILE) faster. This variable limits the size of the cache tree in
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index b4295027725..b17948fb75c 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -266,7 +266,7 @@ Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases
Requires: %{distro_requires}
Provides: msqlormysql mysql-server mysql MySQL MySQL-server
-Obsoletes: MySQL mysql mysql-server MySQL-server
+Obsoletes: MySQL mysql mysql-server MySQL-server MySQL-server-community
%description -n MySQL-server%{product_suffix}
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
@@ -296,7 +296,7 @@ package "MySQL-client%{product_suffix}" as well!
%package -n MySQL-client%{product_suffix}
Summary: MySQL - Client
Group: Applications/Databases
-Obsoletes: mysql-client MySQL-client
+Obsoletes: mysql-client MySQL-client MySQL-client-community
Provides: mysql-client MySQL-client
%description -n MySQL-client%{product_suffix}
@@ -310,7 +310,7 @@ Requires: MySQL-client%{product_suffix} perl
Summary: MySQL - Test suite
Group: Applications/Databases
Provides: mysql-test
-Obsoletes: mysql-bench mysql-test
+Obsoletes: mysql-bench mysql-test MySQL-test-community
AutoReqProv: no
%description -n MySQL-test%{product_suffix}
@@ -323,7 +323,7 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
Summary: MySQL - Development header files and libraries
Group: Applications/Databases
Provides: mysql-devel
-Obsoletes: mysql-devel
+Obsoletes: mysql-devel MySQL-devel-community
%description -n MySQL-devel%{product_suffix}
This package contains the development header files and libraries necessary
@@ -335,6 +335,7 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
%package -n MySQL-shared%{product_suffix}
Summary: MySQL - Shared libraries
Group: Applications/Databases
+Obsoletes: MySQL-shared-community
%description -n MySQL-shared%{product_suffix}
This package contains the shared libraries (*.so*) which certain languages
@@ -345,7 +346,7 @@ and applications need to dynamically load and use MySQL.
Summary: MySQL - embedded library
Group: Applications/Databases
Requires: MySQL-devel%{product_suffix}
-Obsoletes: mysql-embedded
+Obsoletes: mysql-embedded MySQL-embedded-community
%description -n MySQL-embedded%{product_suffix}
This package contains the MySQL server as an embedded library.
@@ -521,6 +522,9 @@ rm -f $RBR%{_mandir}/man1/make_win_bin_dist.1*
##############################################################################
%pre -n MySQL-server%{product_suffix}
+
+# ATTENTION: Parts of this are duplicated in the "triggerpostun" !
+
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.
@@ -669,6 +673,9 @@ if [ -x %{_sysconfdir}/init.d/mysql ] ; then
fi
%post -n MySQL-server%{product_suffix}
+
+# ATTENTION: Parts of this are duplicated in the "triggerpostun" !
+
mysql_datadir=%{mysqldatadir}
NEW_VERSION=%{mysql_version}-%{release}
STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
@@ -697,12 +704,12 @@ if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# 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
# use chkconfig on Enterprise Linux and newer SuSE releases
-elif [ -x /sbin/chkconfig ] ; then
+if [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --add mysql
+# use insserv for older SuSE Linux versions
+elif [ -x /sbin/insserv ] ; then
+ /sbin/insserv %{_sysconfdir}/init.d/mysql
fi
# ----------------------------------------------------------------------
@@ -783,12 +790,9 @@ if [ "$SERVER_TO_START" = "true" ] ; then
# Restart in the same way that mysqld will be started normally.
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql start
- echo "Giving mysqld 2 seconds to start"
- sleep 2
+ echo "Giving mysqld 5 seconds to start"
+ sleep 5
fi
-
- # Allow mysqld_safe to start mysqld and print a message before we exit
- sleep 2
fi
# Collect an upgrade history ...
@@ -797,7 +801,7 @@ echo >> $STATUS_FILE
echo "=====" >> $STATUS_FILE
STATUS_HISTORY=$mysql_datadir/RPM_UPGRADE_HISTORY
cat $STATUS_FILE >> $STATUS_HISTORY
-rm $STATUS_FILE
+mv -f $STATUS_FILE ${STATUS_FILE}-LAST # for "triggerpostun"
#echo "Thank you for installing the MySQL Community Server! For Production
@@ -808,17 +812,26 @@ rm $STATUS_FILE
%preun -n MySQL-server%{product_suffix}
+# Which '$1' does this refer to? Fedora docs have info:
+# " ... a count of the number of versions of the package that are installed.
+# Action Count
+# Install the first time 1
+# Upgrade 2 or higher (depending on the number of versions installed)
+# Remove last version of package 0 "
+#
+# http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s04s05.html
+
if [ $1 = 0 ] ; then
# Stop MySQL before uninstalling it
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null
# Remove autostart of MySQL
- # For older SuSE Linux versions
- if [ -x /sbin/insserv ] ; then
- /sbin/insserv -r %{_sysconfdir}/init.d/mysql
# use chkconfig on Enterprise Linux and newer SuSE releases
- elif [ -x /sbin/chkconfig ] ; then
+ if [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --del mysql
+ # For older SuSE Linux versions
+ elif [ -x /sbin/insserv ] ; then
+ /sbin/insserv -r %{_sysconfdir}/init.d/mysql
fi
fi
fi
@@ -826,6 +839,56 @@ fi
# We do not remove the mysql user since it may still own a lot of
# database files.
+%triggerpostun -n MySQL-server%{product_suffix} --MySQL-server-community
+
+# Setup: We renamed this package, so any existing "server-community"
+# package will be removed when this "server" is installed.
+# Problem: RPM will first run the "pre" and "post" sections of this script,
+# and only then the "preun" of that old community server.
+# But this "preun" includes stopping the server and uninstalling the service,
+# "chkconfig --del mysql" which removes the symlinks to the start script.
+# Solution: *After* the community server got removed, restart this server
+# and re-install the service.
+#
+# For information about triggers in spec files, see the Fedora docs:
+# http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch10s02.html
+# For all details of this code, see the "pre" and "post" sections.
+
+mysql_datadir=%{mysqldatadir}
+NEW_VERSION=%{mysql_version}-%{release}
+STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER-LAST # Note the difference!
+STATUS_HISTORY=$mysql_datadir/RPM_UPGRADE_HISTORY
+
+if [ -f $STATUS_FILE ] ; then
+ SERVER_TO_START=`grep '^SERVER_TO_START=' $STATUS_FILE | cut -c17-`
+else
+ # This should never happen, but let's be prepared
+ SERVER_TO_START=''
+fi
+echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
+
+if [ -x /sbin/chkconfig ] ; then
+ /sbin/chkconfig --add mysql
+# use insserv for older SuSE Linux versions
+elif [ -x /sbin/insserv ] ; then
+ /sbin/insserv %{_sysconfdir}/init.d/mysql
+fi
+
+# 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.
+ if [ -x %{_sysconfdir}/init.d/mysql ] ; then
+ %{_sysconfdir}/init.d/mysql start
+ echo "Giving mysqld 5 seconds to start"
+ sleep 5
+ fi
+fi
+
+echo "Trigger 'postun --community' finished at `date`" >> $STATUS_HISTORY
+echo >> $STATUS_HISTORY
+echo "=====" >> $STATUS_HISTORY
+
+
# ----------------------------------------------------------------------
# Clean up the BuildRoot after build is done
# ----------------------------------------------------------------------
@@ -1012,6 +1075,13 @@ fi
# merging BK trees)
##############################################################################
%changelog
+* Wed Aug 11 2010 Joerg Bruehe <joerg.bruehe@oracle.com>
+
+- With a recent spec file cleanup, names have changed: A "-community" part was dropped.
+ Reflect that in the "Obsoletes" specifications.
+- Add a "triggerpostun" to handle the uninstall of the "-community" server RPM.
+- This fixes bug#55015 "MySQL server is not restarted properly after RPM upgrade".
+
* Tue Jun 15 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Change the behaviour on installation and upgrade:
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index edb98f8c1a7..71dc56e31e7 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -13623,37 +13623,52 @@ static void test_bug15518()
}
-static void disable_general_log()
+static void disable_query_logs()
{
int rc;
rc= mysql_query(mysql, "set @@global.general_log=off");
myquery(rc);
+ rc= mysql_query(mysql, "set @@global.slow_query_log=off");
+ myquery(rc);
}
-static void enable_general_log(int truncate)
+static void enable_query_logs(int truncate)
{
int rc;
rc= mysql_query(mysql, "set @save_global_general_log=@@global.general_log");
myquery(rc);
+ rc= mysql_query(mysql, "set @save_global_slow_query_log=@@global.slow_query_log");
+ myquery(rc);
+
rc= mysql_query(mysql, "set @@global.general_log=on");
myquery(rc);
+ rc= mysql_query(mysql, "set @@global.slow_query_log=on");
+ myquery(rc);
+
+
if (truncate)
{
rc= mysql_query(mysql, "truncate mysql.general_log");
myquery(rc);
+
+ rc= mysql_query(mysql, "truncate mysql.slow_log");
+ myquery(rc);
}
}
-static void restore_general_log()
+static void restore_query_logs()
{
int rc;
rc= mysql_query(mysql, "set @@global.general_log=@save_global_general_log");
myquery(rc);
+
+ rc= mysql_query(mysql, "set @@global.slow_query_log=@save_global_slow_query_log");
+ myquery(rc);
}
@@ -15823,7 +15838,7 @@ static void test_bug17667()
return;
}
- enable_general_log(1);
+ enable_query_logs(1);
for (statement_cursor= statements; statement_cursor->buffer != NULL;
statement_cursor++)
@@ -15903,7 +15918,7 @@ static void test_bug17667()
statement_cursor->buffer);
}
- restore_general_log();
+ restore_query_logs();
if (!opt_silent)
printf("success. All queries found intact in the log.\n");
@@ -17766,7 +17781,7 @@ static void test_bug28386()
}
mysql_free_result(result);
- enable_general_log(1);
+ enable_query_logs(1);
stmt= mysql_simple_prepare(mysql, "SELECT ?");
check_stmt(stmt);
@@ -17805,7 +17820,7 @@ static void test_bug28386()
mysql_free_result(result);
- restore_general_log();
+ restore_query_logs();
DBUG_VOID_RETURN;
}
@@ -18856,7 +18871,7 @@ static void test_bug42373()
Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
*/
-static void test_bug54041()
+static void test_bug54041_impl()
{
int rc;
MYSQL_STMT *stmt;
@@ -18871,7 +18886,7 @@ static void test_bug54041()
rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
myquery(rc);
- stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (a) VALUES (?)");
+ stmt= mysql_simple_prepare(mysql, "SELECT a FROM t1 WHERE a > ?");
check_stmt(stmt);
verify_param_count(stmt, 1);
@@ -18909,6 +18924,20 @@ static void test_bug54041()
}
+/**
+ Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
+*/
+
+static void test_bug54041()
+{
+ enable_query_logs(0);
+ test_bug54041_impl();
+ disable_query_logs();
+ test_bug54041_impl();
+ restore_query_logs();
+}
+
+
/*
Bug#49972: Crash in prepared statements.
@@ -19098,7 +19127,7 @@ and you are welcome to modify and redistribute it under the GPL license\n");
static struct my_tests_st my_tests[]= {
- { "disable_general_log", disable_general_log },
+ { "disable_query_logs", disable_query_logs },
{ "test_view_sp_list_fields", test_view_sp_list_fields },
{ "client_query", client_query },
{ "test_prepare_insert_update", test_prepare_insert_update},
diff --git a/vio/vio.c b/vio/vio.c
index 67704a56b22..48f103c33e8 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -44,6 +44,11 @@ static my_bool no_poll_read(Vio *vio __attribute__((unused)),
#endif
+static my_bool has_no_data(Vio *vio __attribute__((unused)))
+{
+ return FALSE;
+}
+
/*
* Helper to fill most of the Vio* with defaults.
*/
@@ -83,6 +88,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->poll_read =no_poll_read;
vio->is_connected =vio_is_connected_pipe;
+ vio->has_data =has_no_data;
vio->timeout=vio_win32_timeout;
/* Set default timeout */
@@ -110,6 +116,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->poll_read =no_poll_read;
vio->is_connected =vio_is_connected_shared_memory;
+ vio->has_data =has_no_data;
/* Currently, shared memory is on Windows only, hence the below is ok*/
vio->timeout= vio_win32_timeout;
@@ -137,6 +144,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->timeout =vio_timeout;
vio->poll_read =vio_poll_read;
vio->is_connected =vio_is_connected;
+ vio->has_data =vio_ssl_has_data;
DBUG_VOID_RETURN;
}
#endif /* HAVE_OPENSSL */
@@ -155,6 +163,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->timeout =vio_timeout;
vio->poll_read =vio_poll_read;
vio->is_connected =vio_is_connected;
+ vio->has_data= (flags & VIO_BUFFERED_READ) ?
+ vio_buff_has_data : has_no_data;
DBUG_VOID_RETURN;
}
diff --git a/vio/vio_priv.h b/vio/vio_priv.h
index 69eb26083d6..1bfb857b039 100644
--- a/vio/vio_priv.h
+++ b/vio/vio_priv.h
@@ -49,6 +49,7 @@ int vio_close_shared_memory(Vio * vio);
#endif
void vio_timeout(Vio *vio,uint which, uint timeout);
+my_bool vio_buff_has_data(Vio *vio);
#ifdef HAVE_OPENSSL
#include "my_net.h" /* needed because of struct in_addr */
@@ -62,5 +63,7 @@ void vio_ssl_delete(Vio *vio);
int vio_ssl_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode);
+my_bool vio_ssl_has_data(Vio *vio);
+
#endif /* HAVE_OPENSSL */
#endif /* VIO_PRIV_INCLUDED */
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 9c0243db4f3..163eb279d45 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -98,6 +98,10 @@ size_t vio_read_buff(Vio *vio, uchar* buf, size_t size)
#undef VIO_UNBUFFERED_READ_MIN_SIZE
}
+my_bool vio_buff_has_data(Vio *vio)
+{
+ return (vio->read_pos != vio->read_end);
+}
size_t vio_write(Vio * vio, const uchar* buf, size_t size)
{
diff --git a/vio/viossl.c b/vio/viossl.c
index 79f358b047c..5cb5f36f20d 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -244,6 +244,9 @@ int vio_ssl_blocking(Vio *vio __attribute__((unused)),
return (set_blocking_mode ? 0 : 1);
}
-
+my_bool vio_ssl_has_data(Vio *vio)
+{
+ return SSL_pending(vio->ssl_arg) > 0 ? TRUE : FALSE;
+}
#endif /* HAVE_OPENSSL */