summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1
-rw-r--r--BUILD/FINISH.sh1
-rw-r--r--BUILD/Makefile.am3
-rwxr-xr-xBUILD/SETUP.sh12
-rwxr-xr-xBUILD/autorun.sh4
-rwxr-xr-xBUILD/build_mccge.sh18
-rwxr-xr-xBUILD/check-cpu146
-rw-r--r--BUILD/cmake_configure.sh (renamed from BUILD/choose_configure.sh)0
-rwxr-xr-xBUILD/compile-ndb-autotest12
-rwxr-xr-xBUILD/compile-pentium-debug1
-rwxr-xr-xBUILD/compile-pentium-debug-max1
-rwxr-xr-xBUILD/compile-pentium-debug-max-no-ndb1
-rwxr-xr-xBUILD/compile-pentium-debug-openssl2
-rwxr-xr-xBUILD/compile-pentium-debug-yassl2
-rwxr-xr-xBUILD/compile-pentium-mysqlfs-debug11
-rwxr-xr-xBUILD/compile-pentium64-debug1
-rwxr-xr-xBUILD/compile-pentium64-debug-max1
-rw-r--r--CMakeLists.txt28
-rw-r--r--Makefile.am4
-rw-r--r--client/CMakeLists.txt4
-rw-r--r--client/mysql.cc4
-rw-r--r--client/mysql_upgrade.c8
-rw-r--r--client/mysqltest.cc129
-rw-r--r--cmake/abi_check.cmake4
-rw-r--r--cmake/configure.pl5
-rw-r--r--cmake/plugin.cmake29
-rw-r--r--cmd-line-utils/libedit/CMakeLists.txt8
-rw-r--r--cmd-line-utils/readline/CMakeLists.txt4
-rw-r--r--config/ac-macros/ha_ndbcluster.m42
-rw-r--r--configure.in39
-rw-r--r--dbug/CMakeLists.txt4
-rw-r--r--extra/CMakeLists.txt5
-rw-r--r--extra/comp_err.c2
-rw-r--r--extra/yassl/CMakeLists.txt4
-rw-r--r--extra/yassl/src/yassl_imp.cpp24
-rw-r--r--extra/yassl/taocrypt/CMakeLists.txt4
-rw-r--r--include/CMakeLists.txt8
-rw-r--r--include/my_pthread.h5
-rw-r--r--include/mysql.h2
-rw-r--r--include/mysql.h.pp1
-rw-r--r--include/mysql/plugin.h.pp3
-rw-r--r--include/mysql/service_my_snprintf.h3
-rw-r--r--include/mysql/service_thd_alloc.h2
-rw-r--r--include/mysys_err.h4
-rw-r--r--include/thr_lock.h19
-rw-r--r--libmysql/CMakeLists.txt4
-rw-r--r--libmysqld/CMakeLists.txt7
-rw-r--r--libmysqld/Makefile.am7
-rw-r--r--libmysqld/examples/CMakeLists.txt4
-rw-r--r--libservices/CMakeLists.txt4
-rw-r--r--man/CMakeLists.txt8
-rw-r--r--mysql-test/CMakeLists.txt8
-rw-r--r--mysql-test/extra/rpl_tests/create_recursive_construct.inc23
-rw-r--r--mysql-test/include/handler.inc32
-rw-r--r--mysql-test/include/mix2.inc4
-rw-r--r--mysql-test/include/mysql_upgrade_preparation.inc30
-rw-r--r--mysql-test/lib/My/Config.pm2
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm12
-rw-r--r--mysql-test/lib/My/SafeProcess.pm15
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt4
-rw-r--r--mysql-test/lib/mtr_cases.pm2
-rw-r--r--mysql-test/lib/mtr_report.pm2
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl15
-rwxr-xr-xmysql-test/mysql-test-run.pl168
-rw-r--r--mysql-test/r/alter_table.result13
-rw-r--r--mysql-test/r/csv.result43
-rw-r--r--mysql-test/r/func_group.result11
-rw-r--r--mysql-test/r/handler_innodb.result20
-rw-r--r--mysql-test/r/handler_myisam.result20
-rw-r--r--mysql-test/r/innodb_mysql_lock.result32
-rw-r--r--mysql-test/r/innodb_mysql_sync.result18
-rw-r--r--mysql-test/r/lowercase_table2.result3
-rw-r--r--mysql-test/r/mdl_sync.result237
-rw-r--r--mysql-test/r/merge.result840
-rw-r--r--mysql-test/r/merge_mmap.result190
-rw-r--r--mysql-test/r/mysql_upgrade_ssl.result32
-rw-r--r--mysql-test/r/mysqltest.result7
-rw-r--r--mysql-test/r/not_partition.result18
-rw-r--r--mysql-test/r/partition_debug_sync.result2
-rw-r--r--mysql-test/r/partition_disabled.result2
-rw-r--r--mysql-test/r/partition_innodb.result62
-rw-r--r--mysql-test/r/partition_truncate.result8
-rw-r--r--mysql-test/r/schema.result51
-rw-r--r--mysql-test/r/show_check.result48
-rw-r--r--mysql-test/r/signal.result41
-rw-r--r--mysql-test/r/signal_demo3.result18
-rw-r--r--mysql-test/r/sp-big.result2
-rw-r--r--mysql-test/r/sp-bugs.result2
-rw-r--r--mysql-test/r/sp-code.result57
-rw-r--r--mysql-test/r/sp-error.result247
-rw-r--r--mysql-test/r/sp.result176
-rw-r--r--mysql-test/r/sp_trans.result4
-rw-r--r--mysql-test/r/strict.result2
-rw-r--r--mysql-test/r/temp_table.result12
-rw-r--r--mysql-test/r/variables.result22
-rw-r--r--mysql-test/r/view.result8
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result22
-rw-r--r--mysql-test/suite/binlog/r/binlog_unsafe.result1497
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test20
-rw-r--r--mysql-test/suite/binlog/t/binlog_unsafe.test1
-rw-r--r--mysql-test/suite/binlog/t/disabled.def1
-rw-r--r--mysql-test/suite/federated/federated_server.result8
-rw-r--r--mysql-test/suite/federated/federated_server.test8
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_02.result44
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_06.result11
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_10.result4
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_03.result19
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_03e.result16
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_08.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_storedproc_02.result44
-rw-r--r--mysql-test/suite/funcs_1/r/memory_storedproc_06.result11
-rw-r--r--mysql-test/suite/funcs_1/r/memory_storedproc_10.result4
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_03.result19
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_03e.result15
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_08.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_storedproc_02.result44
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_storedproc_06.result11
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_storedproc_10.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_03.result19
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_03e.result15
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_08.result2
-rw-r--r--mysql-test/suite/funcs_1/r/ndb_storedproc_06.result11
-rw-r--r--mysql-test/suite/funcs_1/r/ndb_storedproc_10.result4
-rw-r--r--mysql-test/suite/funcs_1/r/ndb_trig_03.result19
-rw-r--r--mysql-test/suite/funcs_1/r/ndb_trig_03e.result16
-rw-r--r--mysql-test/suite/funcs_1/r/ndb_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/ndb_trig_08.result2
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result77
-rw-r--r--mysql-test/suite/funcs_1/storedproc/storedproc_06.inc11
-rw-r--r--mysql-test/suite/funcs_1/storedproc/storedproc_10.inc4
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03.inc19
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc2
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc2
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc2
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc1
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_global_db_mix.inc4
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc2
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc2
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc1
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_0407.inc2
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_08.inc2
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql.test4
-rw-r--r--mysql-test/suite/ndb/r/ndb_cursor.result2
-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/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/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.test41
-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/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_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.result8
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result7
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result7
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result5
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result5
-rw-r--r--mysql-test/suite/perfschema/t/aggregate.test22
-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/server_init.test6
-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_begin_commit_rollback.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_conditional_comments.result67
-rw-r--r--mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result48
-rw-r--r--mysql-test/suite/rpl/r/rpl_packet.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp005.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_trig003.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result4
-rw-r--r--mysql-test/suite/rpl/t/rpl_conditional_comments.test74
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test39
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result2
-rw-r--r--mysql-test/suite/rpl_ndb/t/disabled.def1
-rw-r--r--mysql-test/t/alter_table.test16
-rw-r--r--mysql-test/t/csv.test15
-rw-r--r--mysql-test/t/func_group.test10
-rw-r--r--mysql-test/t/innodb_mysql_lock.test68
-rw-r--r--mysql-test/t/innodb_mysql_sync.test26
-rw-r--r--mysql-test/t/mdl_sync.test475
-rw-r--r--mysql-test/t/merge-big.test4
-rw-r--r--mysql-test/t/merge.test454
-rw-r--r--mysql-test/t/merge_mmap-master.opt1
-rw-r--r--mysql-test/t/merge_mmap.test151
-rw-r--r--mysql-test/t/mysql_upgrade.test29
-rw-r--r--mysql-test/t/mysql_upgrade_ssl.test10
-rw-r--r--mysql-test/t/mysqltest.test57
-rw-r--r--mysql-test/t/not_partition.test1
-rw-r--r--mysql-test/t/partition_debug_sync.test2
-rw-r--r--mysql-test/t/partition_innodb.test44
-rw-r--r--mysql-test/t/partition_truncate.test7
-rw-r--r--mysql-test/t/schema.test99
-rw-r--r--mysql-test/t/show_check.test79
-rw-r--r--mysql-test/t/signal.test5
-rw-r--r--mysql-test/t/sp-code.test53
-rw-r--r--mysql-test/t/sp-error.test270
-rw-r--r--mysql-test/t/sp.test35
-rw-r--r--mysql-test/t/temp_table.test15
-rw-r--r--mysql-test/t/variables.test26
-rw-r--r--mysys/CMakeLists.txt6
-rw-r--r--mysys/errors.c6
-rw-r--r--mysys/mf_iocache.c63
-rw-r--r--mysys/my_copy.c20
-rw-r--r--mysys/my_redel.c24
-rw-r--r--mysys/thr_lock.c51
-rw-r--r--plugin/audit_null/CMakeLists.txt8
-rw-r--r--plugin/audit_null/audit_null.c2
-rw-r--r--plugin/daemon_example/CMakeLists.txt8
-rw-r--r--plugin/fulltext/CMakeLists.txt8
-rw-r--r--plugin/semisync/CMakeLists.txt6
-rw-r--r--regex/CMakeLists.txt5
-rw-r--r--regex/engine.c17
-rw-r--r--scripts/CMakeLists.txt71
-rw-r--r--scripts/mysql_config.sh2
-rw-r--r--scripts/mysql_system_tables.sql86
-rw-r--r--sql-bench/CMakeLists.txt41
-rw-r--r--sql/CMakeLists.txt24
-rw-r--r--sql/Makefile.am9
-rw-r--r--sql/datadict.cc67
-rw-r--r--sql/datadict.h2
-rw-r--r--sql/event_data_objects.cc18
-rw-r--r--sql/event_db_repository.cc74
-rw-r--r--sql/event_db_repository.h5
-rw-r--r--sql/events.cc14
-rw-r--r--sql/examples/CMakeLists.txt4
-rw-r--r--sql/field.cc2
-rw-r--r--sql/ha_ndbcluster.cc4
-rw-r--r--sql/ha_ndbcluster_binlog.cc20
-rw-r--r--sql/ha_ndbcluster_cond.cc227
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/handler.h1
-rw-r--r--sql/item.cc12
-rw-r--r--sql/item.h10
-rw-r--r--sql/lock.cc173
-rw-r--r--sql/lock.h5
-rw-r--r--sql/log.cc77
-rw-r--r--sql/log_event.cc64
-rw-r--r--sql/mdl.cc227
-rw-r--r--sql/mdl.h21
-rw-r--r--sql/mysqld.cc30
-rw-r--r--sql/mysqld.h6
-rw-r--r--sql/partition_info.cc2
-rw-r--r--sql/protocol.cc16
-rw-r--r--sql/rpl_rli.cc16
-rw-r--r--sql/set_var.cc1
-rw-r--r--sql/share/CMakeLists.txt8
-rw-r--r--sql/slave.cc8
-rw-r--r--sql/sp.cc16
-rw-r--r--sql/sp_head.cc261
-rw-r--r--sql/sp_head.h2
-rw-r--r--sql/sp_pcontext.h7
-rw-r--r--sql/sp_rcontext.cc242
-rw-r--r--sql/sp_rcontext.h69
-rw-r--r--sql/spatial.cc3
-rw-r--r--sql/sql_acl.cc147
-rw-r--r--sql/sql_admin.cc1004
-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_base.cc707
-rw-r--r--sql/sql_base.h21
-rw-r--r--sql/sql_cache.cc3
-rw-r--r--sql/sql_class.cc168
-rw-r--r--sql/sql_class.h184
-rw-r--r--sql/sql_cursor.cc385
-rw-r--r--sql/sql_cursor.h16
-rw-r--r--sql/sql_db.cc325
-rw-r--r--sql/sql_db.h7
-rw-r--r--sql/sql_delete.cc4
-rw-r--r--sql/sql_do.cc5
-rw-r--r--sql/sql_error.cc8
-rw-r--r--sql/sql_error.h16
-rw-r--r--sql/sql_handler.cc25
-rw-r--r--sql/sql_help.cc23
-rw-r--r--sql/sql_hset.h97
-rw-r--r--sql/sql_insert.cc44
-rw-r--r--sql/sql_lex.cc26
-rw-r--r--sql/sql_lex.h167
-rw-r--r--sql/sql_load.cc15
-rw-r--r--sql/sql_parse.cc450
-rw-r--r--sql/sql_parse.h4
-rw-r--r--sql/sql_partition.cc314
-rw-r--r--sql/sql_partition.h2
-rw-r--r--sql/sql_partition_admin.cc139
-rw-r--r--sql/sql_partition_admin.h236
-rw-r--r--sql/sql_plugin.cc4
-rw-r--r--sql/sql_prepare.cc55
-rw-r--r--sql/sql_priv.h10
-rw-r--r--sql/sql_rename.cc10
-rw-r--r--sql/sql_repl.cc12
-rw-r--r--sql/sql_select.cc89
-rw-r--r--sql/sql_select.h6
-rw-r--r--sql/sql_servers.cc17
-rw-r--r--sql/sql_show.cc91
-rw-r--r--sql/sql_signal.cc12
-rw-r--r--sql/sql_table.cc1066
-rw-r--r--sql/sql_table.h31
-rw-r--r--sql/sql_trigger.cc27
-rw-r--r--sql/sql_truncate.cc92
-rw-r--r--sql/sql_truncate.h26
-rw-r--r--sql/sql_udf.cc4
-rw-r--r--sql/sql_union.cc3
-rw-r--r--sql/sql_update.cc4
-rw-r--r--sql/sql_view.cc7
-rw-r--r--sql/sql_yacc.yy126
-rw-r--r--sql/sys_vars.cc15
-rw-r--r--sql/table.cc3
-rw-r--r--sql/table.h3
-rw-r--r--sql/transaction.cc27
-rw-r--r--sql/tztime.cc12
-rw-r--r--sql/udf_example.c2
-rw-r--r--storage/archive/CMakeLists.txt5
-rw-r--r--storage/blackhole/CMakeLists.txt5
-rw-r--r--storage/csv/CMakeLists.txt4
-rw-r--r--storage/csv/ha_tina.cc12
-rw-r--r--storage/example/CMakeLists.txt4
-rw-r--r--storage/example/ha_example.cc2
-rw-r--r--storage/federated/CMakeLists.txt4
-rw-r--r--storage/heap/CMakeLists.txt4
-rw-r--r--storage/ibmdb2i/CMakeLists.txt4
-rw-r--r--storage/innobase/CMakeLists.txt8
-rw-r--r--storage/myisam/CMakeLists.txt4
-rw-r--r--storage/myisam/mi_locking.c14
-rw-r--r--storage/myisam/mi_statrec.c20
-rw-r--r--storage/myisam/rt_split.c3
-rw-r--r--storage/myisammrg/CMakeLists.txt4
-rw-r--r--storage/myisammrg/ha_myisammrg.cc25
-rw-r--r--storage/myisammrg/myrg_open.c5
-rw-r--r--storage/perfschema/CMakeLists.txt8
-rw-r--r--storage/perfschema/Makefile.am12
-rw-r--r--storage/perfschema/pfs.cc7
-rw-r--r--storage/perfschema/pfs_engine_table.cc9
-rw-r--r--storage/perfschema/pfs_events_waits.cc25
-rw-r--r--storage/perfschema/pfs_events_waits.h2
-rw-r--r--storage/perfschema/table_events_waits.cc12
-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/CMakeLists.txt4
-rw-r--r--strings/ctype-big5.c86
-rw-r--r--strings/ctype-cp932.c77
-rw-r--r--strings/ctype-euc_kr.c4
-rw-r--r--strings/ctype-eucjpms.c4
-rw-r--r--strings/ctype-gb2312.c4
-rw-r--r--strings/ctype-gbk.c86
-rw-r--r--strings/ctype-mb.c22
-rw-r--r--strings/ctype-sjis.c86
-rw-r--r--strings/ctype-ujis.c4
-rw-r--r--strings/decimal.c3
-rw-r--r--support-files/CMakeLists.txt8
-rw-r--r--support-files/mysql.spec.sh108
-rw-r--r--tests/CMakeLists.txt4
-rw-r--r--unittest/Makefile.am4
-rw-r--r--unittest/examples/CMakeLists.txt5
-rw-r--r--unittest/mysys/CMakeLists.txt4
-rw-r--r--unittest/mytap/CMakeLists.txt5
-rw-r--r--unittest/strings/Makefile.am27
-rw-r--r--unittest/strings/strings-t.c114
-rw-r--r--vio/CMakeLists.txt5
-rw-r--r--zlib/CMakeLists.txt5
424 files changed, 19809 insertions, 7766 deletions
diff --git a/.bzrignore b/.bzrignore
index f5f678ca360..a17b1dec6cb 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -3101,3 +3101,4 @@ libmysqld/merge_archives_mysqlserver.cmake
libmysqld/mysqlserver_depends.c
libmysqld/examples/mysql_embedded
sql/.empty
+mysys/thr_lock
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh
index 142ff7eb08e..b7f7a1db77e 100644
--- a/BUILD/FINISH.sh
+++ b/BUILD/FINISH.sh
@@ -6,6 +6,7 @@ configure="./configure $base_configs $extra_configs"
commands="\
$make -k maintainer-clean || true
/bin/rm -rf */.deps/*.P configure config.cache storage/*/configure storage/*/config.cache autom4te.cache storage/*/autom4te.cache;
+/bin/rm -rf CMakeCache.txt CMakeFiles/
path=`dirname $0`
. \"$path/autorun.sh\""
diff --git a/BUILD/Makefile.am b/BUILD/Makefile.am
index c7bf813c9fe..56c86e7a80c 100644
--- a/BUILD/Makefile.am
+++ b/BUILD/Makefile.am
@@ -20,7 +20,7 @@
EXTRA_DIST = FINISH.sh \
SETUP.sh \
autorun.sh \
- choose_configure.sh \
+ cmake_configure.sh \
build_mccge.sh \
check-cpu \
cleanup \
@@ -52,7 +52,6 @@ EXTRA_DIST = FINISH.sh \
compile-pentium-icc-yassl \
compile-pentium-max \
compile-pentium-myodbc \
- compile-pentium-mysqlfs-debug \
compile-pentium-pgcc \
compile-pentium-valgrind-max \
compile-pentium64 \
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index afb8eca08f2..a23a801e7e0 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -14,7 +14,6 @@ Usage: $0 [-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
- --with-debug=full Build with full debug.
--warning-mode=[old|pedantic|maintainer]
Influences the debug flags. Old is default.
--prefix=path Build with prefix 'path'.
@@ -30,8 +29,6 @@ parse_options()
case "$1" in
--prefix=*)
prefix=`get_key_value "$1"`;;
- --with-debug=full)
- full_debug="=full";;
--warning-mode=*)
warning_mode=`get_key_value "$1"`;;
-c | --just-configure)
@@ -60,7 +57,6 @@ fi
prefix="/usr/local/mysql"
just_print=
just_configure=
-full_debug=
warning_mode=
maintainer_mode=
@@ -116,7 +112,6 @@ else
cxx_warnings="$warnings -Wno-unused-parameter"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
-# Added unless --with-debug=full
debug_extra_cflags="-O0 -g3 -gdwarf-2"
fi
@@ -141,11 +136,8 @@ base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
# Be as fast as we can be without losing our ability to backtrace.
fast_cflags="-O3 -fno-omit-frame-pointer"
-debug_configs="--with-debug$full_debug"
-if [ -z "$full_debug" ]
-then
- debug_cflags="$debug_cflags $debug_extra_cflags"
-fi
+debug_configs="--with-debug"
+debug_cflags="$debug_cflags $debug_extra_cflags"
#
# Configuration options.
diff --git a/BUILD/autorun.sh b/BUILD/autorun.sh
index f45b1f7d08c..f4508ab12b6 100755
--- a/BUILD/autorun.sh
+++ b/BUILD/autorun.sh
@@ -31,8 +31,8 @@ $LIBTOOLIZE --automake --force --copy || die "Can't execute libtoolize"
automake --add-missing --force --copy || die "Can't execute automake"
autoconf || die "Can't execute autoconf"
# Do not use autotools generated configure directly. Instead, use a script
-# that will either call CMake or original configure shell script at build
+# that will either call CMake or original configure shell script at build
# time (CMake is preferred if installed).
mv configure configure.am
-cp BUILD/choose_configure.sh configure
+cp BUILD/cmake_configure.sh configure
chmod a+x configure
diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh
index aae017aa54d..cb70a8cef67 100755
--- a/BUILD/build_mccge.sh
+++ b/BUILD/build_mccge.sh
@@ -148,7 +148,6 @@ Usage: $0 [options]
--extended-help Show extended help message
--without-debug Build non-debug version
--with-debug Build debug version
- --with-debug=full Build with full debug.
--configure-only Stop after running configure.
--use-autotools Start by running autoconf, automake,.. tools
--no-autotools Start from configure
@@ -262,10 +261,6 @@ extended_usage()
This flag prevents the use of GPL libraries which cannot be used
under a commercial license, such as the readline library.
- --with-debug[=full]
- This option will ensure that the version is built with debug
- information enabled; the optimisation level is decreased to -O.
-
--developer
This option changes a number of things to make the version built
more appropriate to the debugging and testing needs of developers.
@@ -658,11 +653,6 @@ parse_options()
--datadir=*)
datadir=`get_key_value "$1"`
;;
- --with-debug=full)
- full_debug="=full"
- with_debug_flag="yes"
- fast_flag="no"
- ;;
--without-debug)
with_debug_flag="no"
if test "x$fast_flag" != "xyes" ; then
@@ -1044,10 +1034,7 @@ set_warning_flags()
# C++ warnings
cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder"
cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
-# Added unless --with-debug=full
- if test "x$full_debug" = "x" ; then
- compiler_flags="$compiler_flags -Wuninitialized"
- fi
+ compiler_flags="$compiler_flags -Wuninitialized"
elif test "x$warning_mode" = "xpedantic" ; then
warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE"
c_warnings="$warnings"
@@ -1113,7 +1100,7 @@ set_base_configs()
base_configs="$base_configs --localstatedir=$datadir"
fi
if test "x$with_debug_flag" = "xyes" ; then
- base_configs="$base_configs --with-debug$full_debug"
+ base_configs="$base_configs --with-debug"
fi
base_configs="$base_configs --enable-local-infile"
base_configs="$base_configs --enable-thread-safe-client"
@@ -1546,7 +1533,6 @@ gpl="yes"
version_text=
developer_flag="no"
just_configure=
-full_debug=
warning_mode=
with_flags=
error_inject_flag=
diff --git a/BUILD/check-cpu b/BUILD/check-cpu
index f9f5d423f4f..585043de67c 100755
--- a/BUILD/check-cpu
+++ b/BUILD/check-cpu
@@ -7,6 +7,79 @@
# check_cpu_args : Arguments for GCC compiler settings
#
+check_compiler_cpu_flags () {
+ # different compiler versions have different option names
+ # for CPU specific command line options
+ if test -z "$CC" ; then
+ cc="gcc";
+ else
+ cc=$CC
+ fi
+
+ # check if compiler is gcc and dump its version
+ cc_verno=`$cc -dumpversion 2>/dev/null`
+ if test "x$?" = "x0" ; then
+ set -- `echo $cc_verno | tr '.' ' '`
+ cc_ver="GCC"
+ cc_major=$1
+ cc_minor=$2
+ cc_patch=$3
+ cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
+ fi
+
+ case "$cc_ver--$cc_verno" in
+ *GCC*)
+ # different gcc backends (and versions) have different CPU flags
+ case `gcc -dumpmachine` in
+ i?86-* | x86_64-*)
+ if test "$cc_comp" -lt 304 ; then
+ check_cpu_cflags="-mcpu=${cpu_arg}"
+ elif test "$cc_comp" -ge 402 ; then
+ check_cpu_cflags="-mtune=native"
+ else
+ check_cpu_cflags="-mtune=${cpu_arg}"
+ fi
+ ;;
+ ppc-*)
+ check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
+ ;;
+ *)
+ check_cpu_cflags=""
+ return
+ ;;
+ esac
+ ;;
+ 2.95.*)
+ # GCC 2.95 doesn't expose its name in --version output
+ check_cpu_cflags="-m${cpu_arg}"
+ ;;
+ *)
+ check_cpu_cflags=""
+ return
+ ;;
+ esac
+
+ # now we check whether the compiler really understands the cpu type
+ touch __test.c
+
+ while [ "$cpu_arg" ] ; do
+ printf "testing $cpu_arg ... " >&2
+
+ # compile check
+ eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
+ if test "x$?" = "x0" ; then
+ echo ok >&2
+ break;
+ fi
+
+ echo failed >&2
+ check_cpu_cflags=""
+ break;
+ done
+ rm __test.*
+ return 0
+}
+
check_cpu () {
CPUINFO=/proc/cpuinfo
if test -n "$TEST_CPUINFO" ; then
@@ -179,83 +252,14 @@ check_cpu () {
return
fi
- # different compiler versions have different option names
- # for CPU specific command line options
- if test -z "$CC" ; then
- cc="gcc";
- else
- cc=$CC
+ if test "x$compiler" = "x" ; then
+ check_compiler_cpu_flags
fi
if test "x$core2" = "xyes" ; then
cpu_arg="core2"
fi
- if test "x$compiler" != "x" ; then
- return 0
- fi
-
- # check if compiler is gcc and dump its version
- cc_verno=`$cc -dumpversion 2>/dev/null`
- if test "x$?" = "x0" ; then
- set -- `echo $cc_verno | tr '.' ' '`
- cc_ver="GCC"
- cc_major=$1
- cc_minor=$2
- cc_patch=$3
- cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
- fi
-
- case "$cc_ver--$cc_verno" in
- *GCC*)
- # different gcc backends (and versions) have different CPU flags
- case `gcc -dumpmachine` in
- i?86-* | x86_64-*)
- if test "$cc_comp" -lt 304 ; then
- check_cpu_cflags="-mcpu=${cpu_arg}"
- elif test "$cc_comp" -ge 402 ; then
- check_cpu_cflags="-mtune=native"
- else
- check_cpu_cflags="-mtune=${cpu_arg}"
- fi
- ;;
- ppc-*)
- check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
- ;;
- *)
- check_cpu_cflags=""
- return
- ;;
- esac
- ;;
- 2.95.*)
- # GCC 2.95 doesn't expose its name in --version output
- check_cpu_cflags="-m${cpu_arg}"
- ;;
- *)
- check_cpu_cflags=""
- return
- ;;
- esac
-
- # now we check whether the compiler really understands the cpu type
- touch __test.c
-
- while [ "$cpu_arg" ] ; do
- printf "testing $cpu_arg ... " >&2
-
- # compile check
- eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
- if test "x$?" = "x0" ; then
- echo ok >&2
- break;
- fi
-
- echo failed >&2
- check_cpu_cflags=""
- break;
- done
- rm __test.*
return 0
}
diff --git a/BUILD/choose_configure.sh b/BUILD/cmake_configure.sh
index 80423205274..80423205274 100644
--- a/BUILD/choose_configure.sh
+++ b/BUILD/cmake_configure.sh
diff --git a/BUILD/compile-ndb-autotest b/BUILD/compile-ndb-autotest
index be28cc28346..6f86eeb7464 100755
--- a/BUILD/compile-ndb-autotest
+++ b/BUILD/compile-ndb-autotest
@@ -4,16 +4,6 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_configs="$max_configs --with-ndb-test --with-ndb-ccflags='-DERROR_INSERT'"
-if [ "$full_debug" ]
-then
- extra_flags="$debug_cflags"
- c_warnings="$c_warnings $debug_extra_warnings"
- cxx_warnings="$cxx_warnings $debug_extra_warnings"
- extra_configs="$debug_configs $extra_configs"
-else
- extra_flags="$fast_cflags"
-fi
-
-extra_flags="$extra_flags $max_cflags -g"
+extra_flags="$fast_cflags $max_cflags -g"
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-debug b/BUILD/compile-pentium-debug
index 3f4027c5dd6..37381cc47df 100755
--- a/BUILD/compile-pentium-debug
+++ b/BUILD/compile-pentium-debug
@@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
-set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
diff --git a/BUILD/compile-pentium-debug-max b/BUILD/compile-pentium-debug-max
index 941a63a209f..5c56ceb37ba 100755
--- a/BUILD/compile-pentium-debug-max
+++ b/BUILD/compile-pentium-debug-max
@@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
-set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
diff --git a/BUILD/compile-pentium-debug-max-no-ndb b/BUILD/compile-pentium-debug-max-no-ndb
index 3f7a7904050..f1e14b73ecd 100755
--- a/BUILD/compile-pentium-debug-max-no-ndb
+++ b/BUILD/compile-pentium-debug-max-no-ndb
@@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
-set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
diff --git a/BUILD/compile-pentium-debug-openssl b/BUILD/compile-pentium-debug-openssl
index 2e24dbfd2f1..7026e0fde05 100755
--- a/BUILD/compile-pentium-debug-openssl
+++ b/BUILD/compile-pentium-debug-openssl
@@ -6,6 +6,6 @@ path=`dirname $0`
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs"
-extra_configs="$extra_configs --with-debug=full --with-ssl=/usr"
+extra_configs="$extra_configs --with-debug --with-ssl=/usr"
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-debug-yassl b/BUILD/compile-pentium-debug-yassl
index 61ad2937c4a..3f9a36ce5a1 100755
--- a/BUILD/compile-pentium-debug-yassl
+++ b/BUILD/compile-pentium-debug-yassl
@@ -6,6 +6,6 @@ path=`dirname $0`
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs"
-extra_configs="$extra_configs --with-debug=full --with-ssl"
+extra_configs="$extra_configs --with-debug --with-ssl"
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-mysqlfs-debug b/BUILD/compile-pentium-mysqlfs-debug
deleted file mode 100755
index c871200604e..00000000000
--- a/BUILD/compile-pentium-mysqlfs-debug
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /bin/sh
-
-path=`dirname $0`
-. "$path/SETUP.sh"
-
-extra_flags="$pentium_cflags $debug_cflags"
-extra_configs="$pentium_configs $debug_configs $static_link"
-
-extra_configs="$extra_configs --with-debug=full --with-mysqlfs --without-server --without-pstack"
-
-. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium64-debug b/BUILD/compile-pentium64-debug
index 06ee672789c..7d11ee9df76 100755
--- a/BUILD/compile-pentium64-debug
+++ b/BUILD/compile-pentium64-debug
@@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
-set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags"
diff --git a/BUILD/compile-pentium64-debug-max b/BUILD/compile-pentium64-debug-max
index b8b271688be..322b232a20c 100755
--- a/BUILD/compile-pentium64-debug-max
+++ b/BUILD/compile-pentium64-debug-max
@@ -1,7 +1,6 @@
#! /bin/sh
path=`dirname $0`
-set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fed3d61be8f..eecfa422bf6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Avoid warnings in higher versions
@@ -34,7 +34,6 @@ ENDIF()
SET(CUSTOM_C_FLAGS $ENV{CFLAGS})
OPTION(WITH_DEBUG "Use dbug/safemutex" OFF)
-OPTION(WITH_DEBUG_FULL "Use dbug and safemutex. Slow." OFF)
# Distinguish between community and non-community builds, with the
# default being a community build. This does not impact the feature
@@ -46,7 +45,8 @@ OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON)
SET(MANUFACTURER_DOCSTRING
"Set the entity that appears as the manufacturer of packages that support a manufacturer field.")
IF(NOT DEFINED MANUFACTURER)
- SET(MANUFACTURER "Built from Source" CACHE BOOL ${MANUFACTURER_DOCSTRING})
+ SET(MANUFACTURER "Built from Source" CACHE STRING ${MANUFACTURER_DOCSTRING})
+ MARK_AS_ADVANCED(MANUFACTURER)
ENDIF()
# We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
@@ -59,7 +59,7 @@ SET(BUILDTYPE_DOCSTRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel")
-IF(WITH_DEBUG OR WITH_DEBUG_FULL)
+IF(WITH_DEBUG)
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
SET(OLD_WITH_DEBUG 1 CACHE INTERNAL "" FORCE)
ELSEIF(NOT HAVE_CMAKE_BUILD_TYPE OR OLD_WITH_DEBUG)
@@ -161,13 +161,6 @@ IF(ENABLE_DEBUG_SYNC)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
ENDIF()
-OPTION(WITH_ERROR_INJECT
- "Enable error injection in MySQL Server (debug builds only)" OFF)
-IF(WITH_ERROR_INJECT)
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DERROR_INJECT_SUPPORT")
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DERROR_INJECT_SUPPORT")
-ENDIF()
-
OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
@@ -201,15 +194,10 @@ ENDIF()
# Add safemutex for debug configurations, except on Windows
# (safemutex has never worked on Windows)
-IF(WITH_DEBUG OR WITH_DEBUG_FULL AND NOT WIN32)
+IF(WITH_DEBUG AND NOT WIN32)
FOREACH(LANG C CXX)
- IF(WITH_DEBUG_FULL)
- SET(CMAKE_${LANG}_FLAGS_DEBUG
- "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
- ELSE()
- SET(CMAKE_${LANG}_FLAGS_DEBUG
- "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
- ENDIF()
+ SET(CMAKE_${LANG}_FLAGS_DEBUG
+ "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
ENDFOREACH()
ENDIF()
diff --git a/Makefile.am b/Makefile.am
index a559972969b..7ab9a9aa061 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,7 +65,7 @@ dist-hook:
test ! -f $(top_srcdir)/configure.am || \
$(INSTALL_DATA) $(top_srcdir)/configure.am $(distdir)
-all-local: @ABI_CHECK@
+all-local: @ABI_CHECK@
tags:
support-files/build-tags
@@ -314,7 +314,7 @@ abi_check_all: abi_check
do_abi_check:
set -ex; \
for file in $(abi_headers); do \
- @CC@ -E -nostdinc -dI \
+ @CC@ -E -nostdinc -dI -DMYSQL_ABI_CHECK \
-I$(top_srcdir)/include \
-I$(top_srcdir)/include/mysql \
-I$(top_srcdir)/sql \
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index d0bb8d43edd..771ebf290f1 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
diff --git a/client/mysql.cc b/client/mysql.cc
index d768a01eb5d..01a786c13af 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -3652,7 +3652,7 @@ xmlencode_print(const char *src, uint length)
tee_fputs("NULL", PAGER);
else
{
- for (const char *p = src; length; *p++, length--)
+ for (const char *p = src; length; p++, length--)
{
const char *t;
if ((t = array_value(xmlmeta, *p)))
@@ -4740,7 +4740,7 @@ static const char* construct_prompt()
struct tm *t = localtime(&lclock);
/* parse thru the settings for the prompt */
- for (char *c = current_prompt; *c ; *c++)
+ for (char *c = current_prompt; *c ; c++)
{
if (*c != PROMPT_CHAR)
processed_prompt.append(*c);
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 20436200c7e..882350f813b 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -209,6 +209,9 @@ static void add_one_option(DYNAMIC_STRING* ds,
case GET_STR:
arg= argument;
break;
+ case GET_BOOL:
+ arg= (*(my_bool *)opt->value) ? "1" : "0";
+ break;
default:
die("internal error at %s: %d",__FILE__, __LINE__);
}
@@ -596,7 +599,10 @@ static int upgrade_already_done(void)
my_fclose(in, MYF(0));
- return (strncmp(buf, MYSQL_SERVER_VERSION,
+ if (!res)
+ return 0; /* Could not read from file => not sure */
+
+ return (strncmp(res, MYSQL_SERVER_VERSION,
sizeof(MYSQL_SERVER_VERSION)-1)==0);
}
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 20f0f6d3164..6c8f1ee3561 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -199,6 +199,8 @@ static void init_re(void);
static int match_re(my_regex_t *, char *);
static void free_re(void);
+static uint opt_protocol=0;
+
DYNAMIC_ARRAY q_lines;
#include "sslopt-vars.h"
@@ -615,8 +617,11 @@ public:
if ((bytes= fread(buf, 1, sizeof(buf), m_file)) <= 0)
{
- fprintf(stderr, "Failed to read from '%s', errno: %d\n",
- m_file_name, errno);
+ // ferror=0 will happen here if no queries executed yet
+ if (ferror(m_file))
+ fprintf(stderr,
+ "Failed to read from '%s', errno: %d, feof:%d, ferror:%d\n",
+ m_file_name, errno, feof(m_file), ferror(m_file));
DBUG_VOID_RETURN;
}
@@ -1080,8 +1085,9 @@ void handle_command_error(struct st_command *command, uint error)
command->first_word_len, command->query, error));
DBUG_VOID_RETURN;
}
- die("command \"%.*s\" failed with wrong error: %d",
- command->first_word_len, command->query, error);
+ if (command->expected_errors.count > 0)
+ die("command \"%.*s\" failed with wrong error: %d",
+ command->first_word_len, command->query, error);
}
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
command->expected_errors.err[0].code.errnum != 0)
@@ -1350,14 +1356,14 @@ void log_msg(const char *fmt, ...)
*/
-void cat_file(DYNAMIC_STRING* ds, const char* filename)
+int cat_file(DYNAMIC_STRING* ds, const char* filename)
{
int fd;
size_t len;
char buff[512];
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
- die("Failed to open file '%s'", filename);
+ return 1;
while((len= my_read(fd, (uchar*)&buff,
sizeof(buff), MYF(0))) > 0)
{
@@ -1381,6 +1387,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename)
dynstr_append_mem(ds, start, p-start);
}
my_close(fd, MYF(0));
+ return 0;
}
@@ -2433,6 +2440,9 @@ void eval_expr(VAR *v, const char *p, const char **p_end)
if ((vp= var_get(p, p_end, 0, 0)))
var_copy(v, vp);
+ /* Apparently it is not safe to assume null-terminated string */
+ v->str_val[v->str_val_len]= 0;
+
/* Make sure there was just a $variable and nothing else */
const char* end= *p_end + 1;
if (end < expected_end)
@@ -2779,8 +2789,9 @@ void do_exec(struct st_command *command)
else
{
dynstr_free(&ds_cmd);
- die("command \"%s\" failed with wrong error: %d",
- command->first_argument, status);
+ if (command->expected_errors.count > 0)
+ die("command \"%s\" failed with wrong error: %d",
+ command->first_argument, status);
}
}
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
@@ -2926,6 +2937,41 @@ void do_system(struct st_command *command)
/*
SYNOPSIS
+ set_wild_chars
+ set true to set * etc. as wild char, false to reset
+
+ DESCRIPTION
+ Auxiliary function to set "our" wild chars before calling wild_compare
+ This is needed because the default values are changed to SQL syntax
+ in mysqltest_embedded.
+*/
+
+void set_wild_chars (my_bool set)
+{
+ static char old_many= 0, old_one, old_prefix;
+
+ if (set)
+ {
+ if (wild_many == '*') return; // No need
+ old_many= wild_many;
+ old_one= wild_one;
+ old_prefix= wild_prefix;
+ wild_many= '*';
+ wild_one= '?';
+ wild_prefix= 0;
+ }
+ else
+ {
+ if (! old_many) return; // Was not set
+ wild_many= old_many;
+ wild_one= old_one;
+ wild_prefix= old_prefix;
+ }
+}
+
+
+/*
+ SYNOPSIS
do_remove_file
command called command
@@ -3000,6 +3046,10 @@ void do_remove_files_wildcard(struct st_command *command)
dir_separator[0]= FN_LIBCHAR;
dir_separator[1]= 0;
dynstr_append(&ds_file_to_remove, dir_separator);
+
+ /* Set default wild chars for wild_compare, is changed in embedded mode */
+ set_wild_chars(1);
+
for (i= 0; i < (uint) dir_info->number_off_files; i++)
{
file= dir_info->dir_entry + i;
@@ -3019,6 +3069,7 @@ void do_remove_files_wildcard(struct st_command *command)
if (error)
break;
}
+ set_wild_chars(0);
my_dirend(dir_info);
end:
@@ -3264,6 +3315,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
/* Note that my_dir sorts the list if not given any flags */
if (!(dir_info= my_dir(ds_dirname->str, MYF(0))))
DBUG_RETURN(1);
+ set_wild_chars(1);
for (i= 0; i < (uint) dir_info->number_off_files; i++)
{
file= dir_info->dir_entry + i;
@@ -3277,6 +3329,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
dynstr_append(ds, file->name);
dynstr_append(ds, "\n");
}
+ set_wild_chars(0);
my_dirend(dir_info);
DBUG_RETURN(0);
}
@@ -3559,6 +3612,7 @@ void do_append_file(struct st_command *command)
void do_cat_file(struct st_command *command)
{
+ int error;
static DYNAMIC_STRING ds_filename;
const struct command_arg cat_file_args[] = {
{ "filename", ARG_STRING, TRUE, &ds_filename, "File to read from" }
@@ -3573,8 +3627,8 @@ void do_cat_file(struct st_command *command)
DBUG_PRINT("info", ("Reading from, file: %s", ds_filename.str));
- cat_file(&ds_res, ds_filename.str);
-
+ error= cat_file(&ds_res, ds_filename.str);
+ handle_command_error(command, error);
dynstr_free(&ds_filename);
DBUG_VOID_RETURN;
}
@@ -3836,8 +3890,9 @@ void do_perl(struct st_command *command)
}
error= pclose(res_file);
- /* Remove the temporary file */
- my_delete(temp_file_path, MYF(0));
+ /* Remove the temporary file, but keep it if perl failed */
+ if (!error)
+ my_delete(temp_file_path, MYF(0));
handle_command_error(command, WEXITSTATUS(error));
}
@@ -4950,7 +5005,7 @@ int connect_n_handle_errors(struct st_command *command,
ds= &ds_res;
/* Only log if an error is expected */
- if (!command->abort_on_error &&
+ if (command->expected_errors.count > 0 &&
!disable_query_log)
{
/*
@@ -5196,11 +5251,13 @@ void do_connect(struct st_command *command)
#ifdef __WIN__
if (con_pipe)
{
- uint protocol= MYSQL_PROTOCOL_PIPE;
- mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
+ opt_protocol= MYSQL_PROTOCOL_PIPE;
}
#endif
+ if (opt_protocol)
+ mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
+
#ifdef HAVE_SMEM
if (con_shm)
{
@@ -5372,8 +5429,20 @@ void do_block(enum block_cmd cmd, struct st_command* command)
/* Define inner block */
cur_block++;
cur_block->cmd= cmd;
- cur_block->ok= (v.int_val ? TRUE : FALSE);
+ if (v.int_val)
+ {
+ cur_block->ok= TRUE;
+ } else
+ /* Any non-empty string which does not begin with 0 is also TRUE */
+ {
+ p= v.str_val;
+ /* First skip any leading white space or unary -+ */
+ while (*p && ((my_isspace(charset_info, *p) || *p == '-' || *p == '+')))
+ p++;
+ cur_block->ok= (*p && *p != '0') ? TRUE : FALSE;
+ }
+
if (not_expr)
cur_block->ok = !cur_block->ok;
@@ -5934,6 +6003,8 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 128, 8, 5120, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0
@@ -6070,7 +6141,7 @@ void read_embedded_server_arguments(const char *name)
static my_bool
-get_one_option(int optid, const struct my_option *, char *argument)
+get_one_option(int optid, const struct my_option *opt, char *argument)
{
switch(optid) {
case '#':
@@ -6156,6 +6227,10 @@ get_one_option(int optid, const struct my_option *, char *argument)
case 'V':
print_version();
exit(0);
+ case OPT_MYSQL_PROTOCOL:
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
+ break;
case '?':
usage();
exit(0);
@@ -7617,9 +7692,6 @@ void get_command_type(struct st_command* command)
sizeof(saved_expected_errors));
DBUG_PRINT("info", ("There are %d expected errors",
command->expected_errors.count));
- command->abort_on_error= (command->expected_errors.count == 0 &&
- abort_on_error);
-
DBUG_VOID_RETURN;
}
@@ -7910,6 +7982,9 @@ int main(int argc, char **argv)
mysql_options(&con->mysql, MYSQL_SET_CHARSET_DIR,
opt_charsets_dir);
+ if (opt_protocol)
+ mysql_options(&con->mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
+
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
if (opt_use_ssl)
@@ -7968,6 +8043,10 @@ int main(int argc, char **argv)
command->type= Q_COMMENT;
}
+ /* (Re-)set abort_on_error for this command */
+ command->abort_on_error= (command->expected_errors.count == 0 &&
+ abort_on_error);
+
/* delimiter needs to be executed so we can continue to parse */
my_bool ok_to_do= cur_block->ok || command->type == Q_DELIMITER;
/*
@@ -8369,16 +8448,6 @@ int main(int argc, char **argv)
check_result();
}
}
- else
- {
- /*
- No result_file_name specified, the result
- has been printed to stdout, exit with error
- unless script has called "exit" to indicate success
- */
- if (abort_flag == 0)
- die("Exit with failure! Call 'exit' in script to return with sucess");
- }
}
else
{
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index 0d5bf21f540..7911b7848a8 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -38,7 +38,7 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
-DCOMPILER=${COMPILER}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DBINARY_DIR=${CMAKE_BINARY_DIR}
- "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
+ "-DDMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
VERBATIM
)
@@ -48,7 +48,7 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
-DCMAKE_C_COMPILER=${COMPILER}
-DCMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}
-DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
- "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
+ "-DMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/do_abi_check.cmake
VERBATIM
)
diff --git a/cmake/configure.pl b/cmake/configure.pl
index 5be47ce5a31..1dc8080810c 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -179,11 +179,6 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DMYSQL_DATADIR=".substr($option,14);
next;
}
- if ($option =~ /with-debug=full/)
- {
- $cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1";
- next;
- }
if ($option =~ /mysql-maintainer-mode/)
{
$cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" .
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 94edfb8741a..138901dfa8a 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -57,11 +57,17 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(WITHOUT_NDBCLUSTER 1)
ENDIF()
+ IF(ARG_DEFAULT)
+ IF(NOT DEFINED WITH_${plugin} AND
+ NOT DEFINED WITH_${plugin}_STORAGE_ENGINE)
+ SET(WITH_${plugin} 1)
+ ENDIF()
+ ENDIF()
+
IF(WITH_${plugin}_STORAGE_ENGINE
OR WITH_{$plugin}
OR WITH_ALL
OR WITH_MAX
- OR ARG_DEFAULT
AND NOT WITHOUT_${plugin}_STORAGE_ENGINE
AND NOT WITHOUT_${plugin}
AND NOT ARG_MODULE_ONLY)
@@ -88,6 +94,7 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(NOT ARG_DEPENDENCIES)
SET(ARG_DEPENDENCIES)
ENDIF()
+ SET(BUILD_PLUGIN 1)
# Build either static library or module
IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY)
ADD_LIBRARY(${target} STATIC ${SOURCES})
@@ -148,9 +155,6 @@ MACRO(MYSQL_ADD_PLUGIN)
DTRACE_INSTRUMENT(${target})
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
- IF(ARG_LINK_LIBRARIES)
- TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
- ENDIF()
TARGET_LINK_LIBRARIES (${target} mysqlservices)
# Plugin uses symbols defined in mysqld executable.
@@ -165,17 +169,30 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF()
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
- IF(NOT ARG_MODULE_ONLY)
+ IF(NOT ARG_MODULE_ONLY)
# set cached variable, e.g with checkbox in GUI
SET(${with_var} OFF CACHE BOOL "Link ${plugin} statically to the server"
FORCE)
- ENDIF()
+ ENDIF()
SET_TARGET_PROPERTIES(${target} PROPERTIES
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
# Install dynamic library
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server)
INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug)
+ ELSE()
+ IF(WITHOUT_${plugin})
+ # Update cache variable
+ STRING(REPLACE "WITH_" "WITHOUT_" without_var ${with_var})
+ SET(${without_var} ON CACHE BOOL "Don't build ${plugin}"
+ FORCE)
+ ENDIF()
+ SET(BUILD_PLUGIN 0)
ENDIF()
+
+ IF(BUILD_PLUGIN AND ARG_LINK_LIBRARIES)
+ TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
+ ENDIF()
+
ENDMACRO()
diff --git a/cmd-line-utils/libedit/CMakeLists.txt b/cmd-line-utils/libedit/CMakeLists.txt
index 517cbb4211f..b0e375dfcbd 100644
--- a/cmd-line-utils/libedit/CMakeLists.txt
+++ b/cmd-line-utils/libedit/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} )
INCLUDE(CheckIncludeFile)
diff --git a/cmd-line-utils/readline/CMakeLists.txt b/cmd-line-utils/readline/CMakeLists.txt
index 506dc1a0ef6..ed6a6b902ea 100644
--- a/cmd-line-utils/readline/CMakeLists.txt
+++ b/cmd-line-utils/readline/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/cmd-line-utils)
diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4
index 3718b64f688..533dba09feb 100644
--- a/config/ac-macros/ha_ndbcluster.m4
+++ b/config/ac-macros/ha_ndbcluster.m4
@@ -206,7 +206,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
NDB_DEFS="-DNDB_DEBUG_FULL -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
else
# no extra ndb debug but still do asserts if debug version
- if test "$with_debug" = "yes" -o "$with_debug" = "full"
+ if test "$with_debug" = "yes"
then
NDB_DEFS=""
else
diff --git a/configure.in b/configure.in
index f4db1d2b39e..238cfc50a68 100644
--- a/configure.in
+++ b/configure.in
@@ -463,16 +463,7 @@ if test "$GCC" != "yes" || expr "$CC" : ".*icc.*"
then
ABI_CHECK=""
else
- # Workaround GCC >= 4.5 - See Bug#52514
- case `$CC -dumpversion` in
- [[4-9]].[[5-9]]*)
- AC_MSG_WARN([ABI check disabled (GCC >= 4.5)])
- ABI_CHECK=""
- ;;
- *)
- ABI_CHECK="abi_check"
- ;;
- esac
+ ABI_CHECK="abi_check"
fi
AC_SUBST(ABI_CHECK)
@@ -1741,22 +1732,14 @@ then
fi
AC_ARG_WITH(debug,
- [ --with-debug Add debug code
- --with-debug=full Add debug code (adds memory checker, very slow)],
+ [AS_HELP_STRING([--with-debug], [Add debug code @<:@default=no@:>@])],
[with_debug=$withval],
[with_debug=no])
if test "$with_debug" = "yes"
then
- # Medium debug.
AC_DEFINE([DBUG_ON], [1], [Use libdbug])
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
-elif test "$with_debug" = "full"
-then
- # Full debug. Very slow in some cases
- AC_DEFINE([DBUG_ON], [1], [Use libdbug])
- CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX $CXXFLAGS"
else
# Optimized version. No debug
AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
@@ -1792,21 +1775,6 @@ else
AC_MSG_RESULT([no])
fi
-# If we should allow error injection tests
-AC_ARG_WITH(error-inject,
- AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
- [ with_error_inject=$withval ],
- [ with_error_inject=no ])
-
-if test $with_debug != "no"
-then
- if test "$with_error_inject" = "yes"
- then
- AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
- [Enable error injection in MySQL Server])
- fi
-fi
-
AC_ARG_WITH([fast-mutexes],
AC_HELP_STRING([--with-fast-mutexes],
[Compile with fast mutexes (default is disabled)]),
@@ -3045,7 +3013,8 @@ fi
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
- unittest/mysys/Makefile unittest/examples/Makefile dnl
+ unittest/mysys/Makefile unittest/strings/Makefile dnl
+ unittest/examples/Makefile dnl
strings/Makefile regex/Makefile storage/Makefile dnl
man/Makefile BUILD/Makefile vio/Makefile dnl
libmysql/Makefile libmysql_r/Makefile client/Makefile dnl
diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt
index 4cf6dd88cb7..b0a6eba5d08 100644
--- a/dbug/CMakeLists.txt
+++ b/dbug/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/dbug
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
index 27fc31cbdde..a569641a198 100644
--- a/extra/CMakeLists.txt
+++ b/extra/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
diff --git a/extra/comp_err.c b/extra/comp_err.c
index 3c56770650f..4c40e70f5b7 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -857,7 +857,6 @@ static struct message *parse_message_string(struct message *new_message,
static struct errors *parse_error_string(char *str, int er_count)
{
struct errors *new_error;
- char *start;
DBUG_ENTER("parse_error_string");
DBUG_PRINT("enter", ("str: %s", str));
@@ -868,7 +867,6 @@ static struct errors *parse_error_string(char *str, int er_count)
DBUG_RETURN(0); /* OOM: Fatal error */
/* getting the error name */
- start= str;
str= skip_delimiters(str);
if (!(new_error->er_name= get_word(&str)))
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt
index ea991fee8dc..46e1abbc08e 100644
--- a/extra/yassl/CMakeLists.txt
+++ b/extra/yassl/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp
index f079df8c7ce..86799f961ae 100644
--- a/extra/yassl/src/yassl_imp.cpp
+++ b/extra/yassl/src/yassl_imp.cpp
@@ -884,21 +884,19 @@ void Alert::Process(input_buffer& input, SSL& ssl)
else
hmac(ssl, verify, data, aSz, alert, true);
- // read mac and fill
+ // read mac and skip fill
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
opaque mac[SHA_LEN];
input.read(mac, digestSz);
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
int ivExtra = 0;
- opaque fill;
if (ssl.isTLSv1_1())
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
aSz - digestSz;
- for (int i = 0; i < padSz; i++)
- fill = input[AUTO];
+ input.set_current(input.get_current() + padSz);
}
// verify
@@ -981,17 +979,17 @@ output_buffer& operator<<(output_buffer& output, const Data& data)
void Data::Process(input_buffer& input, SSL& ssl)
{
int msgSz = ssl.getSecurity().get_parms().encrypt_size_;
- int pad = 0, padByte = 0;
+ int pad = 0, padSz = 0;
int ivExtra = 0;
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
if (ssl.isTLSv1_1()) // IV
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1);
- padByte = 1;
+ padSz = 1;
}
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
- int dataSz = msgSz - ivExtra - digestSz - pad - padByte;
+ int dataSz = msgSz - ivExtra - digestSz - pad - padSz;
opaque verify[SHA_LEN];
const byte* rawData = input.get_buffer() + input.get_current();
@@ -1020,14 +1018,10 @@ void Data::Process(input_buffer& input, SSL& ssl)
hmac(ssl, verify, rawData, dataSz, application_data, true);
}
- // read mac and fill
+ // read mac and skip fill
opaque mac[SHA_LEN];
- opaque fill;
input.read(mac, digestSz);
- for (int i = 0; i < pad; i++)
- fill = input[AUTO];
- if (padByte)
- fill = input[AUTO];
+ input.set_current(input.get_current() + pad + padSz);
// verify
if (dataSz) {
@@ -2073,11 +2067,9 @@ void Finished::Process(input_buffer& input, SSL& ssl)
if (ssl.isTLSv1_1())
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
- opaque fill;
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
HANDSHAKE_HEADER - finishedSz - digestSz;
- for (int i = 0; i < padSz; i++)
- fill = input[AUTO];
+ input.set_current(input.get_current() + padSz);
// verify mac
if (memcmp(mac, verifyMAC, digestSz)) {
diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt
index 1781ea6f2fa..750731a0449 100644
--- a/extra/yassl/taocrypt/CMakeLists.txt
+++ b/extra/yassl/taocrypt/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index c3922231047..aee7561d242 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(HEADERS_GEN_CONFIGURE
${CMAKE_CURRENT_BINARY_DIR}/mysql_version.h
diff --git a/include/my_pthread.h b/include/my_pthread.h
index e5ffa0db3bb..0c89a2ed384 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -255,14 +255,13 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
-#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
+#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; \
DBUG_ASSERT((A) != 0); \
sigemptyset(&l_set); \
l_s.sa_handler = (B); \
l_s.sa_mask = l_set; \
l_s.sa_flags = 0; \
- l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
- DBUG_ASSERT(l_rc == 0); \
+ sigaction((A), &l_s, NULL); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
#define my_sigset(A,B) sigset((A),(B))
diff --git a/include/mysql.h b/include/mysql.h
index 7eef91cf55a..dc6e4eb19a6 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -44,7 +44,9 @@ extern "C" {
#endif
#ifndef _global_h /* If not standard header */
+#ifndef MYSQL_ABI_CHECK
#include <sys/types.h>
+#endif
#ifdef __LCC__
#include <winsock2.h> /* For windows */
#endif
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index bc5d611ec84..531062aee80 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -1,4 +1,3 @@
-#include <sys/types.h>
typedef char my_bool;
typedef int my_socket;
#include "mysql_version.h"
diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp
index 9d2877be5a2..55d62b8daab 100644
--- a/include/mysql/plugin.h.pp
+++ b/include/mysql/plugin.h.pp
@@ -1,7 +1,5 @@
#include <mysql/services.h>
#include <mysql/service_my_snprintf.h>
-#include <stdarg.h>
-#include <stdlib.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);
@@ -9,7 +7,6 @@ extern struct my_snprintf_service_st {
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>
-#include <stdlib.h>
struct st_mysql_lex_string
{
char *str;
diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h
index 9e5fe7f9c9f..d7f8d07e110 100644
--- a/include/mysql/service_my_snprintf.h
+++ b/include/mysql/service_my_snprintf.h
@@ -70,8 +70,11 @@
extern "C" {
#endif
+#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#include <stdlib.h>
+#endif
+
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);
diff --git a/include/mysql/service_thd_alloc.h b/include/mysql/service_thd_alloc.h
index 86158ba1359..7061c2bd4d5 100644
--- a/include/mysql/service_thd_alloc.h
+++ b/include/mysql/service_thd_alloc.h
@@ -27,7 +27,9 @@
allocations - they are better served with my_malloc.
*/
+#ifndef MYSQL_ABI_CHECK
#include <stdlib.h>
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/include/mysys_err.h b/include/mysys_err.h
index 9629dfec014..4067a3cfbd1 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -63,7 +63,9 @@ extern const char *globerrs[]; /* my_error_messages is here */
#define EE_UNKNOWN_COLLATION 28
#define EE_FILENOTFOUND 29
#define EE_FILE_NOT_CLOSED 30
-#define EE_ERROR_LAST 30 /* Copy last error nr */
+#define EE_CHANGE_OWNERSHIP 31
+#define EE_CHANGE_PERMISSIONS 32
+#define EE_ERROR_LAST 32 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */
diff --git a/include/thr_lock.h b/include/thr_lock.h
index 37dc37f8017..5626c067e5e 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -89,23 +89,11 @@ typedef struct st_thr_lock_info
{
pthread_t thread;
my_thread_id thread_id;
- ulong n_cursors;
} THR_LOCK_INFO;
-/*
- Lock owner identifier. Globally identifies the lock owner within the
- thread and among all the threads. The address of an instance of this
- structure is used as id.
-*/
-
-typedef struct st_thr_lock_owner
-{
- THR_LOCK_INFO *info;
-} THR_LOCK_OWNER;
-
typedef struct st_thr_lock_data {
- THR_LOCK_OWNER *owner;
+ THR_LOCK_INFO *owner;
struct st_thr_lock_data *next,**prev;
struct st_thr_lock *lock;
mysql_cond_t *cond;
@@ -141,19 +129,18 @@ extern LIST *thr_lock_thread_list;
extern mysql_mutex_t THR_LOCK_lock;
my_bool init_thr_lock(void); /* Must be called once/thread */
-#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
void thr_lock_info_init(THR_LOCK_INFO *info);
void thr_lock_init(THR_LOCK *lock);
void thr_lock_delete(THR_LOCK *lock);
void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data,
void *status_param);
enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data,
- THR_LOCK_OWNER *owner,
+ THR_LOCK_INFO *owner,
enum thr_lock_type lock_type,
ulong lock_wait_timeout);
void thr_unlock(THR_LOCK_DATA *data);
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
- uint count, THR_LOCK_OWNER *owner,
+ uint count, THR_LOCK_INFO *owner,
ulong lock_wait_timeout);
void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
void
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 2ae09c1707a..0de582a0212 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index a7efcb024ec..de6184c40dd 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
ADD_DEFINITIONS(-DMYSQL_SERVER -DEMBEDDED_LIBRARY
${SSL_DEFINES})
@@ -64,7 +64,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_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
@@ -80,6 +80,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 1ffa349bcfe..6af4588126c 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -63,7 +63,7 @@ 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_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 +78,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/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index f98470a2047..f4a888c10ef 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysqld/include
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index da84368b46c..79431ff65fe 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index 1113b73fd8d..7c96deada08 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Copy man pages
FILE(GLOB MAN1_FILES *.1)
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
index 9745699b61d..6ba53bd9c2c 100644
--- a/mysql-test/CMakeLists.txt
+++ b/mysql-test/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INSTALL(
DIRECTORY .
diff --git a/mysql-test/extra/rpl_tests/create_recursive_construct.inc b/mysql-test/extra/rpl_tests/create_recursive_construct.inc
index 628f1735726..3a9c628cbb0 100644
--- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc
+++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc
@@ -200,7 +200,7 @@ if (`SELECT $CRC_ARG_type = 1`) {
if (`SELECT $CRC_ARG_type = 2`) {
# It will be unsafe to call this procedure.
--let $CRC_name= proc_$CRC_ARG_level
- --let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; END
+ --let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN $CRC_ARG_stmt_sidef; INSERT INTO ta$CRC_ARG_level VALUES (47); END
--let $CRC_RET_stmt_sidef= CALL $CRC_name()
--let $CRC_RET_value=
--let $CRC_RET_sel_retval=
@@ -344,25 +344,8 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
if (`SELECT '$event_type' != 'Table_map'`) {
--enable_query_log
--echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
-
- # Currently, there is a bug causing some statements to be logged
- # partially in statement format. Hence, we don't fail here, we
- # just print the events (masking out nondeterministic components
- # of the output) and continue. When binloggging works perfectly,
- # we should instead execute:
- #--enable_query_log
- #SHOW BINLOG EVENTS;
- #--die Wrong events in binlog.
-
- # Here, we should really source
- # include/show_binlog_events.inc. But due to BUG#41913, that
- # doesn't work, and we have to inline the entire file here. Sigh
- # :-(
- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR 107 <binlog_start>
- --replace_column 2 # 4 # 5 #
- --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
- --eval SHOW BINLOG EVENTS FROM 107
- --disable_query_log
+ SHOW BINLOG EVENTS;
+ --die Wrong events in binlog.
}
SET binlog_format = STATEMENT;
diff --git a/mysql-test/include/handler.inc b/mysql-test/include/handler.inc
index 0031cb68647..98988ab55ba 100644
--- a/mysql-test/include/handler.inc
+++ b/mysql-test/include/handler.inc
@@ -1757,3 +1757,35 @@ disconnect con51355;
--echo # Connection default
connection default;
+
+--echo #
+--echo # Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+delimiter |;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+ SELECT 1 FROM t2 INTO @a;
+ RETURN 1;
+END|
+delimiter ;|
+
+# Get f1() parsed and cached
+--error ER_NO_SUCH_TABLE
+SELECT f1();
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1);
+HANDLER t1 OPEN;
+# This used to cause the assert
+--error ER_NO_SUCH_TABLE
+HANDLER t1 READ FIRST WHERE f1() = 1;
+HANDLER t1 CLOSE;
+
+DROP FUNCTION f1;
+DROP TABLE t1;
diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc
index 001d4cf44d4..9fc5ec1e317 100644
--- a/mysql-test/include/mix2.inc
+++ b/mysql-test/include/mix2.inc
@@ -1910,7 +1910,7 @@ select hex(s1) from t4;
drop table t1,t2,t3,t4;
}
-if (test_foreign_keys)
+if ($test_foreign_keys)
{
eval create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=$engine_type;
eval create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type;
@@ -2407,7 +2407,7 @@ drop table t1, t2, t3, t5, t6, t8, t9;
}
# End transactional tests
-if (test_foreign_keys)
+if ($test_foreign_keys)
{
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
--error 1005
diff --git a/mysql-test/include/mysql_upgrade_preparation.inc b/mysql-test/include/mysql_upgrade_preparation.inc
new file mode 100644
index 00000000000..5de8a79d6e0
--- /dev/null
+++ b/mysql-test/include/mysql_upgrade_preparation.inc
@@ -0,0 +1,30 @@
+# Include this in any test using mysql_upgrade
+
+# Can't run test of external client with embedded server
+-- source include/not_embedded.inc
+
+# Only run test if "mysql_upgrade" is found
+--require r/have_mysql_upgrade.result
+--disable_query_log
+select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
+--enable_query_log
+
+#
+# Hack:
+#
+# If running with Valgrind ($VALGRIND_TEST <> 0) then the resource
+# consumption (CPU) for upgrading a large log table will be intense.
+# Therefore, truncate the log table in advance and issue a statement
+# that should be logged.
+#
+if (`SELECT $VALGRIND_TEST`)
+{
+ --disable_query_log
+ --disable_result_log
+ --disable_abort_on_error
+ TRUNCATE TABLE mysql.general_log;
+ SELECT 1;
+ --enable_abort_on_error
+ --enable_result_log
+ --enable_query_log
+}
diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm
index f8416e3df3a..315e415e219 100644
--- a/mysql-test/lib/My/Config.pm
+++ b/mysql-test/lib/My/Config.pm
@@ -188,6 +188,8 @@ sub new {
while ( my $line= <$F> ) {
chomp($line);
+ # Remove any trailing CR from Windows edited files
+ $line=~ s/\cM$//;
# [group]
if ( $line =~ /^\[(.*)\]/ ) {
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index ba1f68a9fc9..19c3ee4d5d8 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -30,6 +30,13 @@ sub get_basedir {
return $basedir;
}
+sub get_testdir {
+ my ($self, $group)= @_;
+ my $testdir= $group->if_exist('testdir') ||
+ $self->{ARGS}->{testdir};
+ return $testdir;
+}
+
# Retrive build directory (which is different from basedir in out-of-source build)
sub get_bindir {
if (defined $ENV{MTR_BINDIR})
@@ -151,9 +158,8 @@ sub fix_secure_file_priv {
sub fix_std_data {
my ($self, $config, $group_name, $group)= @_;
- return my_find_dir($self->get_basedir($group),
- ["share/mysql-test", "mysql-test"],
- "std_data");
+ my $testdir= $self->get_testdir($group);
+ return "$testdir/std_data";
}
sub ssl_supported {
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
index b8f05778b6e..461897b56f0 100644
--- a/mysql-test/lib/My/SafeProcess.pm
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -60,11 +60,12 @@ use My::Platform;
my %running;
my $_verbose= 0;
+my $start_exit= 0;
END {
# Kill any children still running
for my $proc (values %running){
- if ( $proc->is_child($$) ){
+ if ( $proc->is_child($$) and ! $start_exit){
#print "Killing: $proc\n";
if ($proc->wait_one(0)){
$proc->kill();
@@ -161,6 +162,11 @@ sub new {
push(@safe_args, "--");
push(@safe_args, $path); # The program safe_process should execute
+
+ if ($start_exit) { # Bypass safe_process instead, start program directly
+ @safe_args= ();
+ $safe_path= $path;
+ }
push(@safe_args, @$$args);
print "### safe_path: ", $safe_path, " ", join(" ", @safe_args), "\n"
@@ -540,6 +546,13 @@ sub wait_all {
}
}
+#
+# Set global flag to tell all safe_process to exit after starting child
+#
+
+sub start_exit {
+ $start_exit= 1;
+}
#
# Check if any process has exited, but don't wait.
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index f79c2d450b9..810096805c8 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(INSTALL_ARGS
DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess"
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index f7a23ab34e7..897382219ec 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -598,7 +598,7 @@ sub optimize_cases {
# Check that engine selected by
# --default-storage-engine=<engine> is supported
# =======================================================
- my %builtin_engines = ('myisam' => 1, 'memory' => 1);
+ my %builtin_engines = ('myisam' => 1, 'memory' => 1, 'csv' => 1);
foreach my $opt ( @{$tinfo->{master_opt}} ) {
my $default_engine=
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index 1c4b940bbee..77f6920771d 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -124,7 +124,7 @@ sub mtr_report_test ($) {
my $timest = format_time();
my $fail = "fail";
- if ( $::opt_experimental )
+ if ( @$::experimental_test_cases )
{
# Find out if this test case is an experimental one, so we can treat
# the failure as an expected failure instead of a regression.
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index 489db060e99..4e4f09981cc 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -3113,7 +3113,6 @@ sub install_db ($$) {
mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir);
- mtr_add_arg($args, "--loose-skip-innodb");
mtr_add_arg($args, "--loose-skip-ndbcluster");
mtr_add_arg($args, "--tmpdir=.");
mtr_add_arg($args, "--core-file");
@@ -3127,6 +3126,15 @@ sub install_db ($$) {
mtr_add_arg($args, "--lc-messages-dir=%s", $path_language);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
+ # InnoDB arguments that affect file location and sizes may
+ # need to be given to the bootstrap process as well as the
+ # server process.
+ foreach my $extra_opt ( @opt_extra_mysqld_opt ) {
+ if ($extra_opt =~ /--innodb/) {
+ mtr_add_arg($args, $extra_opt);
+ }
+ }
+
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
# --bootstrap or --skip-grant-tables options. The user can set
@@ -3926,11 +3934,6 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--local-infile", $prefix);
- if ( $idx > 0 or !$use_innodb)
- {
- mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
- }
-
my $cluster= $clusters->[$mysqld->{'cluster'}];
if ( $cluster->{'pid'} || # Cluster is started
$cluster->{'use_running'} ) # Using running cluster
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 1a574fe6e6b..03d0c9eb621 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -206,8 +206,8 @@ our $opt_client_debugger;
my $config; # The currently running config
my $current_config_name; # The currently running config file template
-our $opt_experimental;
-our $experimental_test_cases;
+our @opt_experimentals;
+our $experimental_test_cases= [];
my $baseport;
# $opt_build_thread may later be set from $opt_port_base
@@ -237,8 +237,10 @@ sub check_timeout { return $opt_testcase_timeout * 6; };
my $opt_start;
my $opt_start_dirty;
+my $opt_start_exit;
my $start_only;
my $opt_wait_all;
+my $opt_user_args;
my $opt_repeat= 1;
my $opt_retry= 3;
my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2);
@@ -365,6 +367,12 @@ sub main {
}
$ENV{MTR_PARALLEL} = $opt_parallel;
+ if ($opt_parallel > 1 && $opt_start_exit) {
+ mtr_warning("Parallel and --start-and-exit cannot be combined\n" .
+ "Setting parallel to 1");
+ $opt_parallel= 1;
+ }
+
# Create server socket on any free port
my $server = new IO::Socket::INET
(
@@ -404,6 +412,8 @@ sub main {
my $completed= run_test_server($server, $tests, $opt_parallel);
+ exit(0) if $opt_start_exit;
+
# Send Ctrl-C to any children still running
kill("INT", keys(%children));
@@ -857,7 +867,7 @@ sub command_line_setup {
'big-test' => \$opt_big_test,
'combination=s' => \@opt_combinations,
'skip-combinations' => \&collect_option,
- 'experimental=s' => \$opt_experimental,
+ 'experimental=s' => \@opt_experimentals,
'skip-im' => \&ignore_option,
# Specify ports
@@ -930,7 +940,9 @@ sub command_line_setup {
'verbose-restart' => \&report_option,
'sleep=i' => \$opt_sleep,
'start-dirty' => \$opt_start_dirty,
+ 'start-and-exit' => \$opt_start_exit,
'start' => \$opt_start,
+ 'user-args' => \$opt_user_args,
'wait-all' => \$opt_wait_all,
'print-testcases' => \&collect_option,
'repeat=i' => \$opt_repeat,
@@ -1044,43 +1056,47 @@ sub command_line_setup {
mtr_print_thick_line('#');
}
- if ( $opt_experimental )
+ if ( @opt_experimentals )
{
# $^O on Windows considered not generic enough
my $plat= (IS_WINDOWS) ? 'windows' : $^O;
- # read the list of experimental test cases from the file specified on
+ # read the list of experimental test cases from the files specified on
# the command line
- open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental");
- mtr_report("Using experimental file: $opt_experimental");
$experimental_test_cases = [];
- while(<FILE>) {
- chomp;
- # remove comments (# foo) at the beginning of the line, or after a
- # blank at the end of the line
- s/( +|^)#.*$//;
- # If @ platform specifier given, use this entry only if it contains
- # @<platform> or @!<xxx> where xxx != platform
- if (/\@.*/)
- {
- next if (/\@!$plat/);
- next unless (/\@$plat/ or /\@!/);
- # Then remove @ and everything after it
- s/\@.*$//;
- }
- # remove whitespace
- s/^ +//;
- s/ +$//;
- # if nothing left, don't need to remember this line
- if ( $_ eq "" ) {
- next;
+ foreach my $exp_file (@opt_experimentals)
+ {
+ open(FILE, "<", $exp_file)
+ or mtr_error("Can't read experimental file: $exp_file");
+ mtr_report("Using experimental file: $exp_file");
+ while(<FILE>) {
+ chomp;
+ # remove comments (# foo) at the beginning of the line, or after a
+ # blank at the end of the line
+ s/( +|^)#.*$//;
+ # If @ platform specifier given, use this entry only if it contains
+ # @<platform> or @!<xxx> where xxx != platform
+ if (/\@.*/)
+ {
+ next if (/\@!$plat/);
+ next unless (/\@$plat/ or /\@!/);
+ # Then remove @ and everything after it
+ s/\@.*$//;
+ }
+ # remove whitespace
+ s/^ +//;
+ s/ +$//;
+ # if nothing left, don't need to remember this line
+ if ( $_ eq "" ) {
+ next;
+ }
+ # remember what is left as the name of another test case that should be
+ # treated as experimental
+ print " - $_\n";
+ push @$experimental_test_cases, $_;
}
- # remember what is left as the name of another test case that should be
- # treated as experimental
- print " - $_\n";
- push @$experimental_test_cases, $_;
+ close FILE;
}
- close FILE;
}
foreach my $arg ( @ARGV )
@@ -1349,18 +1365,29 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Modified behavior with --start options
# --------------------------------------------------------------------------
- if ($opt_start or $opt_start_dirty) {
+ if ($opt_start or $opt_start_dirty or $opt_start_exit) {
collect_option ('quick-collect', 1);
$start_only= 1;
}
# --------------------------------------------------------------------------
+ # Check use of user-args
+ # --------------------------------------------------------------------------
+
+ if ($opt_user_args) {
+ mtr_error("--user-args only valid with --start options")
+ unless $start_only;
+ mtr_error("--user-args cannot be combined with named suites or tests")
+ if $opt_suites || @opt_cases;
+ }
+
+ # --------------------------------------------------------------------------
# Check use of wait-all
# --------------------------------------------------------------------------
if ($opt_wait_all && ! $start_only)
{
- mtr_error("--wait-all can only be used with --start or --start-dirty");
+ mtr_error("--wait-all can only be used with --start options");
}
# --------------------------------------------------------------------------
@@ -2815,6 +2842,7 @@ sub default_mysqld {
my $config= My::ConfigFactory->new_config
( {
basedir => $basedir,
+ testdir => $glob_mysql_test_dir,
template_path => "include/default_my.cnf",
vardir => $opt_vardir,
tmpdir => $opt_tmpdir,
@@ -2860,6 +2888,15 @@ sub mysql_install_db {
mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang);
mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
+ # InnoDB arguments that affect file location and sizes may
+ # need to be given to the bootstrap process as well as the
+ # server process.
+ foreach my $extra_opt ( @opt_extra_mysqld_opt ) {
+ if ($extra_opt =~ /--innodb/) {
+ mtr_add_arg($args, $extra_opt);
+ }
+ }
+
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
# --bootstrap or --skip-grant-tables options. The user can set
@@ -3060,7 +3097,8 @@ sub check_testcase($$)
my %started;
foreach my $mysqld ( mysqlds() )
{
- if ( defined $mysqld->{'proc'} )
+ # Skip if server has been restarted with additional options
+ if ( defined $mysqld->{'proc'} && ! exists $mysqld->{'restart_opts'} )
{
my $proc= start_check_testcase($tinfo, $mode, $mysqld);
$started{$proc->pid()}= $proc;
@@ -3421,6 +3459,7 @@ sub run_testcase ($) {
$config= My::ConfigFactory->new_config
( {
basedir => $basedir,
+ testdir => $glob_mysql_test_dir,
template_path => $tinfo->{template_path},
extra_template_path => $tinfo->{extra_template_path},
vardir => $opt_vardir,
@@ -3481,6 +3520,18 @@ sub run_testcase ($) {
mtr_print ($mysqld->name() . " " . $mysqld->value('port') .
" " . $mysqld->value('socket'));
}
+ if ( $opt_start_exit )
+ {
+ mtr_print("Server(s) started, not waiting for them to finish");
+ if (IS_WINDOWS)
+ {
+ POSIX::_exit(0); # exit hangs here in ActiveState Perl
+ }
+ else
+ {
+ exit(0);
+ }
+ }
mtr_print("Waiting for server(s) to exit...");
if ( $opt_wait_all ) {
My::SafeProcess->wait_all();
@@ -3812,8 +3863,8 @@ sub extract_warning_lines ($$) {
if ($opt_valgrind_mysqld) {
# Skip valgrind summary from tests where server has been restarted
# Should this contain memory leaks, the final report will find it
- $skip_valgrind= 1 if $line =~ /^==\d+== ERROR SUMMARY:/;
- $skip_valgrind= 1 if $line =~ /^==\d+== HEAP SUMMARY:/;
+ # Use a generic pattern for summaries
+ $skip_valgrind= 1 if $line =~ /^==\d+== [A-Z ]+ SUMMARY:/;
$skip_valgrind= 0 unless $line =~ /^==\d+==/;
next if $skip_valgrind;
}
@@ -4021,6 +4072,16 @@ sub check_expected_crash_and_restart {
next;
}
+ # If last line begins "restart:", the rest of the line is read as
+ # extra command line options to add to the restarted mysqld.
+ # Anything other than 'wait' or 'restart:' (with a colon) will
+ # result in a restart with original mysqld options.
+ if ($last_line =~ /restart:(.+)/) {
+ my @rest_opt= split(' ', $1);
+ $mysqld->{'restart_opts'}= \@rest_opt;
+ } else {
+ delete $mysqld->{'restart_opts'};
+ }
unlink($expect_file);
# Start server with same settings as last time
@@ -4289,7 +4350,7 @@ sub mysqld_arguments ($$$) {
}
}
- if ( $mysql_version_id >= 50106 )
+ if ( $mysql_version_id >= 50106 && !$opt_user_args)
{
# Turn on logging to file
mtr_add_arg($args, "--log-output=file");
@@ -4332,7 +4393,7 @@ sub mysqld_arguments ($$$) {
}
}
$opt_skip_core = $found_skip_core;
- if ( !$found_skip_core )
+ if ( !$found_skip_core && !$opt_user_args )
{
mtr_add_arg($args, "%s", "--core-file");
}
@@ -4340,7 +4401,7 @@ sub mysqld_arguments ($$$) {
# Enable the debug sync facility, set default wait timeout.
# Facility stays disabled if timeout value is zero.
mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
- $opt_debug_sync_timeout);
+ $opt_debug_sync_timeout) unless $opt_user_args;
return $args;
}
@@ -4368,7 +4429,13 @@ sub mysqld_start ($$) {
}
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
- mysqld_arguments($args,$mysqld,$extra_opts);
+
+ # Add any additional options from an in-test restart
+ my @all_opts= @$extra_opts;
+ if (exists $mysqld->{'restart_opts'}) {
+ push (@all_opts, @{$mysqld->{'restart_opts'}});
+ }
+ mysqld_arguments($args,$mysqld,\@all_opts);
if ( $opt_debug )
{
@@ -4549,7 +4616,10 @@ sub server_need_restart {
my $extra_opts= get_extra_opts($server, $tinfo);
my $started_opts= $server->{'started_opts'};
- if (!My::Options::same($started_opts, $extra_opts) )
+ # Also, always restart if server had been restarted with additional
+ # options within test.
+ if (!My::Options::same($started_opts, $extra_opts) ||
+ exists $server->{'restart_opts'})
{
my $use_dynamic_option_switch= 0;
if (!$use_dynamic_option_switch)
@@ -4638,6 +4708,9 @@ sub envsubst {
sub get_extra_opts {
+ # No extra options if --user-args
+ return \@opt_extra_mysqld_opt if $opt_user_args;
+
my ($mysqld, $tinfo)= @_;
my $opts=
@@ -4708,6 +4781,12 @@ sub stop_servers($$) {
sub start_servers($) {
my ($tinfo)= @_;
+ # Make sure the safe_process also exits from now on
+ # Could not be done before, as we don't want this for the bootstrap
+ if ($opt_start_exit) {
+ My::SafeProcess->start_exit();
+ }
+
# Start clusters
foreach my $cluster ( clusters() )
{
@@ -5503,8 +5582,13 @@ Misc options
startup settings for the first specified test case
Example:
$0 --start alias &
+ start-and-exit Same as --start, but mysql-test-run terminates and
+ leaves just the server running
start-dirty Only start the servers (without initialization) for
the first specified test case
+ user-args In combination with start* and no test name, drops
+ arguments to mysqld except those speficied with
+ --mysqld (if any)
wait-all If --start or --start-dirty option is used, wait for all
servers to exit before finishing the process
fast Run as fast as possible, dont't wait for servers
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 90dde034e10..304f562d47d 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -1370,3 +1370,16 @@ CREATE TABLE t1 (id int);
INSERT INTO t1 VALUES (1), (2);
ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2);
DROP TABLE t1;
+#
+# Test for bug #53820 "ALTER a MEDIUMINT column table causes full
+# table copy".
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, b MEDIUMINT);
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+# The below ALTER should not copy table and so no rows should
+# be shown as affected.
+ALTER TABLE t1 CHANGE a id INT;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+DROP TABLE t1;
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
index c1710e82ba6..2d8d9e1912d 100644
--- a/mysql-test/r/csv.result
+++ b/mysql-test/r/csv.result
@@ -5138,7 +5138,7 @@ insert t1 values (1),(2),(3),(4),(5);
truncate table t1;
affected rows: 0
drop table t1;
-create table t1 (v varchar(32) not null);
+create table t1 (v varchar(32) not null) engine=csv;
insert into t1 values ('def'),('abc'),('hij'),('3r4f');
select * from t1;
v
@@ -5146,14 +5146,14 @@ def
abc
hij
3r4f
-alter table t1 change v v2 varchar(32);
+alter table t1 change v v2 varchar(32) not null;
select * from t1;
v2
def
abc
hij
3r4f
-alter table t1 change v2 v varchar(64);
+alter table t1 change v2 v varchar(64) not null;
select * from t1;
v
def
@@ -5163,35 +5163,34 @@ hij
update t1 set v = 'lmn' where v = 'hij';
select * from t1;
v
+lmn
def
abc
-lmn
3r4f
-alter table t1 add i int auto_increment not null primary key first;
+alter table t1 add i int not null first;
select * from t1;
i v
-1 def
-2 abc
-3 lmn
-4 3r4f
-update t1 set i=5 where i=3;
+0 lmn
+0 def
+0 abc
+0 3r4f
+update t1 set i=3 where v = 'abc';
select * from t1;
i v
-1 def
-2 abc
-5 lmn
-4 3r4f
-alter table t1 change i i bigint;
+3 abc
+0 lmn
+0 def
+0 3r4f
+alter table t1 change i i bigint not null;
select * from t1;
i v
-1 def
-2 abc
-5 lmn
-4 3r4f
-alter table t1 add unique key (i, v);
-select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+3 abc
+0 lmn
+0 def
+0 3r4f
+select * from t1 where i between 2 and 4 and v in ('def','3r4f','abc');
i v
-4 3r4f
+3 abc
drop table t1;
create table bug15205 (val int(11) not null) engine=csv;
create table bug15205_2 (val int(11) not null) engine=csv;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 6838dcf944c..45c93971852 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1714,3 +1714,14 @@ NULL NULL NULL NULL NULL
drop table t1;
#
End of 5.1 tests
+#
+# Bug#55648: Server crash on MIX/MAX on maximum time value
+#
+CREATE TABLE t1(c1 TIME NOT NULL);
+INSERT INTO t1 VALUES('837:59:59');
+INSERT INTO t1 VALUES('838:59:59');
+SELECT MAX(c1) FROM t1;
+MAX(c1)
+838:59:59
+DROP TABLE t1;
+# End of the bug#55648
diff --git a/mysql-test/r/handler_innodb.result b/mysql-test/r/handler_innodb.result
index 08d2fc58e8a..121cfa89f1c 100644
--- a/mysql-test/r/handler_innodb.result
+++ b/mysql-test/r/handler_innodb.result
@@ -1710,3 +1710,23 @@ ERROR 42S02: Table 'test.t1' doesn't exist
HANDLER t1 CLOSE;
# Connection con51355
# Connection default
+#
+# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
+#
+DROP TABLE IF EXISTS t1, t2;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+SELECT 1 FROM t2 INTO @a;
+RETURN 1;
+END|
+SELECT f1();
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1);
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST WHERE f1() = 1;
+ERROR 42S02: Table 'test.t2' doesn't exist
+HANDLER t1 CLOSE;
+DROP FUNCTION f1;
+DROP TABLE t1;
diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/r/handler_myisam.result
index 31bc828b0b9..fd08fd12f15 100644
--- a/mysql-test/r/handler_myisam.result
+++ b/mysql-test/r/handler_myisam.result
@@ -1707,6 +1707,26 @@ HANDLER t1 CLOSE;
# Connection con51355
# Connection default
#
+# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
+#
+DROP TABLE IF EXISTS t1, t2;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+SELECT 1 FROM t2 INTO @a;
+RETURN 1;
+END|
+SELECT f1();
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1);
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST WHERE f1() = 1;
+ERROR 42S02: Table 'test.t2' doesn't exist
+HANDLER t1 CLOSE;
+DROP FUNCTION f1;
+DROP TABLE t1;
+#
# BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
#
CREATE TABLE t1 AS SELECT 1 AS f1;
diff --git a/mysql-test/r/innodb_mysql_lock.result b/mysql-test/r/innodb_mysql_lock.result
index 95adf712cb4..bf1c3a89f40 100644
--- a/mysql-test/r/innodb_mysql_lock.result
+++ b/mysql-test/r/innodb_mysql_lock.result
@@ -116,3 +116,35 @@ Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
DROP TABLE t1;
+#
+# Bug#49891 View DDL breaks REPEATABLE READ
+#
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v2;
+CREATE TABLE t1 ( f1 INTEGER ) ENGINE = innodb;
+CREATE TABLE t2 ( f1 INTEGER );
+CREATE VIEW v1 AS SELECT 1 FROM t1;
+# Connection con3
+LOCK TABLE t1 WRITE;
+# Connection default
+START TRANSACTION;
+# Sending:
+SELECT * FROM v1;
+# Connection con2
+# Waiting for 'SELECT * FROM v1' to sync in.
+# Sending:
+ALTER VIEW v1 AS SELECT 2 FROM t2;
+# Connection con3
+# Waiting for 'ALTER VIEW v1 AS SELECT 2 FROM t2' to sync in.
+UNLOCK TABLES;
+# Connection default;
+# Reaping: SELECT * FROM v1
+1
+SELECT * FROM v1;
+1
+COMMIT;
+# Connection con2
+# Reaping: ALTER VIEW v1 AS SELECT 2 FROM t2
+# Connection default
+DROP TABLE t1, t2;
+DROP VIEW v1;
diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result
index 0e75e62b13a..43a98829d4e 100644
--- a/mysql-test/r/innodb_mysql_sync.result
+++ b/mysql-test/r/innodb_mysql_sync.result
@@ -48,3 +48,21 @@ Warnings:
Error 1146 Table 'test.t1' doesn't exist
# Connection default
SET DEBUG_SYNC= "RESET";
+#
+# Bug#53757 assert in mysql_truncate_by_delete
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1(a INT) Engine=InnoDB;
+CREATE TABLE t2(id INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES(connection_id());
+SET DEBUG_SYNC= "open_and_process_table SIGNAL opening WAIT_FOR killed";
+# Sending: (not reaped since connection is killed later)
+TRUNCATE t1;
+SET DEBUG_SYNC= "now WAIT_FOR opening";
+SELECT ((@id := id) - id) FROM t2;
+((@id := id) - id)
+0
+KILL @id;
+SET DEBUG_SYNC= "now SIGNAL killed";
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index 26a151b55aa..caee7a7662b 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -56,6 +56,7 @@ CREATE DATABASE `TEST_$1`;
SHOW DATABASES LIKE "TEST%";
Database (TEST%)
TEST_$1
+test
DROP DATABASE `test_$1`;
CREATE TABLE T1 (a int) engine=innodb;
INSERT INTO T1 VALUES (1);
@@ -171,7 +172,7 @@ create table myUC (i int);
select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
where TABLE_SCHEMA ='mysqltest_LC2';
TABLE_SCHEMA TABLE_NAME
-mysqltest_LC2 myUC
+mysqltest_lc2 myUC
use test;
drop database mysqltest_LC2;
# End of 5.1 tests
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index 67d778211dd..0fd408b0208 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -2527,3 +2527,240 @@ SET DEBUG_SYNC= "now SIGNAL completed";
Field Type Collation Null Key Default Extra Privileges Comment
a char(255) latin1_swedish_ci YES NULL #
DROP TABLE t1;
+#
+# Tests for schema-scope locks
+#
+DROP DATABASE IF EXISTS db1;
+DROP DATABASE IF EXISTS db2;
+# Test 1:
+# CREATE DATABASE blocks database DDL on the same database, but
+# not database DDL on different databases. Tests X vs X lock.
+#
+# Connection default
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+CREATE DATABASE db1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+CREATE DATABASE db1;
+# Connection con3
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: CREATE DATABASE db1
+# Connection con2
+# Reaping: CREATE DATABASE db1
+ERROR HY000: Can't create database 'db1'; database exists
+# Test 2:
+# ALTER DATABASE blocks database DDL on the same database, but
+# not database DDL on different databases. Tests X vs X lock.
+#
+# Connection default
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
+# Connection con3
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+# Connection con2
+# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+# Connection default
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+DROP DATABASE db1;
+# Connection con3
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+# Connection con2
+# Reaping: DROP DATABASE db1
+CREATE DATABASE db1;
+# Test 3:
+# Two ALTER..UPGRADE of the same database are mutually exclusive, but
+# two ALTER..UPGRADE of different databases are not. Tests X vs X lock.
+#
+# Connection default
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
+# Connection con3
+ALTER DATABASE `#mysql50#a-b-c-d` UPGRADE DATA DIRECTORY NAME;
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
+# Connection con2
+# Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
+ERROR 42000: Unknown database '#mysql50#a-b-c'
+DROP DATABASE `a-b-c`;
+DROP DATABASE `a-b-c-d`;
+# Test 4:
+# DROP DATABASE blocks database DDL on the same database, but
+# not database DDL on different databases. Tests X vs X lock.
+#
+# Connection default
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+DROP DATABASE db1;
+# Connection con3
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: DROP DATABASE db1
+# Connection con2
+# Reaping: DROP DATABASE db1
+ERROR HY000: Can't drop database 'db1'; database doesn't exist
+# Connection default
+CREATE DATABASE db1;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
+# Connection con3
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: DROP DATABASE db1
+# Connection con2
+# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+Got one of the listed errors
+# Test 5:
+# Locked database name prevents CREATE of tables in that database.
+# Tests X vs IX lock.
+#
+# Connection default
+CREATE DATABASE db1;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+CREATE TABLE db1.t1 (a INT);
+# Connection con3
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: DROP DATABASE db1
+# Connection con2
+# Reaping: CREATE TABLE db1.t1 (a INT)
+ERROR 42000: Unknown database 'db1'
+# Test 6:
+# Locked database name prevents RENAME of tables to/from that database.
+# Tests X vs IX lock.
+#
+# Connection default
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+RENAME TABLE db1.t1 TO test.t1;
+# Connection con3
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: DROP DATABASE db1
+# Connection con2
+# Reaping: RENAME TABLE db1.t1 TO test.t1
+Got one of the listed errors
+# Connection default
+CREATE DATABASE db1;
+CREATE TABLE test.t2 (a INT);
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+RENAME TABLE test.t2 TO db1.t2;
+# Connection con3
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: DROP DATABASE db1
+# Connection con2
+# Reaping: RENAME TABLE test.t2 TO db1.t2
+Got one of the listed errors
+DROP TABLE test.t2;
+# Test 7:
+# Locked database name prevents DROP of tables in that database.
+# Tests X vs IX lock.
+#
+# Connection default
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# Sending:
+DROP TABLE db1.t1;
+# Connection con3
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+# Connection default
+# Reaping: DROP DATABASE db1
+# Connection con2
+# Reaping: DROP TABLE db1.t1
+ERROR 42S02: Unknown table 't1'
+# Connection default
+SET DEBUG_SYNC= 'RESET';
+#
+# End of tests for schema-scope locks
+#
+#
+# Tests of granted global S lock (FLUSH TABLE WITH READ LOCK)
+#
+CREATE DATABASE db1;
+CREATE TABLE db1.t1(a INT);
+# Connection default
+FLUSH TABLE WITH READ LOCK;
+# Connection con2
+CREATE TABLE db1.t2(a INT);
+# Connection default
+UNLOCK TABLES;
+# Connection con2
+# Reaping CREATE TABLE db1.t2(a INT)
+# Connection default
+FLUSH TABLE WITH READ LOCK;
+# Connection con2
+ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
+# Connection default
+UNLOCK TABLES;
+# Connection con2
+# Reaping ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+# Connection default
+FLUSH TABLE WITH READ LOCK;
+# Connection con2
+FLUSH TABLE WITH READ LOCK;
+UNLOCK TABLES;
+# Connection default
+UNLOCK TABLES;
+DROP DATABASE db1;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 87d4f75dc8d..f7f0cea3b19 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -1,3 +1,5 @@
+set global storage_engine=myisam;
+set session storage_engine=myisam;
drop table if exists t1,t2,t3,t4,t5,t6;
drop database if exists mysqltest;
create table t1 (a int not null primary key auto_increment, message char(20));
@@ -584,7 +586,9 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2);
SELECT * FROM t3;
-ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+c1
+1
+2
CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL);
CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL);
INSERT INTO t4 VALUES (4);
@@ -613,7 +617,9 @@ ERROR HY000: Unable to open underlying table which is differently defined or of
drop table t3;
create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
-ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+a
+1
+2
drop table t3, t2, t1;
# CREATE...SELECT is not implemented for MERGE tables.
CREATE TEMPORARY TABLE t1 (c1 INT NOT NULL);
@@ -1196,12 +1202,13 @@ ERROR HY000: Table 't4' was not locked with LOCK TABLES
# it can even be used.
CREATE TEMPORARY TABLE t4 LIKE t3;
SHOW CREATE TABLE t4;
-ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+Table Create Table
+t4 CREATE TEMPORARY TABLE `t4` (
+ `c1` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
INSERT INTO t4 VALUES (4);
-ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
UNLOCK TABLES;
INSERT INTO t4 VALUES (4);
-ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t4;
#
# Rename child.
@@ -1229,6 +1236,8 @@ c1
2
3
4
+4
+4
RENAME TABLE t2 TO t5;
SELECT * FROM t3 ORDER BY c1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
@@ -1239,6 +1248,8 @@ c1
2
3
4
+4
+4
#
# 3. Normal rename with locked tables.
LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
@@ -1248,6 +1259,8 @@ c1
2
3
4
+4
+4
RENAME TABLE t2 TO t5;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
SELECT * FROM t3 ORDER BY c1;
@@ -1256,6 +1269,8 @@ c1
2
3
4
+4
+4
RENAME TABLE t5 TO t2;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
SELECT * FROM t3 ORDER BY c1;
@@ -1264,6 +1279,8 @@ c1
2
3
4
+4
+4
UNLOCK TABLES;
#
# 4. Alter table rename.
@@ -1277,6 +1294,8 @@ c1
2
3
4
+4
+4
#
# 5. Alter table rename with locked tables.
LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
@@ -1293,6 +1312,8 @@ c1
2
3
4
+4
+4
#
# Rename parent.
#
@@ -1304,6 +1325,8 @@ c1
2
3
4
+4
+4
RENAME TABLE t3 TO t5;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
SELECT * FROM t3 ORDER BY c1;
@@ -1312,6 +1335,8 @@ c1
2
3
4
+4
+4
RENAME TABLE t5 TO t3;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
SELECT * FROM t3 ORDER BY c1;
@@ -1320,6 +1345,8 @@ c1
2
3
4
+4
+4
#
# 5. Alter table rename with locked tables.
ALTER TABLE t3 RENAME TO t5;
@@ -1335,6 +1362,8 @@ c1
2
3
4
+4
+4
DROP TABLE t1, t2, t3;
#
# Drop locked tables.
@@ -2650,6 +2679,705 @@ test.t1 optimize Error Unable to open underlying table which is differently defi
test.t1 optimize note The storage engine for the table doesn't support optimize
DROP TABLE t1;
#
+# Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
+# More tests with TEMPORARY MERGE table and permanent children.
+# First without locked tables.
+#
+DROP TABLE IF EXISTS t1, t2, t3, t4, m1, m2;
+#
+CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
+CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TEMPORARY TABLE `m1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m1;
+c1 c2
+INSERT INTO t1 VALUES (111, 121);
+INSERT INTO m1 VALUES (211, 221);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+SELECT * FROM t1;
+c1 c2
+111 121
+SELECT * FROM t2;
+c1 c2
+211 221
+#
+ALTER TABLE m1 RENAME m2;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TEMPORARY TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+#
+CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+ALTER TABLE m2 RENAME m1;
+ERROR 42S01: Table 'm1' already exists
+DROP TABLE m1;
+ALTER TABLE m2 RENAME m1;
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TEMPORARY TABLE `m1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+#
+ALTER TABLE m1 ADD COLUMN c3 INT;
+INSERT INTO m1 VALUES (212, 222, 232);
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM m1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+ALTER TABLE t1 ADD COLUMN c3 INT;
+ALTER TABLE t2 ADD COLUMN c3 INT;
+INSERT INTO m1 VALUES (212, 222, 232);
+SELECT * FROM m1;
+c1 c2 c3
+111 121 NULL
+211 221 NULL
+212 222 232
+#
+ALTER TABLE m1 DROP COLUMN c3;
+INSERT INTO m1 VALUES (213, 223);
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM m1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+ALTER TABLE t1 DROP COLUMN c3;
+ALTER TABLE t2 DROP COLUMN c3;
+INSERT INTO m1 VALUES (213, 223);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+#
+CREATE TABLE t3 (c1 INT, c2 INT) ENGINE=MyISAM;
+ALTER TABLE m1 UNION=(t1,t2,t3);
+INSERT INTO m1 VALUES (311, 321);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+311 321
+SELECT * FROM t1;
+c1 c2
+111 121
+SELECT * FROM t2;
+c1 c2
+211 221
+212 222
+213 223
+SELECT * FROM t3;
+c1 c2
+311 321
+#
+CREATE TEMPORARY TABLE t4 (c1 INT, c2 INT) ENGINE=MyISAM;
+ALTER TABLE m1 UNION=(t1,t2,t3,t4);
+INSERT INTO m1 VALUES (411, 421);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+311 321
+411 421
+SELECT * FROM t1;
+c1 c2
+111 121
+SELECT * FROM t2;
+c1 c2
+211 221
+212 222
+213 223
+SELECT * FROM t3;
+c1 c2
+311 321
+SELECT * FROM t4;
+c1 c2
+411 421
+#
+ALTER TABLE m1 ENGINE=MyISAM;
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TEMPORARY TABLE `m1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO m1 VALUES (511, 521);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+311 321
+411 421
+511 521
+#
+ALTER TABLE m1 ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+SELECT * FROM t1;
+c1 c2
+111 121
+SELECT * FROM t2;
+c1 c2
+211 221
+212 222
+213 223
+#
+CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (611, 621);
+SELECT * FROM m1;
+c1 c2
+611 621
+211 221
+212 222
+213 223
+DROP TABLE t1;
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+#
+#
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TEMPORARY TABLE `m1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+#
+CREATE TABLE m2 SELECT * FROM m1;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+DROP TABLE m2;
+#
+CREATE TEMPORARY TABLE m2 SELECT * FROM m1;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TEMPORARY TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+DROP TABLE m2;
+#
+CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+INSERT_METHOD=LAST;
+SELECT * FROM m2;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+DROP TABLE m2;
+#
+CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+INSERT_METHOD=LAST SELECT * FROM m1;
+ERROR HY000: 'test.m2' is not BASE TABLE
+#
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+INSERT_METHOD=LAST SELECT * FROM m1;
+ERROR HY000: 'test.m2' is not BASE TABLE
+#
+CREATE TABLE m2 LIKE m1;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+DROP TABLE m2;
+#
+CREATE TEMPORARY TABLE m2 LIKE m1;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TEMPORARY TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+DROP TABLE m2;
+#
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+INSERT_METHOD=LAST;
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1 c2
+311 321
+411 421
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+#
+#
+LOCK TABLE m1 WRITE, m2 WRITE;
+SELECT * FROM m1,m2 WHERE m1.c1=m2.c1;
+c1 c2 c1 c2
+111 121 111 121
+111 121 111 121
+111 121 111 121
+111 121 111 121
+211 221 211 221
+211 221 211 221
+211 221 211 221
+211 221 211 221
+212 222 212 222
+212 222 212 222
+212 222 212 222
+212 222 212 222
+213 223 213 223
+213 223 213 223
+213 223 213 223
+213 223 213 223
+111 121 111 121
+111 121 111 121
+111 121 111 121
+111 121 111 121
+211 221 211 221
+211 221 211 221
+211 221 211 221
+211 221 211 221
+212 222 212 222
+212 222 212 222
+212 222 212 222
+212 222 212 222
+213 223 213 223
+213 223 213 223
+213 223 213 223
+213 223 213 223
+111 121 111 121
+111 121 111 121
+111 121 111 121
+111 121 111 121
+211 221 211 221
+211 221 211 221
+211 221 211 221
+211 221 211 221
+212 222 212 222
+212 222 212 222
+212 222 212 222
+212 222 212 222
+213 223 213 223
+213 223 213 223
+213 223 213 223
+213 223 213 223
+111 121 111 121
+111 121 111 121
+111 121 111 121
+111 121 111 121
+211 221 211 221
+211 221 211 221
+211 221 211 221
+211 221 211 221
+212 222 212 222
+212 222 212 222
+212 222 212 222
+212 222 212 222
+213 223 213 223
+213 223 213 223
+213 223 213 223
+213 223 213 223
+UNLOCK TABLES;
+DROP TABLE t1, t2, t3, t4, m1, m2;
+#
+# Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
+# More tests with TEMPORARY MERGE table and permanent children.
+# (continued) Now the same with locked table.
+#
+CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
+CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TEMPORARY TABLE `m1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m1;
+c1 c2
+INSERT INTO t1 VALUES (111, 121);
+INSERT INTO m1 VALUES (211, 221);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+SELECT * FROM t1;
+c1 c2
+111 121
+SELECT * FROM t2;
+c1 c2
+211 221
+#
+LOCK TABLE m1 WRITE, t1 WRITE, t2 WRITE;
+#
+ALTER TABLE m1 RENAME m2;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TEMPORARY TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+#
+CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+ALTER TABLE m2 RENAME m1;
+ERROR 42S01: Table 'm1' already exists
+DROP TABLE m1;
+ALTER TABLE m2 RENAME m1;
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TEMPORARY TABLE `m1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+#
+ALTER TABLE m1 ADD COLUMN c3 INT;
+INSERT INTO m1 VALUES (212, 222, 232);
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM m1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+ALTER TABLE t1 ADD COLUMN c3 INT;
+ALTER TABLE t2 ADD COLUMN c3 INT;
+INSERT INTO m1 VALUES (212, 222, 232);
+SELECT * FROM m1;
+c1 c2 c3
+111 121 NULL
+211 221 NULL
+212 222 232
+#
+ALTER TABLE m1 DROP COLUMN c3;
+INSERT INTO m1 VALUES (213, 223);
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM m1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+ALTER TABLE t1 DROP COLUMN c3;
+ALTER TABLE t2 DROP COLUMN c3;
+INSERT INTO m1 VALUES (213, 223);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+#
+UNLOCK TABLES;
+CREATE TABLE t3 (c1 INT, c2 INT) ENGINE=MyISAM;
+ALTER TABLE m1 UNION=(t1,t2,t3);
+LOCK TABLE m1 WRITE;
+INSERT INTO m1 VALUES (311, 321);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+311 321
+SELECT * FROM t1;
+c1 c2
+111 121
+SELECT * FROM t2;
+c1 c2
+211 221
+212 222
+213 223
+SELECT * FROM t3;
+c1 c2
+311 321
+#
+CREATE TEMPORARY TABLE t4 (c1 INT, c2 INT) ENGINE=MyISAM;
+ALTER TABLE m1 UNION=(t1,t2,t3,t4);
+INSERT INTO m1 VALUES (411, 421);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+311 321
+411 421
+SELECT * FROM t1;
+c1 c2
+111 121
+SELECT * FROM t2;
+c1 c2
+211 221
+212 222
+213 223
+SELECT * FROM t3;
+c1 c2
+311 321
+SELECT * FROM t4;
+c1 c2
+411 421
+#
+ALTER TABLE m1 ENGINE=MyISAM;
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TEMPORARY TABLE `m1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO m1 VALUES (511, 521);
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+311 321
+411 421
+511 521
+#
+ALTER TABLE m1 ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+SELECT * FROM t1;
+c1 c2
+111 121
+SELECT * FROM t2;
+c1 c2
+211 221
+212 222
+213 223
+#
+CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (611, 621);
+SELECT * FROM m1;
+c1 c2
+611 621
+211 221
+212 222
+213 223
+DROP TABLE t1;
+SELECT * FROM m1;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+#
+#
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TEMPORARY TABLE `m1` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+CREATE TABLE m2 SELECT * FROM m1;
+ERROR HY000: Table 'm2' was not locked with LOCK TABLES
+#
+CREATE TEMPORARY TABLE m2 SELECT * FROM m1;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TEMPORARY TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+DROP TABLE m2;
+#
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+INSERT_METHOD=LAST;
+SELECT * FROM m2;
+c1 c2
+311 321
+411 421
+LOCK TABLE m1 WRITE, m2 WRITE;
+UNLOCK TABLES;
+DROP TABLE m2;
+LOCK TABLE m1 WRITE;
+#
+# ER_TABLE_NOT_LOCKED is returned in ps-protocol
+CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+INSERT_METHOD=LAST SELECT * FROM m1;
+Got one of the listed errors
+#
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+INSERT_METHOD=LAST SELECT * FROM m1;
+ERROR HY000: 'test.m2' is not BASE TABLE
+#
+CREATE TEMPORARY TABLE m2 LIKE m1;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TEMPORARY TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+LOCK TABLE m1 WRITE, m2 WRITE;
+SHOW CREATE TABLE m2;
+Table Create Table
+m2 CREATE TEMPORARY TABLE `m2` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1 c2
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+DROP TABLE m2;
+#
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1 c2
+311 321
+411 421
+111 121
+211 221
+212 222
+213 223
+111 121
+211 221
+212 222
+213 223
+#
+UNLOCK TABLES;
+DROP TABLE t1, t2, t3, t4, m1, m2;
+#
# Bug47098 assert in MDL_context::destroy on HANDLER
# <damaged merge table> OPEN
#
@@ -2745,4 +3473,106 @@ m2 CREATE TABLE `m2` (
`i` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`)
drop tables m1, m2, t1;
+#
+# Test case for Bug#54811 "Assert in mysql_lock_have_duplicate()"
+# Check that unique_table() works correctly for merge tables.
+#
+drop table if exists t1, t2, t3, m1, m2;
+create table t1 (a int);
+create table t2 (a int);
+create table t3 (b int);
+create view v1 as select * from t3,t1;
+create table m1 (a int) engine=merge union (t1, t2) insert_method=last;
+create table m2 (a int) engine=merge union (t1, t2) insert_method=first;
+create temporary table tmp (b int);
+insert into tmp (b) values (1);
+insert into t1 (a) values (1);
+insert into t3 (b) values (1);
+insert into m1 (a) values ((select max(a) from m1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from m2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from t1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from t2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from t3, m1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from t3, m2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from t3, t1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from t3, t2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from tmp, m1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from tmp, m2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from tmp, t1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from tmp, t2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+insert into m1 (a) values ((select max(a) from v1));
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'.
+insert into m1 (a) values ((select max(a) from tmp, v1));
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'.
+update m1 set a = ((select max(a) from m1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from m2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from t1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from t2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from t3, m1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from t3, m2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from t3, t1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from t3, t2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from tmp, m1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from tmp, m2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from tmp, t1));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from tmp, t2));
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+update m1 set a = ((select max(a) from v1));
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'.
+update m1 set a = ((select max(a) from tmp, v1));
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'.
+delete from m1 where a = (select max(a) from m1);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from m2);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from t1);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from t2);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from t3, m1);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from t3, m2);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from t3, t1);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from t3, t2);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from tmp, m1);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from tmp, m2);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from tmp, t1);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from tmp, t2);
+ERROR HY000: You can't specify target table 'm1' for update in FROM clause
+delete from m1 where a = (select max(a) from v1);
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'.
+delete from m1 where a = (select max(a) from tmp, v1);
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'.
+drop view v1;
+drop temporary table tmp;
+drop table t1, t2, t3, m1, m2;
End of 6.0 tests
diff --git a/mysql-test/r/merge_mmap.result b/mysql-test/r/merge_mmap.result
new file mode 100644
index 00000000000..e8014259a4a
--- /dev/null
+++ b/mysql-test/r/merge_mmap.result
@@ -0,0 +1,190 @@
+SET GLOBAL storage_engine = MyISAM;
+SET SESSION storage_engine = MyISAM;
+DROP TABLE IF EXISTS t1, t2, m1, m2;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1
+1
+2
+3
+4
+1
+2
+3
+4
+SELECT * FROM t2;
+c1
+2
+3
+4
+1
+2
+3
+4
+DROP TABLE m2, m1, t2, t1;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1
+1
+2
+3
+4
+1
+2
+3
+4
+DROP TABLE m2, m1, t2, t1;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1
+1
+2
+3
+4
+1
+2
+3
+4
+DROP TABLE m2, m1, t2, t1;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1
+1
+2
+3
+4
+1
+2
+3
+4
+DROP TABLE m2, m1, t2, t1;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1
+1
+2
+3
+4
+1
+2
+3
+4
+SELECT * FROM t2;
+c1
+2
+3
+4
+1
+2
+3
+4
+UNLOCK TABLES;
+DROP TABLE m2, m1, t2, t1;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1
+1
+2
+3
+4
+1
+2
+3
+4
+UNLOCK TABLES;
+DROP TABLE m2, m1, t2, t1;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1
+1
+2
+3
+4
+1
+2
+3
+4
+UNLOCK TABLES;
+DROP TABLE m2, m1, t2, t1;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+c1
+1
+2
+3
+4
+1
+2
+3
+4
+UNLOCK TABLES;
+DROP TABLE m2, m1, t2, t1;
+End of 6.0 tests
diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result
new file mode 100644
index 00000000000..f1229c4a405
--- /dev/null
+++ b/mysql-test/r/mysql_upgrade_ssl.result
@@ -0,0 +1,32 @@
+#
+# Bug#55672 mysql_upgrade dies with internal error
+#
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.general_log
+Error : You can't use locks with log tables.
+status : OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.ndb_binlog_index OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.servers OK
+mysql.slow_log
+Error : You can't use locks with log tables.
+status : OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 67c08b0ae97..e4f68d68c3f 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -325,6 +325,7 @@ outer=2 ifval=0
outer=1 ifval=1
here is the sourced script
ERROR 42S02: Table 'test.nowhere' doesn't exist
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'else' at line 1
In loop
here is the sourced script
@@ -392,6 +393,9 @@ true-inner again
true-outer
Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0)
+Counter is true, (counter=alpha)
+Beta is true
+while with string, only once
1
Testing while with not
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply
@@ -446,7 +450,6 @@ OK
mysqltest: The test didn't produce any output
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
-connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
show tables;
ERROR 3D000: No database selected
Output from mysqltest-x.inc
@@ -572,7 +575,7 @@ if things work as expected
Some data
for cat_file command
of mysqltest
-mysqltest: At line 1: Failed to open file 'non_existing_file'
+mysqltest: At line 1: command "cat_file" failed with error 1
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
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/partition_debug_sync.result b/mysql-test/r/partition_debug_sync.result
index 5ab1044934b..0e3241cf88e 100644
--- a/mysql-test/r/partition_debug_sync.result
+++ b/mysql-test/r/partition_debug_sync.result
@@ -47,7 +47,7 @@ ENGINE = MYISAM
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN (100),
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
-SET DEBUG_SYNC= 'open_tables_acquire_upgradable_mdl SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
+SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
ALTER TABLE t2 REMOVE PARTITIONING;
# Con default
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..107ad719e2b 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,5 +1,67 @@
drop table if exists t1, t2;
#
+# 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_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/schema.result b/mysql-test/r/schema.result
index 2919606d74a..853c3bcf575 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -16,19 +16,21 @@ 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 schema1 DEFAULT CHARACTER SET utf8;
-Got one of the listed errors
+ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
SET autocommit= TRUE;
# Connection 2
# Connection default
+DROP SCHEMA schema2;
#
# Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
#
@@ -48,3 +50,48 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
UNLOCK TABLES;
# Connection con2
# Connection default
+#
+# Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
+#
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+INSERT INTO db1.t1 VALUES (1), (2);
+# Connection con1
+HANDLER db1.t1 OPEN;
+# Connection default
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+# Connection con1
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+HANDLER t1 CLOSE;
+# Connection default
+# Reaping: DROP DATABASE db1
+#
+# Tests for increased CREATE/ALTER/DROP DATABASE concurrency with
+# database name locks.
+#
+DROP DATABASE IF EXISTS db1;
+DROP DATABASE IF EXISTS db2;
+# Connection default
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (id INT);
+START TRANSACTION;
+INSERT INTO db1.t1 VALUES (1);
+# Connection 2
+# DROP DATABASE should block due to the active transaction
+# Sending:
+DROP DATABASE db1;
+# Connection 3
+# But it should still be possible to CREATE/ALTER/DROP other databases.
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+# Connection default
+# End the transaction so DROP DATABASE db1 can continue
+COMMIT;
+# Connection 2
+# Reaping: DROP DATABASE db1
+# Connection default;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index ef2277fef38..c1a75281e0e 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1466,3 +1466,51 @@ t1 CREATE TABLE `t1` (
# Switching to connection 'default'.
UNLOCK TABLES;
DROP TABLE t1;
+#
+# Bug#54905 Connection with WRITE lock cannot ALTER table due to
+# concurrent SHOW CREATE
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
+# Connection con1
+LOCK TABLE t1 WRITE;
+# Connection default
+START TRANSACTION;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+# Connection con1
+ALTER TABLE t1 CHARACTER SET = utf8;
+UNLOCK TABLES;
+# Connection default
+COMMIT;
+DROP TABLE t1;
+#
+# Bug#55498 SHOW CREATE TRIGGER takes wrong type of metadata lock.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1;
+# Test 1: SHOW CREATE TRIGGER with WRITE locked table.
+# Connection con1
+LOCK TABLE t1 WRITE;
+# Connection default
+SHOW CREATE TRIGGER t1_bi;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
+# Connection con1
+UNLOCK TABLES;
+# Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction
+# Connection default
+START TRANSACTION;
+SHOW CREATE TRIGGER t1_bi;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
+# Connection con1
+ALTER TABLE t1 CHARACTER SET = utf8;
+# Connection default
+COMMIT;
+DROP TRIGGER t1_bi;
+DROP TABLE t1;
diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result
index 410abffcdf0..67bf9330451 100644
--- a/mysql-test/r/signal.result
+++ b/mysql-test/r/signal.result
@@ -1189,6 +1189,8 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
+Warnings:
+Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1204,6 +1206,8 @@ end $$
call test_signal() $$
Caught by number
Caught by number
+Warnings:
+Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1219,6 +1223,8 @@ end $$
call test_signal() $$
Caught by SQLWARNING
Caught by SQLWARNING
+Warnings:
+Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1234,6 +1240,8 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
+Warnings:
+Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1249,6 +1257,8 @@ end $$
call test_signal() $$
Caught by number
Caught by number
+Warnings:
+Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1264,6 +1274,8 @@ end $$
call test_signal() $$
Caught by NOT FOUND
Caught by NOT FOUND
+Warnings:
+Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1279,6 +1291,8 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
+Warnings:
+Error 1012 Raising an error
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1294,6 +1308,8 @@ end $$
call test_signal() $$
Caught by number
Caught by number
+Warnings:
+Error 1012 Raising an error
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1309,6 +1325,8 @@ end $$
call test_signal() $$
Caught by SQLEXCEPTION
Caught by SQLEXCEPTION
+Warnings:
+Error 1012 Raising an error
drop procedure test_signal $$
#
# Test where SIGNAL can be used
@@ -1455,6 +1473,7 @@ after RESIGNAL
after RESIGNAL
Warnings:
Warning 1012 Raising a warning
+Warning 1012 Raising a warning
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1509,6 +1528,7 @@ after RESIGNAL
after RESIGNAL
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 1
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1565,6 +1585,7 @@ before RESIGNAL
after RESIGNAL
after RESIGNAL
Warnings:
+Warning 1012 Raising a warning
Warning 5555 RESIGNAL of a warning
drop procedure test_resignal $$
create procedure test_resignal()
@@ -1625,6 +1646,7 @@ before RESIGNAL
after RESIGNAL
after RESIGNAL
Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
Warning 5555 RESIGNAL of a warning
drop procedure test_resignal $$
create procedure test_resignal()
@@ -2126,6 +2148,9 @@ CALL peter_p2() $$
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
+Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
+Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
+Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Hi, I am a useless error message
drop procedure peter_p1 $$
drop procedure peter_p2 $$
@@ -2135,15 +2160,17 @@ DECLARE x CONDITION FOR SQLSTATE '42000';
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '2';
+SHOW WARNINGS;
RESIGNAL x SET MYSQL_ERRNO = 9999;
END;
BEGIN
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '1';
+SHOW WARNINGS;
RESIGNAL x SET
SCHEMA_NAME = 'test',
-MYSQL_ERRNO= 1231;
+MYSQL_ERRNO= 1232;
END;
/* Raises ER_WRONG_VALUE_FOR_VAR : 1231, SQLSTATE 42000 */
SET @@sql_mode=NULL;
@@ -2156,6 +2183,7 @@ DECLARE x CONDITION for SQLSTATE '42000';
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '3';
+SHOW WARNINGS;
RESIGNAL x SET
MESSAGE_TEXT = 'Hi, I am a useless error message',
MYSQL_ERRNO = 9999;
@@ -2166,15 +2194,24 @@ $$
CALL peter_p2() $$
1
1
+Level Code Message
+Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
2
2
+Level Code Message
+Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
+Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
3
3
+Level Code Message
+Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
+Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
+Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
-Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
+Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Hi, I am a useless error message
drop procedure peter_p1 $$
diff --git a/mysql-test/r/signal_demo3.result b/mysql-test/r/signal_demo3.result
index aa769659e51..a89ce703d20 100644
--- a/mysql-test/r/signal_demo3.result
+++ b/mysql-test/r/signal_demo3.result
@@ -95,11 +95,11 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
-Error 1644 Oops in proc_5
-Error 1644 Oops in proc_4
-Error 1644 Oops in proc_3
-Error 1644 Oops in proc_2
-Error 1644 Oops in proc_1
+Error 1051 Unknown table 'oops_it_is_not_here'
+Error 1644 Oops in proc_9
+Error 1644 Oops in proc_8
+Error 1644 Oops in proc_7
+Error 1644 Oops in proc_6
SET @@session.max_error_count = 7;
SELECT @@session.max_error_count;
@@session.max_error_count
@@ -108,13 +108,13 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
+Error 1051 Unknown table 'oops_it_is_not_here'
+Error 1644 Oops in proc_9
+Error 1644 Oops in proc_8
Error 1644 Oops in proc_7
Error 1644 Oops in proc_6
Error 1644 Oops in proc_5
Error 1644 Oops in proc_4
-Error 1644 Oops in proc_3
-Error 1644 Oops in proc_2
-Error 1644 Oops in proc_1
SET @@session.max_error_count = 9;
SELECT @@session.max_error_count;
@@session.max_error_count
@@ -123,6 +123,7 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
+Error 1051 Unknown table 'oops_it_is_not_here'
Error 1644 Oops in proc_9
Error 1644 Oops in proc_8
Error 1644 Oops in proc_7
@@ -131,7 +132,6 @@ Error 1644 Oops in proc_5
Error 1644 Oops in proc_4
Error 1644 Oops in proc_3
Error 1644 Oops in proc_2
-Error 1644 Oops in proc_1
drop database demo;
SET @@global.max_error_count = @start_global_value;
SELECT @@global.max_error_count;
diff --git a/mysql-test/r/sp-big.result b/mysql-test/r/sp-big.result
index 9765508859c..d28b7004330 100644
--- a/mysql-test/r/sp-big.result
+++ b/mysql-test/r/sp-big.result
@@ -46,6 +46,8 @@ end while;
close cur1;
end|
call p1();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select count(*) from t1;
count(*)
256
diff --git a/mysql-test/r/sp-bugs.result b/mysql-test/r/sp-bugs.result
index 2374b433fba..a88c89537e2 100644
--- a/mysql-test/r/sp-bugs.result
+++ b/mysql-test/r/sp-bugs.result
@@ -43,6 +43,8 @@ END|
SELECT f2 ();
f2 ()
NULL
+Warnings:
+Error 1305 FUNCTION testdb.f_not_exists does not exist
DROP SCHEMA testdb;
USE test;
#
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index 0a0f620b80a..c7ea4cbb311 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -711,6 +711,8 @@ looping i
looping 1
looping i
looping 0
+Warnings:
+Error 1062 Duplicate entry '1' for key 'a'
call proc_26977_works(2);
do something
do something
@@ -730,6 +732,8 @@ looping i
looping 0
optimizer: keep hreturn
optimizer: keep hreturn
+Warnings:
+Error 1062 Duplicate entry '2' for key 'a'
drop table t1;
drop procedure proc_26977_broken;
drop procedure proc_26977_works;
@@ -888,3 +892,56 @@ Pos Instruction
4 jump 6
5 error 1339
DROP PROCEDURE p1;
+#
+# Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
+#
+
+# - Case 4: check that "No Data trumps Warning".
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE c CURSOR FOR SELECT a FROM t1;
+OPEN c;
+BEGIN
+DECLARE v INT;
+DECLARE CONTINUE HANDLER FOR SQLWARNING
+BEGIN
+SELECT "Warning found!";
+SHOW WARNINGS;
+END;
+DECLARE EXIT HANDLER FOR NOT FOUND
+BEGIN
+SELECT "End of Result Set found!";
+SHOW WARNINGS;
+END;
+WHILE TRUE DO
+FETCH c INTO v;
+END WHILE;
+END;
+CLOSE c;
+SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack
+END|
+SET SESSION debug="+d,bug23032_emit_warning";
+CALL p1();
+Warning found!
+Warning found!
+Level Code Message
+Warning 1105 Unknown error
+Warning found!
+Warning found!
+Level Code Message
+Warning 1105 Unknown error
+Warning found!
+Warning found!
+Level Code Message
+Warning 1105 Unknown error
+End of Result Set found!
+End of Result Set found!
+Level Code Message
+Warning 1105 Unknown error
+Error 1329 No data - zero rows fetched, selected, or processed
+SET SESSION debug="-d,bug23032_emit_warning";
+DROP PROCEDURE p1;
+DROP TABLE t1;
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 0f658ee831e..7b8364379df 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1344,6 +1344,8 @@ set @in_func := 0;
select func_20713_a();
func_20713_a()
NULL
+Warnings:
+Error 1146 Table 'test.bogus_table_20713' doesn't exist
select @in_func;
@in_func
2
@@ -1351,6 +1353,8 @@ set @in_func := 0;
select func_20713_b();
func_20713_b()
NULL
+Warnings:
+Error 1146 Table 'test.bogus_table_20713' doesn't exist
select @in_func;
@in_func
2
@@ -1714,3 +1718,246 @@ DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
End of 5.1 tests
+#
+# Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
+#
+
+# - Case 1
+
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+DROP PROCEDURE IF EXISTS p3;
+DROP PROCEDURE IF EXISTS p4;
+DROP PROCEDURE IF EXISTS p5;
+DROP PROCEDURE IF EXISTS p6;
+CREATE PROCEDURE p1()
+BEGIN
+SELECT CAST('10 ' as unsigned integer);
+SELECT 1;
+CALL p2();
+END|
+CREATE PROCEDURE p2()
+BEGIN
+SELECT CAST('10 ' as unsigned integer);
+END|
+CALL p1();
+CAST('10 ' as unsigned integer)
+10
+1
+1
+CAST('10 ' as unsigned integer)
+10
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '10 '
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+
+# - Case 2
+
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE c INT DEFAULT 0;
+DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+CALL p2();
+CALL p3();
+CALL p4();
+SELECT c;
+SELECT @@warning_count;
+SHOW WARNINGS;
+END|
+CREATE PROCEDURE p2()
+BEGIN
+SELECT CAST('10 ' as unsigned integer);
+END|
+CREATE PROCEDURE p3()
+BEGIN
+SELECT CAST('10 ' as unsigned integer);
+SELECT 1;
+END|
+CREATE PROCEDURE p4()
+BEGIN
+SELECT CAST('10 ' as unsigned integer);
+CALL p2();
+END|
+CREATE PROCEDURE p5()
+BEGIN
+SELECT CAST('10 ' as unsigned integer);
+SHOW WARNINGS;
+END|
+CREATE PROCEDURE P6()
+BEGIN
+DECLARE c INT DEFAULT 0;
+DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+CALL p5();
+SELECT c;
+END|
+CALL p1();
+CAST('10 ' as unsigned integer)
+10
+CAST('10 ' as unsigned integer)
+10
+1
+1
+CAST('10 ' as unsigned integer)
+10
+CAST('10 ' as unsigned integer)
+10
+c
+3
+@@warning_count
+1
+Level Code Message
+Warning 1292 Truncated incorrect INTEGER value: '10 '
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '10 '
+CALL p6();
+CAST('10 ' as unsigned integer)
+10
+Level Code Message
+Warning 1292 Truncated incorrect INTEGER value: '10 '
+c
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '10 '
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP PROCEDURE p3;
+DROP PROCEDURE p4;
+DROP PROCEDURE p5;
+DROP PROCEDURE p6;
+
+# - Case 3: check that "Exception trumps No Data".
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE c CURSOR FOR SELECT a FROM t1;
+OPEN c;
+BEGIN
+DECLARE v1 INT;
+DECLARE v2 INT;
+DECLARE EXIT HANDLER FOR SQLEXCEPTION
+SELECT "Error caught (expected)";
+DECLARE EXIT HANDLER FOR NOT FOUND
+SELECT "End of Result Set found!";
+WHILE TRUE DO
+FETCH c INTO v1, v2;
+END WHILE;
+END;
+CLOSE c;
+SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack
+END|
+CALL p1();
+Error caught (expected)
+Error caught (expected)
+DROP PROCEDURE p1;
+DROP TABLE t1;
+#
+# Bug#36185: Incorrect precedence for warning and exception handlers
+#
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+CREATE TABLE t1 (a INT, b INT NOT NULL);
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLWARNING SELECT 'warning';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'exception';
+INSERT INTO t1 VALUES (CAST('10 ' AS SIGNED), NULL);
+END|
+CALL p1();
+exception
+exception
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '10 '
+Error 1048 Column 'b' cannot be null
+DROP TABLE t1;
+DROP PROCEDURE p1;
+#
+# Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
+#
+
+# - Case 1
+
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1, 2);
+CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
+BEGIN
+DECLARE EXIT HANDLER FOR SQLWARNING
+SET NEW.a = 10;
+SET NEW.a = 99999999999;
+END|
+UPDATE t1 SET b = 20;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SHOW WARNINGS;
+Level Code Message
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT * FROM t1;
+a b
+10 20
+DROP TRIGGER t1_bu;
+DROP TABLE t1;
+
+# - Case 2
+
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(b CHAR(1));
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+INSERT INTO t2 VALUES('ab'); # Produces a warning.
+INSERT INTO t2 VALUES('b'); # Does not produce a warning,
+# previous warning should be cleared.
+END|
+INSERT INTO t1 VALUES(0);
+SHOW WARNINGS;
+Level Code Message
+SELECT * FROM t1;
+a
+0
+SELECT * FROM t2;
+b
+a
+b
+DROP TRIGGER t1_bi;
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# Bug#9857: Stored procedures: handler for sqlwarning ignored
+#
+SET @sql_mode_saved = @@sql_mode;
+SET sql_mode = traditional;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLWARNING
+SELECT 'warning caught (expected)';
+SELECT 5 / 0;
+END|
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+SELECT 'error caught (unexpected)';
+SELECT 5 / 0;
+END|
+CALL p1();
+5 / 0
+NULL
+warning caught (expected)
+warning caught (expected)
+Warnings:
+Warning 1365 Division by 0
+SHOW WARNINGS;
+Level Code Message
+Warning 1365 Division by 0
+CALL p2();
+5 / 0
+NULL
+Warnings:
+Warning 1365 Division by 0
+SHOW WARNINGS;
+Level Code Message
+Warning 1365 Division by 0
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+SET sql_mode = @sql_mode_saved;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 76d4bf2dea0..243bfb6c07d 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -737,6 +737,8 @@ close c;
end|
insert into t2 values ("foo", 42, -1.9), ("bar", 3, 12.1), ("zap", 666, -3.14)|
call cur1()|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select * from t1|
id data
foo 40
@@ -772,6 +774,8 @@ close c1;
close c2;
end|
call cur2()|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select * from t3 order by i,s|
s i
bar 3
@@ -861,6 +865,8 @@ end$
set @@sql_mode = ''|
set sql_select_limit = 1|
call modes(@c1, @c2)|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
set sql_select_limit = default|
select @c1, @c2|
@c1 @c2
@@ -1682,42 +1688,64 @@ end|
call h_ee()|
h_ee
Inner (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_es()|
h_es
Outer (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_en()|
h_en
Outer (good)
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
call h_ew()|
h_ew
Outer (good)
call h_ex()|
h_ex
Outer (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_se()|
h_se
Inner (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_ss()|
h_ss
Inner (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_sn()|
h_sn
Outer (good)
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
call h_sw()|
h_sw
Outer (good)
call h_sx()|
h_sx
Outer (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_ne()|
h_ne
Inner (good)
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
call h_ns()|
h_ns
Inner (good)
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
call h_nn()|
h_nn
Inner (good)
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
call h_we()|
h_we
Inner (good)
@@ -1730,12 +1758,18 @@ Inner (good)
call h_xe()|
h_xe
Inner (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_xs()|
h_xs
Inner (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_xx()|
h_xx
Inner (good)
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
drop table t3|
drop procedure h_ee|
drop procedure h_es|
@@ -1884,6 +1918,8 @@ set @x2 = 2;
close c1;
end|
call bug2260()|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select @x2|
@x2
2
@@ -2027,6 +2063,8 @@ insert into t3 values (123456789012);
insert into t3 values (0);
end|
call bug2780()|
+Warnings:
+Warning 1264 Out of range value for column 's1' at row 1
select @x|
@x
1
@@ -2449,6 +2487,8 @@ declare continue handler for sqlstate 'HY000' begin end;
select s1 from t3 union select s2 from t3;
end|
call bug4904()|
+Warnings:
+Error 1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin2_general_ci,IMPLICIT) for operation 'UNION'
drop procedure bug4904|
drop table t3|
drop procedure if exists bug336|
@@ -2588,13 +2628,17 @@ select row_count()|
row_count()
1
call bug4905()|
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
select row_count()|
row_count()
-0
+-1
call bug4905()|
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
select row_count()|
row_count()
-0
+-1
select * from t3|
s1
1
@@ -2615,10 +2659,14 @@ insert into t3 values (1)|
call bug6029()|
sqlstate 23000
sqlstate 23000
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
delete from t3|
call bug6029()|
1136
1136
+Warnings:
+Error 1136 Column count doesn't match value count at row 1
drop procedure bug6029|
drop table t3|
drop procedure if exists bug8540|
@@ -2910,15 +2958,23 @@ end|
call bug6900()|
2
2
+Warnings:
+Error 1136 Column count doesn't match value count at row 1
call bug9074()|
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
call bug6900_9074(0)|
sqlexception
sqlexception
+Warnings:
+Error 1136 Column count doesn't match value count at row 1
call bug6900_9074(1)|
23000
23000
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
drop procedure bug6900|
drop procedure bug9074|
drop procedure bug6900_9074|
@@ -2961,9 +3017,13 @@ delete from t1|
call bug9856()|
16
16
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
call bug9856()|
16
16
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
drop procedure bug9856|
drop procedure if exists bug9674_1|
drop procedure if exists bug9674_2|
@@ -3194,6 +3254,8 @@ x
2
x
3
+Warnings:
+Error 1326 Cursor is not open
call bug10961()|
x
1
@@ -3201,6 +3263,8 @@ x
2
x
3
+Warnings:
+Error 1326 Cursor is not open
drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
@@ -3316,7 +3380,11 @@ insert into t1 values
('Name4', 13),
('Name5', 14)|
call bug11529()|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
call bug11529()|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
delete from t1|
drop procedure bug11529|
set character set utf8|
@@ -3490,24 +3558,32 @@ end;
end if;
end|
call bug12168('a')|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
1
3
truncate t4|
call bug12168('b')|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
2
4
truncate t4|
call bug12168('a')|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
1
3
truncate t4|
call bug12168('b')|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
2
@@ -3807,6 +3883,8 @@ end|
call bug7049_2()|
Result
Caught it
+Warnings:
+Error 1062 Duplicate entry '42' for key 'x'
select * from t3|
x
42
@@ -3814,12 +3892,16 @@ delete from t3|
call bug7049_4()|
Result
Caught it
+Warnings:
+Error 1062 Duplicate entry '42' for key 'x'
select * from t3|
x
42
select bug7049_2()|
bug7049_2()
1
+Warnings:
+Error 1062 Duplicate entry '42' for key 'x'
drop table t3|
drop procedure bug7049_1|
drop procedure bug7049_2|
@@ -3947,6 +4029,8 @@ end|
call bug14845()|
a
0
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
drop procedure bug14845|
drop procedure if exists bug13549_1|
drop procedure if exists bug13549_2|
@@ -4150,6 +4234,8 @@ end|
call bug13729()|
55
55
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
select * from t3|
s1
1
@@ -4186,11 +4272,15 @@ Handler
boo
v isnull(v)
NULL 1
+Warnings:
+Error 1054 Unknown column 'undefined_var' in 'field list'
call bug14643_2()|
Handler
boo
Handler
boo
+Warnings:
+Error 1054 Unknown column 'undefined_var' in 'field list'
drop procedure bug14643_1|
drop procedure bug14643_2|
drop procedure if exists bug14304|
@@ -4514,11 +4604,15 @@ Handler
error
End
done
+Warnings:
+Error 1054 Unknown column 'v' in 'field list'
call bug14498_2()|
Handler
error
End
done
+Warnings:
+Error 1054 Unknown column 'v' in 'field list'
call bug14498_3()|
v
maybe
@@ -4526,16 +4620,22 @@ Handler
error
End
done
+Warnings:
+Error 1054 Unknown column 'v' in 'field list'
call bug14498_4()|
Handler
error
End
done
+Warnings:
+Error 1054 Unknown column 'v' in 'field list'
call bug14498_5()|
Handler
error
End
done
+Warnings:
+Error 1054 Unknown column 'v' in 'field list'
drop procedure bug14498_1|
drop procedure bug14498_2|
drop procedure bug14498_3|
@@ -4546,6 +4646,8 @@ drop procedure if exists bug15231_1|
drop procedure if exists bug15231_2|
drop procedure if exists bug15231_3|
drop procedure if exists bug15231_4|
+drop procedure if exists bug15231_5|
+drop procedure if exists bug15231_6|
create table t3 (id int not null)|
create procedure bug15231_1()
begin
@@ -4568,7 +4670,7 @@ end|
create procedure bug15231_3()
begin
declare exit handler for sqlwarning
-select 'Caught it (wrong)' as 'Result';
+select 'Caught it (correct)' as 'Result';
call bug15231_4();
end|
create procedure bug15231_4()
@@ -4576,6 +4678,20 @@ begin
declare x decimal(2,1);
set x = 'zap';
select 'Missed it (correct)' as 'Result';
+show warnings;
+end|
+create procedure bug15231_5()
+begin
+declare exit handler for sqlwarning
+select 'Caught it (wrong)' as 'Result';
+call bug15231_6();
+end|
+create procedure bug15231_6()
+begin
+declare x decimal(2,1);
+set x = 'zap';
+select 'Missed it (correct)' as 'Result';
+select id from t3;
end|
call bug15231_1()|
1
@@ -4583,19 +4699,29 @@ Before NOT FOUND condition is triggered
2
After NOT FOUND condtition is triggered
xid xdone
-1 0
+1 1
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
call bug15231_3()|
Result
Missed it (correct)
+Level Code Message
+Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
+Result
+Caught it (correct)
Warnings:
Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
-drop table if exists t3|
-drop procedure if exists bug15231_1|
-drop procedure if exists bug15231_2|
-drop procedure if exists bug15231_3|
-drop procedure if exists bug15231_4|
+call bug15231_5()|
+Result
+Missed it (correct)
+id
+drop table t3|
+drop procedure bug15231_1|
+drop procedure bug15231_2|
+drop procedure bug15231_3|
+drop procedure bug15231_4|
+drop procedure bug15231_5|
+drop procedure bug15231_6|
drop procedure if exists bug15011|
create table t3 (c1 int primary key)|
insert into t3 values (1)|
@@ -4613,6 +4739,8 @@ end|
call bug15011()|
Handler
Inner
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
drop procedure bug15011|
drop table t3|
drop procedure if exists bug17476|
@@ -4688,6 +4816,8 @@ i
1
i
0
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
drop table t3|
drop procedure bug16887|
drop procedure if exists bug16474_1|
@@ -4760,6 +4890,8 @@ declare continue handler for sqlexception begin end;
select no_such_function();
end|
call bug18787()|
+Warnings:
+Error 1305 FUNCTION test.no_such_function does not exist
drop procedure bug18787|
create database bug18344_012345678901|
use bug18344_012345678901|
@@ -5133,6 +5265,8 @@ statement failed
statement failed
statement after update
statement after update
+Warnings:
+Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@@ -5144,6 +5278,8 @@ statement failed
statement failed
statement after update
statement after update
+Warnings:
+Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@@ -5176,6 +5312,8 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
+Warnings:
+Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@@ -5191,6 +5329,8 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
+Warnings:
+Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@@ -5224,6 +5364,8 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
+Warnings:
+Error 1305 FUNCTION test.no_such_function does not exist
drop procedure bug8153_proc_a|
drop procedure bug8153_proc_b|
drop table t3|
@@ -5792,9 +5934,13 @@ end|
select func_8407_a()|
func_8407_a()
NULL
+Warnings:
+Error 1146 Table 'test.no_such_view' doesn't exist
select func_8407_b()|
func_8407_b()
1500
+Warnings:
+Error 1146 Table 'test.no_such_view' doesn't exist
drop function func_8407_a|
drop function func_8407_b|
drop table if exists table_26503|
@@ -5916,6 +6062,8 @@ looping i
looping 0
leaving handler
leaving handler
+Warnings:
+Error 1062 Duplicate entry '1' for key 'a'
call proc_26503_ok_2(2)|
do something
do something
@@ -5927,6 +6075,8 @@ looping i
looping 4
leaving handler
leaving handler
+Warnings:
+Error 1062 Duplicate entry '2' for key 'a'
call proc_26503_ok_3(3)|
do something
do something
@@ -5946,6 +6096,8 @@ looping i
looping 0
leaving handler
leaving handler
+Warnings:
+Error 1062 Duplicate entry '3' for key 'a'
call proc_26503_ok_4(4)|
do something
do something
@@ -5957,6 +6109,8 @@ looping i
looping 4
leaving handler
leaving handler
+Warnings:
+Error 1062 Duplicate entry '4' for key 'a'
drop table table_26503|
drop procedure proc_26503_ok_1|
drop procedure proc_26503_ok_2|
@@ -6670,6 +6824,8 @@ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @exception:= 'run';
SELECT x FROM t1;
END|
CALL bug29770();
+Warnings:
+Error 1054 Unknown column 'x' in 'field list'
SELECT @state, @exception;
@state @exception
run NULL
@@ -6708,6 +6864,8 @@ end;
end while;
end//
call proc_33618(20);
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
drop table t_33618;
drop procedure proc_33618;
#
diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result
index f55e535a293..4fa91121f50 100644
--- a/mysql-test/r/sp_trans.result
+++ b/mysql-test/r/sp_trans.result
@@ -99,6 +99,8 @@ return i;
end|
set @error_in_func:= 0|
insert into t1 values (bug10015_6(5)), (bug10015_6(6))|
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
select @error_in_func|
@error_in_func
1
@@ -524,6 +526,8 @@ until done end repeat;
close c;
end|
call bug14210()|
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select count(*) from t4|
count(*)
256
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 4f259fc4d7d..79f8c20a150 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -1190,6 +1190,8 @@ select'a'; insert into t1 values (200); end;|
call t1();
a
a
+Warnings:
+Error 1264 Out of range value for column 'col1' at row 1
select * from t1;
col1
drop procedure t1;
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index ba6b9f81a2d..33f5c6b5165 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -210,4 +210,16 @@ UPDATE t1,t2 SET t1.a = t2.a;
INSERT INTO t2 SELECT f1();
DROP TABLE t1,t2,t3;
DROP FUNCTION f1;
+#
+# Bug #48067: A temp table with the same name as an existing table,
+# makes drop database fail.
+#
+DROP TEMPORARY TABLE IF EXISTS bug48067.t1;
+DROP DATABASE IF EXISTS bug48067;
+CREATE DATABASE bug48067;
+CREATE TABLE bug48067.t1 (c1 int);
+INSERT INTO bug48067.t1 values (1);
+CREATE TEMPORARY TABLE bug48067.t1 (c1 int);
+DROP DATABASE bug48067;
+DROP TEMPORARY table bug48067.t1;
End of 5.1 tests
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index b6ad1ff31bf..be81afe1a43 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -1677,3 +1677,25 @@ SET @@sql_quote_show_create = @sql_quote_show_create_saved;
# End of Bug#34828.
+# Make sure we can manipulate with autocommit in the
+# along with other variables.
+drop table if exists t1;
+drop function if exists t1_max;
+drop function if exists t1_min;
+create table t1 (a int) engine=innodb;
+insert into t1(a) values (0), (1);
+create function t1_max() returns int return (select max(a) from t1);
+create function t1_min() returns int return (select min(a) from t1);
+select t1_min();
+t1_min()
+0
+select t1_max();
+t1_max()
+1
+set @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
+@@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
+@@session.autocommit=t1_min(), @@session.autocommit=t1_max();
+# Cleanup.
+drop table t1;
+drop function t1_min;
+drop function t1_max;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index e1c1d6f4128..777ac9c258f 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1955,15 +1955,15 @@ CHECK TABLE v1, v2, v3, v4, v5, v6;
Table Op Msg_type Msg_text
test.v1 check Error FUNCTION test.f1 does not exist
test.v1 check Error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
-test.v1 check status Operation failed
+test.v1 check error Corrupt
test.v2 check status OK
test.v3 check Error FUNCTION test.f1 does not exist
test.v3 check Error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
-test.v3 check status Operation failed
+test.v3 check error Corrupt
test.v4 check status OK
test.v5 check Error FUNCTION test.f1 does not exist
test.v5 check Error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
-test.v5 check status Operation failed
+test.v5 check error Corrupt
test.v6 check status OK
create function f1 () returns int return (select max(col1) from t1);
DROP TABLE t1;
@@ -3946,6 +3946,8 @@ create view a as select 1;
end|
call p();
call p();
+Warnings:
+Error 1050 Table 'a' already exists
drop view a;
drop procedure p;
#
diff --git a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
index d6d44ccad8e..23943474541 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
@@ -28,6 +28,25 @@ INSERT INTO t1 VALUES (1,2), (2,3);
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(1000));
+INSERT INTO t1 VALUES (CURRENT_USER());
+INSERT INTO t1 VALUES (FOUND_ROWS());
+INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
+INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
+INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
+INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
+INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
+INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
+INSERT INTO t1 VALUES (ROW_COUNT());
+INSERT INTO t1 VALUES (SESSION_USER());
+INSERT INTO t1 VALUES (SLEEP(1));
+INSERT INTO t1 VALUES (SYSDATE());
+INSERT INTO t1 VALUES (SYSTEM_USER());
+INSERT INTO t1 VALUES (USER());
+INSERT INTO t1 VALUES (UUID());
+INSERT INTO t1 VALUES (UUID_SHORT());
+INSERT INTO t1 VALUES (VERSION());
+INSERT INTO t1 VALUES (RAND());
DROP DATABASE b42851;
USE test;
#
@@ -67,8 +86,11 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc
SELECT sf_bug50192();
sf_bug50192()
1
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
SHOW WARNINGS;
Level Code Message
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
DROP FUNCTION sf_bug50192;
DROP TRIGGER tr_bug50192;
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result
index e9d1cdad856..ba361e59428 100644
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result
@@ -35,7 +35,7 @@ CREATE FUNCTION func_retval_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUE
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 VALUES (func_retval_1());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -46,7 +46,7 @@ CREATE FUNCTION func_retval_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUE
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 VALUES (func_retval_2());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -58,31 +58,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe UUID() function.
@@ -90,7 +78,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -98,11 +86,11 @@ DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe UUID() function.
CREATE VIEW view_retval_2 AS SELECT func_retval_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -114,7 +102,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 VALUES (func_retval_1())";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -125,7 +113,7 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -134,33 +122,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe UUID() function.
@@ -168,7 +142,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -176,11 +150,11 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe UUID() function.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -190,18 +164,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe UUID() function.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (UUID()); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 VALUES (UUID()); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -210,33 +184,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-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.t0)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe UUID() function.
@@ -244,7 +204,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -254,7 +214,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -265,7 +225,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -274,33 +234,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe UUID() function.
@@ -308,7 +254,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -318,7 +264,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -326,12 +272,10 @@ DROP TRIGGER trig_1;
Invoking view view_retval_1 returning value from unsafe UUID() function.
CREATE VIEW view_retval_1 AS SELECT UUID();
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -342,29 +286,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-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
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe UUID() function.
@@ -372,19 +306,17 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe UUID() function.
CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -396,7 +328,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_retval_1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -407,7 +339,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 VALUES (UUID())";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -416,7 +348,7 @@ Invoking unsafe UUID() function.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 VALUES (UUID());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -429,7 +361,7 @@ CREATE FUNCTION func_retval_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUE
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 VALUES (func_retval_1());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -440,7 +372,7 @@ CREATE FUNCTION func_retval_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUE
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 VALUES (func_retval_2());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -452,31 +384,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
@@ -484,7 +404,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -492,11 +412,11 @@ DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe @@hostname variable.
CREATE VIEW view_retval_2 AS SELECT func_retval_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -508,7 +428,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 VALUES (func_retval_1())";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -519,7 +439,7 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -528,33 +448,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
@@ -562,7 +468,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -570,11 +476,11 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -584,18 +490,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe @@hostname variable.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (@@hostname); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 VALUES (@@hostname); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -604,33 +510,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-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.t0)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
@@ -638,7 +530,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -648,7 +540,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -659,7 +551,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -668,33 +560,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
@@ -702,7 +580,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -712,7 +590,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -723,7 +601,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 VALUES (@@hostname)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -732,7 +610,7 @@ Invoking unsafe @@hostname variable.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 VALUES (@@hostname);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -743,7 +621,7 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -752,33 +630,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
@@ -786,7 +650,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -794,11 +658,11 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -808,18 +672,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT * FROM data_table LIMIT 1; END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 SELECT * FROM data_table LIMIT 1; INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -828,33 +692,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-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.t0)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
@@ -862,7 +712,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -872,7 +722,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -883,7 +733,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -892,33 +742,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
@@ -926,7 +762,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -936,7 +772,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -944,12 +780,10 @@ DROP TRIGGER trig_1;
Invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
CREATE VIEW view_retval_1 AS SELECT * FROM data_table LIMIT 1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -960,29 +794,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-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
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
@@ -990,19 +814,17 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -1014,7 +836,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_retval_1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -1025,7 +847,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 SELECT * FROM data_table LIMIT 1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -1034,7 +856,7 @@ Invoking unsafe SELECT...LIMIT statement.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 SELECT * FROM data_table LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -1047,7 +869,7 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1056,33 +878,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
@@ -1090,7 +898,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1098,11 +906,11 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -1112,18 +920,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO t0 VALUES (1), (2); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1132,33 +940,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-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.t0)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
@@ -1166,7 +960,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1176,7 +970,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -1187,7 +981,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1196,33 +990,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
@@ -1230,7 +1010,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1240,7 +1020,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -1251,7 +1031,7 @@ PREPARE prep_1 FROM "INSERT DELAYED INTO t0 VALUES (1), (2)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -1260,7 +1040,7 @@ Invoking unsafe INSERT DELAYED statement.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT DELAYED INTO t0 VALUES (1), (2);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1271,7 +1051,7 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1280,35 +1060,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
@@ -1316,7 +1080,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1324,11 +1088,11 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -1338,66 +1102,39 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe update of two autoinc columns.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO double_autoinc_table VALUES (NULL); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
-master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
-master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
@@ -1405,7 +1142,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1415,21 +1152,9 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
-master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
@@ -1438,7 +1163,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1447,35 +1172,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns.
@@ -1483,7 +1192,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1493,7 +1202,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -1504,7 +1213,7 @@ PREPARE prep_1 FROM "INSERT INTO double_autoinc_table VALUES (NULL)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -1513,7 +1222,7 @@ Invoking unsafe update of two autoinc columns.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO double_autoinc_table VALUES (NULL);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1524,7 +1233,7 @@ CREATE FUNCTION func_retval_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUE
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 VALUES (func_retval_1());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -1535,7 +1244,7 @@ CREATE FUNCTION func_retval_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUE
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 VALUES (func_retval_2());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -1547,31 +1256,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe UDF.
@@ -1579,7 +1276,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1587,11 +1284,11 @@ DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe UDF.
CREATE VIEW view_retval_2 AS SELECT func_retval_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -1603,7 +1300,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 VALUES (func_retval_1())";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -1614,7 +1311,7 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1623,33 +1320,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe UDF.
@@ -1657,7 +1340,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1665,11 +1348,11 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe UDF.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -1679,18 +1362,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (myfunc_int(10)); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 VALUES (myfunc_int(10)); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1699,33 +1382,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-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.t0)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe UDF.
@@ -1733,7 +1402,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1743,7 +1412,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -1754,7 +1423,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1763,33 +1432,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe UDF.
@@ -1797,7 +1452,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1807,7 +1462,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -1815,12 +1470,10 @@ DROP TRIGGER trig_1;
Invoking view view_sidef_1 invoking unsafe UDF.
CREATE VIEW view_sidef_1 AS SELECT myfunc_int(10);
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_sidef_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1829,29 +1482,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_sidef_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_sidef_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-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
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_sidef_1 invoking unsafe UDF.
@@ -1859,19 +1502,17 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking view view_sidef_1 invoking unsafe UDF.
CREATE VIEW view_sidef_2 AS SELECT * FROM view_sidef_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -1881,7 +1522,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_sidef_1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -1892,7 +1533,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 VALUES (myfunc_int(10))";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -1901,7 +1542,7 @@ Invoking unsafe UDF.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 VALUES (myfunc_int(10));
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1912,7 +1553,7 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -1921,33 +1562,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
@@ -1955,7 +1582,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -1963,11 +1590,11 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -1977,62 +1604,39 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
@@ -2040,7 +1644,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2050,19 +1654,9 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
@@ -2071,7 +1665,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -2080,33 +1674,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log.
@@ -2114,7 +1694,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2124,7 +1704,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -2132,12 +1712,10 @@ DROP TRIGGER trig_1;
Invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
CREATE VIEW view_retval_1 AS SELECT COUNT(*) FROM mysql.general_log;
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -2148,29 +1726,19 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-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
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
@@ -2178,19 +1746,17 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe use of mysql.general_log.
CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -2202,7 +1768,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_retval_1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -2213,7 +1779,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -2222,7 +1788,7 @@ Invoking unsafe use of mysql.general_log.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
@@ -2235,13 +1801,13 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -2250,47 +1816,31 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
-master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
@@ -2298,13 +1848,13 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2312,23 +1862,23 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -2338,30 +1888,30 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking statement that is unsafe in many ways.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END;
+CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -2370,47 +1920,31 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-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.double_autoinc_table)
-master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
@@ -2418,13 +1952,13 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2434,13 +1968,13 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -2451,13 +1985,13 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -2466,47 +2000,31 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
-master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
@@ -2514,13 +2032,13 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2530,13 +2048,13 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -2547,13 +2065,13 @@ PREPARE prep_1 FROM "INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -2562,13 +2080,13 @@ Invoking statement that is unsafe in many ways.
* binlog_format = STATEMENT: expect 7 warnings.
INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -2579,8 +2097,8 @@ CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -2589,37 +2107,21 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.ta0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
@@ -2627,8 +2129,8 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2636,13 +2138,13 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -2652,70 +2154,43 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta0 VALUES (multi_unsafe_func()); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta0)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe several times.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta0)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe several times.
@@ -2723,8 +2198,8 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2734,22 +2209,10 @@ PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.ta0)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
@@ -2758,8 +2221,8 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -2768,37 +2231,21 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
-master-bin.000001 # Table_map # # table_id: # (test.ta0)
-master-bin.000001 # Table_map # # table_id: # (test.ta1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe several times.
@@ -2806,8 +2253,8 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2817,8 +2264,8 @@ PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -2827,13 +2274,13 @@ DROP TRIGGER trig_1;
Invoking view view_sidef_1 invoking statement that is unsafe several times.
CREATE VIEW view_sidef_1 AS SELECT multi_unsafe_func();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t1 SELECT * FROM view_sidef_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
@@ -2842,33 +2289,21 @@ CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_sidef_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Table_map # # table_id: # (test.t0)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
@@ -2876,8 +2311,8 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
@@ -2885,13 +2320,13 @@ DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
CREATE VIEW view_sidef_2 AS SELECT * FROM view_sidef_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
@@ -2901,8 +2336,8 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_sidef_1";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_2;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
@@ -2913,8 +2348,8 @@ PREPARE prep_1 FROM "INSERT INTO ta0 VALUES (multi_unsafe_func())";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
@@ -2923,8 +2358,8 @@ Invoking statement that is unsafe several times.
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO ta0 VALUES (multi_unsafe_func());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+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.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER double_autoinc_trig;
@@ -2962,24 +2397,24 @@ INSERT INTO autoinc_table VALUES (NULL);
The following variables *should* give a warning, despite they are replicated.
INSERT INTO t1 VALUES (@@session.sql_mode);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
INSERT INTO t1 VALUES (@@session.insert_id);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
DROP TABLE t1, autoinc_table;
CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
UPDATE t1 SET a=1 LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DELETE FROM t1 LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
CREATE PROCEDURE p1()
BEGIN
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
@@ -2989,7 +2424,7 @@ DELETE FROM t1 LIMIT 1;
END|
CALL p1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DROP PROCEDURE p1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
@@ -2997,7 +2432,7 @@ CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
INSERT INTO t1 VALUES ('a','b');
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DROP TABLE t1;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1(i INT PRIMARY KEY);
@@ -3006,7 +2441,7 @@ CREATE TABLE t3(i INT, ch CHAR(50));
"Should issue message Statement may not be safe to log in statement format."
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
CREATE FUNCTION func6()
RETURNS INT
BEGIN
@@ -3018,7 +2453,7 @@ END|
"Should issue message Statement may not be safe to log in statement format only once"
INSERT INTO t3 VALUES(func6(), UUID());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
"Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
CREATE FUNCTION fun_check_log_bin() RETURNS INT
BEGIN
@@ -3028,10 +2463,7 @@ RETURN 100;
END|
"One unsafe warning should be issued in the following statement"
SELECT fun_check_log_bin();
-fun_check_log_bin()
-100
-Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+ERROR HY000: Cannot change the sql_log_bin inside a stored function or trigger
"SQL_LOG_BIN should be ON still"
SHOW VARIABLES LIKE "SQL_LOG_BIN";
Variable_name Value
@@ -3087,16 +2519,16 @@ CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
INSERT INTO t1 VALUES(@@global.sync_binlog);
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
UPDATE t1 SET i = 999 LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DELETE FROM t1 LIMIT 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DROP TABLE t1, t2;
SET @@SESSION.SQL_MODE = @save_sql_mode;
SET @old_binlog_format = @@session.binlog_format;
@@ -3146,18 +2578,18 @@ END|
# so it should produce unsafe warning.
INSERT INTO t2 SET a = func_modify_t1();
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
SET SESSION binlog_format = MIXED;
# Check if the statement is logged in row format.
INSERT INTO t2 SET a = func_modify_t1();
-SHOW BINLOG EVENTS FROM 1493;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 1493 Query 1 1561 BEGIN
-master-bin.000001 1561 Table_map 1 1603 table_id: 205 (test.t2)
-master-bin.000001 1603 Table_map 1 1645 table_id: 206 (test.t1)
-master-bin.000001 1645 Write_rows 1 1683 table_id: 206
-master-bin.000001 1683 Write_rows 1 1721 table_id: 205 flags: STMT_END_F
-master-bin.000001 1721 Query 1 1790 COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
DROP TABLE t1,t2;
DROP FUNCTION func_modify_t1;
SET SESSION binlog_format = STATEMENT;
@@ -3173,77 +2605,80 @@ end |
# so it should produce unsafe warning
INSERT INTO t1 SET a = 1;
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
SET SESSION binlog_format = MIXED;
# Check if the statement is logged in row format.
INSERT INTO t1 SET a = 2;
-SHOW BINLOG EVENTS FROM 2773;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 2773 Query 1 2841 BEGIN
-master-bin.000001 2841 Table_map 1 2882 table_id: 208 (test.t1)
-master-bin.000001 2882 Table_map 1 2924 table_id: 209 (test.t3)
-master-bin.000001 2924 Table_map 1 2966 table_id: 210 (test.t2)
-master-bin.000001 2966 Write_rows 1 3004 table_id: 210
-master-bin.000001 3004 Write_rows 1 3042 table_id: 209
-master-bin.000001 3042 Write_rows 1 3076 table_id: 208 flags: STMT_END_F
-master-bin.000001 3076 Query 1 3145 COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
DROP TABLE t1,t2,t3;
SET SESSION binlog_format = STATEMENT;
CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CURRENT_USER());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (FOUND_ROWS());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (ROW_COUNT());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (SESSION_USER());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (SLEEP(1));
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (SYSDATE());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (SYSTEM_USER());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (USER());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (UUID());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (UUID_SHORT());
Warnings:
-Note 1592 Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+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.
INSERT INTO t1 VALUES (VERSION());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+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.
INSERT INTO t1 VALUES (RAND());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+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.
DELETE FROM t1;
SET TIMESTAMP=1000000;
INSERT INTO t1 VALUES
diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
index 45fae25e0df..a2f6afc1004 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
@@ -72,6 +72,26 @@ UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(1000));
+INSERT INTO t1 VALUES (CURRENT_USER()); #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (FOUND_ROWS()); #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (GET_LOCK('tmp', 1)); #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp')); #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (IS_USED_LOCK('tmp')); #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); #marked unsafe in BUG#39701
+INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
+INSERT INTO t1 VALUES (RELEASE_LOCK('tmp')); #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (ROW_COUNT()); #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (SESSION_USER()); #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (SLEEP(1)); #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (SYSDATE()); #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (SYSTEM_USER()); #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (USER()); #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (UUID()); #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (UUID_SHORT()); #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (VERSION()); #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (RAND()); #marked unsafe in BUG#49222
+
# clean up
DROP DATABASE b42851;
diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test
index cb0cac17930..ed42a2cdb19 100644
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test
@@ -468,6 +468,7 @@ BEGIN
END|
DELIMITER ;|
--echo "One unsafe warning should be issued in the following statement"
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN
SELECT fun_check_log_bin();
--echo "SQL_LOG_BIN should be ON still"
SHOW VARIABLES LIKE "SQL_LOG_BIN";
diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def
index 35ecf52decf..a9841f592f8 100644
--- a/mysql-test/suite/binlog/t/disabled.def
+++ b/mysql-test/suite/binlog/t/disabled.def
@@ -11,5 +11,4 @@
##############################################################################
binlog_truncate_innodb : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763
-binlog_unsafe : BUG#50312 2010-01-13 lsoares Warnings for unsafe sub-statement not returned to client
binlog_spurious_ddl_errors : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled
diff --git a/mysql-test/suite/federated/federated_server.result b/mysql-test/suite/federated/federated_server.result
index 5079a4dcfa0..e5cff2bb2bf 100644
--- a/mysql-test/suite/federated/federated_server.result
+++ b/mysql-test/suite/federated/federated_server.result
@@ -54,7 +54,7 @@ PASSWORD '',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
-select * from mysql.servers;
+select * from mysql.servers order by Server_name;
Server_name Host Db Username Password Port Socket Wrapper Owner
server_one 127.0.0.1 first_db root SLAVE_PORT mysql root
server_two 127.0.0.1 second_db root SLAVE_PORT mysql root
@@ -154,7 +154,7 @@ id name
drop table federated.t1;
drop server 'server_one';
drop server 'server_two';
-select * from mysql.servers;
+select * from mysql.servers order by Server_name;
Server_name Host Db Username Password Port Socket Wrapper Owner
drop table first_db.t1;
drop table second_db.t1;
@@ -254,6 +254,8 @@ password '', socket '', owner '', port 3306);
drop server 's1';
# End of 5.1 tests
use test;
+create table t1(a int);
+insert into t1 values (1);
create procedure p1 ()
begin
DECLARE v INT DEFAULT 0;
@@ -268,11 +270,13 @@ ALTER SERVER s OPTIONS (USER 'Remote');
DROP SERVER s;
SET v = v + 1;
END WHILE;
+select a into @a from t1; # Just reset warnings
END//
use test;
call p1();
call p1();
drop procedure p1;
+drop table t1;
drop server if exists s;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE federated;
diff --git a/mysql-test/suite/federated/federated_server.test b/mysql-test/suite/federated/federated_server.test
index ec952d071f2..9e883743450 100644
--- a/mysql-test/suite/federated/federated_server.test
+++ b/mysql-test/suite/federated/federated_server.test
@@ -62,7 +62,7 @@ eval create server 'server_two' foreign data wrapper 'mysql' options
OWNER 'root');
--replace_result $SLAVE_MYPORT SLAVE_PORT
-eval select * from mysql.servers;
+eval select * from mysql.servers order by Server_name;
DROP TABLE IF EXISTS federated.old;
--replace_result $SLAVE_MYPORT SLAVE_PORT
@@ -147,7 +147,7 @@ drop table federated.t1;
drop server 'server_one';
drop server 'server_two';
-select * from mysql.servers;
+select * from mysql.servers order by Server_name;
connection slave;
drop table first_db.t1;
@@ -301,6 +301,8 @@ drop server 's1';
connect (other,localhost,root,,);
connection master;
use test;
+create table t1(a int);
+insert into t1 values (1);
delimiter //;
create procedure p1 ()
begin
@@ -316,6 +318,7 @@ begin
DROP SERVER s;
SET v = v + 1;
END WHILE;
+ select a into @a from t1; # Just reset warnings
END//
delimiter ;//
connection other;
@@ -326,6 +329,7 @@ call p1();
connection other;
reap;
drop procedure p1;
+drop table t1;
drop server if exists s;
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result
index 3e2d084aa0c..2bc9a75a13e 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result
@@ -347,6 +347,8 @@ CALL h1();
-7- 1 1 1 1 1 1
END x1 x2 x3 x4 x5 x6
END 1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
DROP TABLE IF EXISTS tnull;
DROP PROCEDURE IF EXISTS sp1;
CREATE TABLE tnull(f1 int);
@@ -445,6 +447,8 @@ END//
CALL h2();
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
SELECT * FROM res_t1;
w x
a b
@@ -550,6 +554,8 @@ exit handler 2
exit handler 2
exit handler 1
exit handler 1
+Warnings:
+Error 1146 Table 'db_storedproc.tqq' doesn't exist
create table res_t1(w char unique, x char);
insert into res_t1 values ('a', 'b');
CREATE PROCEDURE h1 ()
@@ -580,6 +586,8 @@ END//
CALL h1();
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
This will fail, SQLSTATE 00000 is not allowed
CREATE PROCEDURE sp1()
begin1_label:BEGIN
@@ -623,6 +631,8 @@ CALL sp2();
NULL
@x2 @x
1 2
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
@@ -654,6 +664,8 @@ ERROR 42000: Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expe
CALL sp2();
-1- @x2 @x
-1- 0 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
SELECT '-3-', @x2, @x;
-3- @x2 @x
-3- 1 1
@@ -696,6 +708,8 @@ CALL sp2();
-2- 1 20
-4- @x2 @x
-4- 11 22
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
@@ -762,21 +776,33 @@ SELECT @done, @x;
0 1
INSERT INTO temp VALUES('1', NULL);
CALL sp1();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 1
INSERT INTO temp VALUES('2', NULL);
CALL sp2();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 1
INSERT INTO temp VALUES('3', NULL);
CALL sp3();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 0
INSERT INTO temp VALUES('4', NULL);
CALL sp4();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 0
@@ -885,18 +911,26 @@ SELECT @done, @x;
@done @x
0 1
CALL sp1();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 2
CALL sp2();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 2
CALL sp3();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 1
CALL sp4();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 1
@@ -1031,6 +1065,8 @@ SQLSTATE
21000
SQLSTATE
24000
+Warnings:
+Error 1326 Cursor is not open
SELECT '-1-', @x;
-1- @x
-1- 6
@@ -1041,18 +1077,24 @@ SQLSTATE
SQLEXCEPTION
SQLSTATE
24000
+Warnings:
+Error 1326 Cursor is not open
SELECT '-2-', @x;
-2- @x
-2- 6
CALL sp3();
SQLSTATE
20000
+Warnings:
+Error 1339 Case not found for CASE statement
SELECT '-3-', @x;
-3- @x
-3- 1
CALL sp4();
SQLSTATE
SQLEXCEPTION
+Warnings:
+Error 1339 Case not found for CASE statement
SELECT '-4-', @x;
-4- @x
-4- 1
@@ -1335,6 +1377,8 @@ CLOSE cur1;
CLOSE cur2;
END//
CALL sp_outer();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT * FROM temp1;
f0 cnt f1 f2 f3 f4
_sp_out_ 1 a` a` 1000-01-01 -5000
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
index 67d9c76ccac..ee1548fe012 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
@@ -78,7 +78,6 @@ grant all on db_storedproc_1.* to 'user_1'@'localhost';
revoke create routine on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS sp1;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -91,7 +90,6 @@ USE db_storedproc_1;
root@localhost db_storedproc_1
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -112,7 +110,6 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
DROP PROCEDURE IF EXISTS sp3;
@@ -149,7 +146,6 @@ CREATE PROCEDURE sp4(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -191,7 +187,6 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
flush privileges;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp5_s_i () sql security definer
@@ -207,7 +202,6 @@ CREATE PROCEDURE sp5_ins () sql security definer
BEGIN
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_ins', 1000);
END//
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -305,7 +299,6 @@ GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3166_s_i () SQL SECURITY INVOKER
@@ -321,7 +314,6 @@ CREATE PROCEDURE sp3166_ins () SQL SECURITY INVOKER
BEGIN
insert into db_storedproc_1.t3166 values ('inserted from sp3166_ins');
END//
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -340,7 +332,6 @@ c1
inserted outside SP
GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -361,7 +352,6 @@ inserted from sp3166_s_i
inserted from sp3166_ins
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -379,7 +369,6 @@ inserted from sp3166_ins
root@localhost db_storedproc_1
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result
index a084630a305..d731979a095 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result
@@ -81,7 +81,6 @@ create user 'user_2'@'localhost';
GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_1,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc
CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER
@@ -94,7 +93,6 @@ DECLARE res INT;
SET res = n * n;
RETURN res;
END//
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
@@ -113,7 +111,6 @@ fn31105( 9 )
81
GRANT EXECUTE ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
@@ -134,7 +131,6 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03.result b/mysql-test/suite/funcs_1/r/innodb_trig_03.result
index 012977ae4a3..db92ea56444 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result
@@ -85,8 +85,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.3.2:
-----------------
@@ -161,8 +159,6 @@ grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_noprivs@localhost
@@ -222,8 +218,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -296,8 +290,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -351,8 +343,6 @@ grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs;
Grants for test_noprivs@%
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -407,8 +397,6 @@ grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_noprivs@localhost
@@ -464,8 +452,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -519,8 +505,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -565,8 +549,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -611,7 +593,6 @@ Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
index bc3f7daf5bc..c963be41a35 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
@@ -24,7 +24,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT ON `priv_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
no trigger privilege on db level for create:
--------------------------------------------
@@ -32,7 +31,6 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv_db;
insert into t1 (f1) values ('insert-yes');
select f1 from t1 order by f1;
@@ -253,8 +251,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
create User test_noprivs@localhost;
set password for test_noprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
no trigger privilege on table level for create:
-----------------------------------------------
@@ -513,8 +509,6 @@ grant SELECT,INSERT on *.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT SELECT, INSERT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -563,7 +557,6 @@ revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -698,7 +691,6 @@ select f1 from t1 order by f1;
f1
insert-yes
insert-yes
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -767,9 +759,7 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO 'test_noprivs'@'localhost'
GRANT SELECT, INSERT ON `priv2_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv1_db;
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv1_db;
trigger privilege on one db1 db level, not on db2
@@ -982,7 +972,6 @@ create User test_useprivs@localhost;
set password for test_useprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1010,7 +999,6 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')';
-connect(localhost,test_useprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_useprivs@localhost
@@ -1206,7 +1194,6 @@ create table t1 (f1 char(20)) engine= innodb;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1303,7 +1290,6 @@ create table t1 (f1 char(20)) engine= innodb;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1375,8 +1361,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
update only on column:
----------------------
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
index 33e58f50ec1..8597f252e54 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
@@ -67,8 +67,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
-connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.4:
---------------
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
index 6ced07cef73..b2b38694680 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
@@ -67,8 +67,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
-connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.8.1: (implied in previous tests)
---------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_02.result b/mysql-test/suite/funcs_1/r/memory_storedproc_02.result
index 16dde71400e..f18678e3896 100644
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_02.result
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_02.result
@@ -348,6 +348,8 @@ CALL h1();
-7- 1 1 1 1 1 1
END x1 x2 x3 x4 x5 x6
END 1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
DROP TABLE IF EXISTS tnull;
DROP PROCEDURE IF EXISTS sp1;
CREATE TABLE tnull(f1 int);
@@ -446,6 +448,8 @@ END//
CALL h2();
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
SELECT * FROM res_t1;
w x
a b
@@ -551,6 +555,8 @@ exit handler 2
exit handler 2
exit handler 1
exit handler 1
+Warnings:
+Error 1146 Table 'db_storedproc.tqq' doesn't exist
create table res_t1(w char unique, x char);
insert into res_t1 values ('a', 'b');
CREATE PROCEDURE h1 ()
@@ -581,6 +587,8 @@ END//
CALL h1();
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
This will fail, SQLSTATE 00000 is not allowed
CREATE PROCEDURE sp1()
begin1_label:BEGIN
@@ -624,6 +632,8 @@ CALL sp2();
NULL
@x2 @x
1 2
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
@@ -655,6 +665,8 @@ ERROR 42000: Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expe
CALL sp2();
-1- @x2 @x
-1- 0 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
SELECT '-3-', @x2, @x;
-3- @x2 @x
-3- 1 1
@@ -697,6 +709,8 @@ CALL sp2();
-2- 1 20
-4- @x2 @x
-4- 11 22
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
@@ -763,21 +777,33 @@ SELECT @done, @x;
0 1
INSERT INTO temp VALUES('1', NULL);
CALL sp1();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 1
INSERT INTO temp VALUES('2', NULL);
CALL sp2();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 1
INSERT INTO temp VALUES('3', NULL);
CALL sp3();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 0
INSERT INTO temp VALUES('4', NULL);
CALL sp4();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 0
@@ -886,18 +912,26 @@ SELECT @done, @x;
@done @x
0 1
CALL sp1();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 2
CALL sp2();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 2
CALL sp3();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 1
CALL sp4();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 1
@@ -1032,6 +1066,8 @@ SQLSTATE
21000
SQLSTATE
24000
+Warnings:
+Error 1326 Cursor is not open
SELECT '-1-', @x;
-1- @x
-1- 6
@@ -1042,18 +1078,24 @@ SQLSTATE
SQLEXCEPTION
SQLSTATE
24000
+Warnings:
+Error 1326 Cursor is not open
SELECT '-2-', @x;
-2- @x
-2- 6
CALL sp3();
SQLSTATE
20000
+Warnings:
+Error 1339 Case not found for CASE statement
SELECT '-3-', @x;
-3- @x
-3- 1
CALL sp4();
SQLSTATE
SQLEXCEPTION
+Warnings:
+Error 1339 Case not found for CASE statement
SELECT '-4-', @x;
-4- @x
-4- 1
@@ -1336,6 +1378,8 @@ CLOSE cur1;
CLOSE cur2;
END//
CALL sp_outer();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT * FROM temp1;
f0 cnt f1 f2 f3 f4
_sp_out_ 1 a` a` 1000-01-01 -5000
diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
index eb617c68ae9..096cbd1261e 100644
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
@@ -79,7 +79,6 @@ grant all on db_storedproc_1.* to 'user_1'@'localhost';
revoke create routine on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS sp1;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -92,7 +91,6 @@ USE db_storedproc_1;
root@localhost db_storedproc_1
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -113,7 +111,6 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
DROP PROCEDURE IF EXISTS sp3;
@@ -150,7 +147,6 @@ CREATE PROCEDURE sp4(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -192,7 +188,6 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
flush privileges;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp5_s_i () sql security definer
@@ -208,7 +203,6 @@ CREATE PROCEDURE sp5_ins () sql security definer
BEGIN
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_ins', 1000);
END//
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -306,7 +300,6 @@ GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3166_s_i () SQL SECURITY INVOKER
@@ -322,7 +315,6 @@ CREATE PROCEDURE sp3166_ins () SQL SECURITY INVOKER
BEGIN
insert into db_storedproc_1.t3166 values ('inserted from sp3166_ins');
END//
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -341,7 +333,6 @@ c1
inserted outside SP
GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -362,7 +353,6 @@ inserted from sp3166_s_i
inserted from sp3166_ins
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -380,7 +370,6 @@ inserted from sp3166_ins
root@localhost db_storedproc_1
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result
index b03f7445fb4..ca0aff9abbd 100644
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result
@@ -82,7 +82,6 @@ create user 'user_2'@'localhost';
GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_1,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc
CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER
@@ -95,7 +94,6 @@ DECLARE res INT;
SET res = n * n;
RETURN res;
END//
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
@@ -114,7 +112,6 @@ fn31105( 9 )
81
GRANT EXECUTE ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
@@ -135,7 +132,6 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03.result b/mysql-test/suite/funcs_1/r/memory_trig_03.result
index 65bc7deef8c..31de6d2759e 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03.result
@@ -86,8 +86,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.3.2:
-----------------
@@ -162,8 +160,6 @@ grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_noprivs@localhost
@@ -223,8 +219,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -297,8 +291,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -352,8 +344,6 @@ grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs;
Grants for test_noprivs@%
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -408,8 +398,6 @@ grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_noprivs@localhost
@@ -465,8 +453,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -520,8 +506,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -566,8 +550,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -612,7 +594,6 @@ Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result
index cfbee5f27b7..0b04e72c4b1 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result
@@ -25,7 +25,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT ON `priv_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
no trigger privilege on db level for create:
--------------------------------------------
@@ -33,7 +32,6 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv_db;
insert into t1 (f1) values ('insert-yes');
select f1 from t1 order by f1;
@@ -254,8 +252,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
create User test_noprivs@localhost;
set password for test_noprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
no trigger privilege on table level for create:
-----------------------------------------------
@@ -514,8 +510,6 @@ grant SELECT,INSERT on *.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT SELECT, INSERT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -564,7 +558,6 @@ revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -699,7 +692,6 @@ select f1 from t1 order by f1;
f1
insert-yes
insert-yes
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -768,9 +760,7 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO 'test_noprivs'@'localhost'
GRANT SELECT, INSERT ON `priv2_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv1_db;
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv1_db;
trigger privilege on one db1 db level, not on db2
@@ -983,7 +973,6 @@ create User test_useprivs@localhost;
set password for test_useprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1011,7 +1000,6 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')';
-connect(localhost,test_useprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_useprivs@localhost
@@ -1207,7 +1195,6 @@ create table t1 (f1 char(20)) engine= memory;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1319,8 +1306,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
update only on column:
----------------------
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0407.result b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
index 2f76f5544b9..b8d15b5403b 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
@@ -68,8 +68,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
-connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.4:
---------------
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result
index ab570072087..03505af95c5 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result
@@ -68,8 +68,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
-connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.8.1: (implied in previous tests)
---------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result
index 16dde71400e..f18678e3896 100644
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result
@@ -348,6 +348,8 @@ CALL h1();
-7- 1 1 1 1 1 1
END x1 x2 x3 x4 x5 x6
END 1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
DROP TABLE IF EXISTS tnull;
DROP PROCEDURE IF EXISTS sp1;
CREATE TABLE tnull(f1 int);
@@ -446,6 +448,8 @@ END//
CALL h2();
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
SELECT * FROM res_t1;
w x
a b
@@ -551,6 +555,8 @@ exit handler 2
exit handler 2
exit handler 1
exit handler 1
+Warnings:
+Error 1146 Table 'db_storedproc.tqq' doesn't exist
create table res_t1(w char unique, x char);
insert into res_t1 values ('a', 'b');
CREATE PROCEDURE h1 ()
@@ -581,6 +587,8 @@ END//
CALL h1();
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
+Warnings:
+Error 1062 Duplicate entry 'a' for key 'w'
This will fail, SQLSTATE 00000 is not allowed
CREATE PROCEDURE sp1()
begin1_label:BEGIN
@@ -624,6 +632,8 @@ CALL sp2();
NULL
@x2 @x
1 2
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
@@ -655,6 +665,8 @@ ERROR 42000: Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expe
CALL sp2();
-1- @x2 @x
-1- 0 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
SELECT '-3-', @x2, @x;
-3- @x2 @x
-3- 1 1
@@ -697,6 +709,8 @@ CALL sp2();
-2- 1 20
-4- @x2 @x
-4- 11 22
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
@@ -763,21 +777,33 @@ SELECT @done, @x;
0 1
INSERT INTO temp VALUES('1', NULL);
CALL sp1();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 1
INSERT INTO temp VALUES('2', NULL);
CALL sp2();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 1
INSERT INTO temp VALUES('3', NULL);
CALL sp3();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 0
INSERT INTO temp VALUES('4', NULL);
CALL sp4();
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f2' at row 1
SELECT @done, @x;
@done @x
1 0
@@ -886,18 +912,26 @@ SELECT @done, @x;
@done @x
0 1
CALL sp1();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 2
CALL sp2();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 2
CALL sp3();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 1
CALL sp4();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT @done, @x;
@done @x
1 1
@@ -1032,6 +1066,8 @@ SQLSTATE
21000
SQLSTATE
24000
+Warnings:
+Error 1326 Cursor is not open
SELECT '-1-', @x;
-1- @x
-1- 6
@@ -1042,18 +1078,24 @@ SQLSTATE
SQLEXCEPTION
SQLSTATE
24000
+Warnings:
+Error 1326 Cursor is not open
SELECT '-2-', @x;
-2- @x
-2- 6
CALL sp3();
SQLSTATE
20000
+Warnings:
+Error 1339 Case not found for CASE statement
SELECT '-3-', @x;
-3- @x
-3- 1
CALL sp4();
SQLSTATE
SQLEXCEPTION
+Warnings:
+Error 1339 Case not found for CASE statement
SELECT '-4-', @x;
-4- @x
-4- 1
@@ -1336,6 +1378,8 @@ CLOSE cur1;
CLOSE cur2;
END//
CALL sp_outer();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT * FROM temp1;
f0 cnt f1 f2 f3 f4
_sp_out_ 1 a` a` 1000-01-01 -5000
diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
index eb617c68ae9..096cbd1261e 100644
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
@@ -79,7 +79,6 @@ grant all on db_storedproc_1.* to 'user_1'@'localhost';
revoke create routine on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS sp1;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -92,7 +91,6 @@ USE db_storedproc_1;
root@localhost db_storedproc_1
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -113,7 +111,6 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
DROP PROCEDURE IF EXISTS sp3;
@@ -150,7 +147,6 @@ CREATE PROCEDURE sp4(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -192,7 +188,6 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
flush privileges;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp5_s_i () sql security definer
@@ -208,7 +203,6 @@ CREATE PROCEDURE sp5_ins () sql security definer
BEGIN
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_ins', 1000);
END//
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -306,7 +300,6 @@ GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3166_s_i () SQL SECURITY INVOKER
@@ -322,7 +315,6 @@ CREATE PROCEDURE sp3166_ins () SQL SECURITY INVOKER
BEGIN
insert into db_storedproc_1.t3166 values ('inserted from sp3166_ins');
END//
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -341,7 +333,6 @@ c1
inserted outside SP
GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -362,7 +353,6 @@ inserted from sp3166_s_i
inserted from sp3166_ins
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -380,7 +370,6 @@ inserted from sp3166_ins
root@localhost db_storedproc_1
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result
index b03f7445fb4..ca0aff9abbd 100644
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result
@@ -82,7 +82,6 @@ create user 'user_2'@'localhost';
GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_1,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc
CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER
@@ -95,7 +94,6 @@ DECLARE res INT;
SET res = n * n;
RETURN res;
END//
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
@@ -114,7 +112,6 @@ fn31105( 9 )
81
GRANT EXECUTE ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
@@ -135,7 +132,6 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03.result b/mysql-test/suite/funcs_1/r/myisam_trig_03.result
index 65bc7deef8c..31de6d2759e 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03.result
@@ -86,8 +86,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.3.2:
-----------------
@@ -162,8 +160,6 @@ grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_noprivs@localhost
@@ -223,8 +219,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -297,8 +291,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -352,8 +344,6 @@ grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs;
Grants for test_noprivs@%
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -408,8 +398,6 @@ grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_noprivs@localhost
@@ -465,8 +453,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -520,8 +506,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -566,8 +550,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -612,7 +594,6 @@ Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
index d21bd176810..dd8b0063339 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
@@ -25,7 +25,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT ON `priv_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
no trigger privilege on db level for create:
--------------------------------------------
@@ -33,7 +32,6 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv_db;
insert into t1 (f1) values ('insert-yes');
select f1 from t1 order by f1;
@@ -254,8 +252,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
create User test_noprivs@localhost;
set password for test_noprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
no trigger privilege on table level for create:
-----------------------------------------------
@@ -514,8 +510,6 @@ grant SELECT,INSERT on *.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT SELECT, INSERT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -564,7 +558,6 @@ revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -699,7 +692,6 @@ select f1 from t1 order by f1;
f1
insert-yes
insert-yes
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -768,9 +760,7 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO 'test_noprivs'@'localhost'
GRANT SELECT, INSERT ON `priv2_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv1_db;
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv1_db;
trigger privilege on one db1 db level, not on db2
@@ -983,7 +973,6 @@ create User test_useprivs@localhost;
set password for test_useprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1011,7 +1000,6 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')';
-connect(localhost,test_useprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_useprivs@localhost
@@ -1207,7 +1195,6 @@ create table t1 (f1 char(20)) engine= myisam;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1319,8 +1306,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
update only on column:
----------------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
index 2f76f5544b9..b8d15b5403b 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
@@ -68,8 +68,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
-connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.4:
---------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
index ab570072087..03505af95c5 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
@@ -68,8 +68,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
-connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.8.1: (implied in previous tests)
---------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/ndb_storedproc_06.result b/mysql-test/suite/funcs_1/r/ndb_storedproc_06.result
index 67d9c76ccac..ee1548fe012 100644
--- a/mysql-test/suite/funcs_1/r/ndb_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/ndb_storedproc_06.result
@@ -78,7 +78,6 @@ grant all on db_storedproc_1.* to 'user_1'@'localhost';
revoke create routine on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS sp1;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -91,7 +90,6 @@ USE db_storedproc_1;
root@localhost db_storedproc_1
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -112,7 +110,6 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
DROP PROCEDURE IF EXISTS sp3;
@@ -149,7 +146,6 @@ CREATE PROCEDURE sp4(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -191,7 +187,6 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
flush privileges;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp5_s_i () sql security definer
@@ -207,7 +202,6 @@ CREATE PROCEDURE sp5_ins () sql security definer
BEGIN
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_ins', 1000);
END//
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -305,7 +299,6 @@ GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_1,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3166_s_i () SQL SECURITY INVOKER
@@ -321,7 +314,6 @@ CREATE PROCEDURE sp3166_ins () SQL SECURITY INVOKER
BEGIN
insert into db_storedproc_1.t3166 values ('inserted from sp3166_ins');
END//
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -340,7 +332,6 @@ c1
inserted outside SP
GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -361,7 +352,6 @@ inserted from sp3166_s_i
inserted from sp3166_ins
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -379,7 +369,6 @@ inserted from sp3166_ins
root@localhost db_storedproc_1
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc_1,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
diff --git a/mysql-test/suite/funcs_1/r/ndb_storedproc_10.result b/mysql-test/suite/funcs_1/r/ndb_storedproc_10.result
index a084630a305..d731979a095 100644
--- a/mysql-test/suite/funcs_1/r/ndb_storedproc_10.result
+++ b/mysql-test/suite/funcs_1/r/ndb_storedproc_10.result
@@ -81,7 +81,6 @@ create user 'user_2'@'localhost';
GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_1,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc
CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER
@@ -94,7 +93,6 @@ DECLARE res INT;
SET res = n * n;
RETURN res;
END//
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
@@ -113,7 +111,6 @@ fn31105( 9 )
81
GRANT EXECUTE ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
@@ -134,7 +131,6 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
-connect(localhost,user_2,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_2@localhost db_storedproc
CALL sp31102();
diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_03.result b/mysql-test/suite/funcs_1/r/ndb_trig_03.result
index 012977ae4a3..db92ea56444 100644
--- a/mysql-test/suite/funcs_1/r/ndb_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/ndb_trig_03.result
@@ -85,8 +85,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.3.2:
-----------------
@@ -161,8 +159,6 @@ grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_noprivs@localhost
@@ -222,8 +218,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -296,8 +290,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -351,8 +343,6 @@ grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs;
Grants for test_noprivs@%
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -407,8 +397,6 @@ grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_noprivs@localhost
@@ -464,8 +452,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -519,8 +505,6 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -565,8 +549,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -611,7 +593,6 @@ Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result
index eea8df9a1fd..91bd22d3c06 100644
--- a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result
@@ -24,7 +24,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT ON `priv_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
no trigger privilege on db level for create:
--------------------------------------------
@@ -32,7 +31,6 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv_db;
insert into t1 (f1) values ('insert-yes');
select f1 from t1 order by f1;
@@ -253,8 +251,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
create User test_noprivs@localhost;
set password for test_noprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
no trigger privilege on table level for create:
-----------------------------------------------
@@ -513,8 +509,6 @@ grant SELECT,INSERT on *.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT SELECT, INSERT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -563,7 +557,6 @@ revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -698,7 +691,6 @@ select f1 from t1 order by f1;
f1
insert-yes
insert-yes
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_yesprivs@localhost
@@ -767,9 +759,7 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO 'test_noprivs'@'localhost'
GRANT SELECT, INSERT ON `priv2_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv1_db;
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
use priv1_db;
trigger privilege on one db1 db level, not on db2
@@ -982,7 +972,6 @@ create User test_useprivs@localhost;
set password for test_useprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1010,7 +999,6 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')';
-connect(localhost,test_useprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
test_useprivs@localhost
@@ -1206,7 +1194,6 @@ create table t1 (f1 char(20)) engine= ndb;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1303,7 +1290,6 @@ create table t1 (f1 char(20)) engine= ndb;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
select current_user;
current_user
root@localhost
@@ -1375,8 +1361,6 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_noprivs'@'localhost'
-connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_noprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
update only on column:
----------------------
diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_0407.result b/mysql-test/suite/funcs_1/r/ndb_trig_0407.result
index 33e58f50ec1..8597f252e54 100644
--- a/mysql-test/suite/funcs_1/r/ndb_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/ndb_trig_0407.result
@@ -67,8 +67,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
-connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.4:
---------------
diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_08.result b/mysql-test/suite/funcs_1/r/ndb_trig_08.result
index 6ced07cef73..b2b38694680 100644
--- a/mysql-test/suite/funcs_1/r/ndb_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/ndb_trig_08.result
@@ -67,8 +67,6 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
-connect(localhost,test_general,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
-connect(localhost,test_super,PWD,test,MASTER_MYPORT,MASTER_MYSOCK);
Testcase 3.5.8.1: (implied in previous tests)
---------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 082da9938f7..6b13666cd2f 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -1831,7 +1831,6 @@ CREATE PROCEDURE sp11() insert into mysql.t1 values('a');
SELECT security_type from mysql.proc where specific_name='sp11';
security_type
DEFINER
-connect(localhost,user_1,,db_storedproc,MYSQL_PORT,MYSQL_SOCK);
user_1@localhost db_storedproc
CALL sp11();
@@ -9325,6 +9324,8 @@ insert into t2 values (1);
set @x = 3;
END//
CALL sp1();
+Warnings:
+Error 1136 Column count doesn't match value count at row 1
DROP PROCEDURE sp1;
DROP PROCEDURE IF EXISTS sp1;
Warnings:
@@ -13754,6 +13755,8 @@ END//
CALL sp1();
x y @x
NULL a 3
+Warnings:
+Error 1305 PROCEDURE db_storedproc.nonsexist does not exist
SELECT @v1, @v2;
@v1 @v2
4 a
@@ -14938,6 +14941,8 @@ NULL NULL
NULL NULL
@x @y
NULL NULL
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DROP PROCEDURE sp1;
Testcase 4.2.63:
@@ -15097,6 +15102,8 @@ END;
fetch cur1 into newf1, newf2, newf4, newf3;
END//
CALL sp1();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DROP PROCEDURE sp1;
Testcase 4.2.70:
@@ -22447,6 +22454,8 @@ END//
CALL h1 ();
@x @x2
1 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE h1;
DROP PROCEDURE sp1;
@@ -22464,6 +22473,8 @@ END//
CALL h1 ();
@x @x2
1 1
+Warnings:
+Error 1305 PROCEDURE db_storedproc.sp1 does not exist
DROP PROCEDURE h1;
Testcase 4.11.3:
@@ -22483,6 +22494,8 @@ CALL sp1 (1);
set @x=0;
END//
CALL h1();
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
SELECT @x, @x2;
@x @x2
1 1
@@ -22501,6 +22514,8 @@ CALL sp1 (1);
set @x=0;
END//
CALL h1 ();
+Warnings:
+Error 1305 PROCEDURE db_storedproc.sp1 does not exist
SELECT @x, @x2;
@x @x2
1 1
@@ -22525,6 +22540,8 @@ END//
CALL h1 ();
@x @x2
1 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE h1;
DROP PROCEDURE sp1;
@@ -22547,6 +22564,8 @@ END//
CALL h1 ();
@x @x2
1 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE h1;
DROP PROCEDURE sp1;
@@ -22569,6 +22588,8 @@ END//
CALL h1 ();
@x @x2
1 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE h1;
DROP PROCEDURE sp1;
@@ -22586,6 +22607,8 @@ END//
CALL h1 ();
@x @x2
1 1
+Warnings:
+Error 1305 PROCEDURE db_storedproc.sp1 does not exist
DROP PROCEDURE h1;
Testcase 4.11.9:
@@ -22605,6 +22628,8 @@ CALL sp1 (1);
set @x=0;
END//
CALL h1();
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
SELECT @x, @x2;
@x @x2
1 1
@@ -22623,6 +22648,8 @@ CALL sp1 (1);
set @x=0;
END//
CALL h1 ();
+Warnings:
+Error 1305 PROCEDURE db_storedproc.sp1 does not exist
SELECT @x, @x2;
@x @x2
1 1
@@ -22647,6 +22674,8 @@ END//
CALL h1 ();
@x @x2
1 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE h1;
DROP PROCEDURE sp1;
@@ -22669,6 +22698,8 @@ END//
CALL h1 ();
@x @x2
1 1
+Warnings:
+Error 1318 Incorrect number of arguments for PROCEDURE db_storedproc.sp1; expected 2, got 1
DROP PROCEDURE h1;
DROP PROCEDURE sp1;
@@ -22704,6 +22735,8 @@ done
1
done
1
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -22777,6 +22810,8 @@ done
0
done
1
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -22814,6 +22849,8 @@ done
0
done
1
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -22844,6 +22881,8 @@ done
0
done
1
+Warnings:
+Error 1328 Incorrect number of FETCH variables
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -22874,6 +22913,8 @@ done
0
done
1
+Warnings:
+Error 1328 Incorrect number of FETCH variables
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -22904,6 +22945,8 @@ END//
CALL h1();
done
0
+Warnings:
+Error 1328 Incorrect number of FETCH variables
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -22934,6 +22977,8 @@ END//
CALL h1();
done
0
+Warnings:
+Error 1328 Incorrect number of FETCH variables
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -22964,6 +23009,8 @@ done
0
done
1
+Warnings:
+Error 1325 Cursor is already open
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -22995,6 +23042,8 @@ done
0
done @x
1 1
+Warnings:
+Error 1325 Cursor is already open
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -23025,6 +23074,8 @@ END//
CALL h1();
done
0
+Warnings:
+Error 1325 Cursor is already open
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -23055,6 +23106,8 @@ END//
CALL h1();
done
0
+Warnings:
+Error 1325 Cursor is already open
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -23082,6 +23135,8 @@ END//
CALL h1();
done @x
1 1
+Warnings:
+Error 1326 Cursor is not open
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -23109,6 +23164,8 @@ END//
CALL h1();
done @x
1 1
+Warnings:
+Error 1326 Cursor is not open
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -23134,6 +23191,8 @@ set @x=1;
SELECT done, @x;
END//
CALL h1();
+Warnings:
+Error 1326 Cursor is not open
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -23159,6 +23218,8 @@ set @x=1;
SELECT done, @x;
END//
CALL h1();
+Warnings:
+Error 1326 Cursor is not open
DROP PROCEDURE IF EXISTS h1;
drop table IF EXISTS res_t1;
drop table IF EXISTS res_t2;
@@ -23189,6 +23250,8 @@ END//
CALL h1();
done @x
1 1
+Warnings:
+Error 1339 Case not found for CASE statement
DROP PROCEDURE IF EXISTS h1;
drop table IF EXISTS res_t1;
drop table IF EXISTS res_t2;
@@ -23219,6 +23282,8 @@ END//
CALL h1();
done @x
1 1
+Warnings:
+Error 1339 Case not found for CASE statement
DROP PROCEDURE IF EXISTS h1;
drop table IF EXISTS res_t1;
drop table IF EXISTS res_t2;
@@ -23247,6 +23312,8 @@ set @x=1;
SELECT done, @x;
END//
CALL h1();
+Warnings:
+Error 1339 Case not found for CASE statement
DROP PROCEDURE IF EXISTS h1;
drop table IF EXISTS res_t1;
drop table IF EXISTS res_t2;
@@ -23275,6 +23342,8 @@ set @x=1;
SELECT done, @x;
END//
CALL h1();
+Warnings:
+Error 1339 Case not found for CASE statement
DROP PROCEDURE IF EXISTS h1;
DROP TABLE IF EXISTS res_t1;
DROP TABLE IF EXISTS res_t2;
@@ -23423,6 +23492,9 @@ CREATE TABLE res_t1(w CHAR, x CHAR);
INSERT INTO res_t1 VALUES('a', 'b');
INSERT INTO res_t1 VALUES('c', 'd');
CALL h1();
+Warnings:
+Warning 1265 Data truncated for column 'w' at row 1
+Warning 1265 Data truncated for column 'x' at row 1
SELECT @done, @x;
@done @x
1 1
@@ -23445,6 +23517,9 @@ CREATE TABLE res_t1(w CHAR, x CHAR);
INSERT INTO res_t1 VALUES('a', 'b');
INSERT INTO res_t1 VALUES('c', 'd');
CALL h1();
+Warnings:
+Warning 1265 Data truncated for column 'w' at row 1
+Warning 1265 Data truncated for column 'x' at row 1
SELECT @done, @x;
@done @x
1 1
diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
index f2df99fb5a3..4ecca63351d 100644
--- a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
+++ b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc
@@ -53,7 +53,6 @@ flush privileges;
DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user1a, localhost, user_1, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
@@ -75,7 +74,6 @@ USE db_storedproc_1;
--source suite/funcs_1/include/show_connection.inc
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user1b, localhost, user_1, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
@@ -120,7 +118,6 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
# disconnect default;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user2, localhost, user_1, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
@@ -187,7 +184,6 @@ delimiter ;//
#disconnect default;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user3, localhost, user_1, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
@@ -234,7 +230,6 @@ grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
flush privileges;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user5_1, localhost, user_1, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
@@ -258,7 +253,6 @@ delimiter ;//
disconnect user5_1;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user5_2, localhost, user_2, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
@@ -365,7 +359,6 @@ GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user6_1, localhost, user_1, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
@@ -389,7 +382,6 @@ delimiter ;//
disconnect user6_1;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user6_2, localhost, user_2, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
@@ -407,7 +399,6 @@ GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
disconnect user6_2;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user6_3, localhost, user_2, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
CALL sp3166_s_i();
@@ -422,7 +413,6 @@ CALL sp3166_sel();
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user6_4, localhost, user_2, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
--error ER_TABLEACCESS_DENIED_ERROR
@@ -439,7 +429,6 @@ CALL sp3166_s_i();
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user6_5, localhost, user_2, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
--error ER_PROCACCESS_DENIED_ERROR
diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc
index 83f5f2105c5..8382bcc1e55 100644
--- a/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc
+++ b/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc
@@ -58,7 +58,6 @@ GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user2_1, localhost, user_1, , db_storedproc);
--source suite/funcs_1/include/show_connection.inc
@@ -80,7 +79,6 @@ delimiter ;//
disconnect user2_1;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user2_2, localhost, user_2, , db_storedproc);
--source suite/funcs_1/include/show_connection.inc
@@ -102,7 +100,6 @@ FLUSH PRIVILEGES;
disconnect user2_2;
# new connection
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user2_3, localhost, user_2, , db_storedproc);
--source suite/funcs_1/include/show_connection.inc
CALL sp31102();
@@ -121,7 +118,6 @@ FLUSH PRIVILEGES;
CALL sp31102();
SELECT fn31105( 9 );
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (user2_4, localhost, user_2, , db_storedproc);
--source suite/funcs_1/include/show_connection.inc
CALL sp31102();
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03.inc b/mysql-test/suite/funcs_1/triggers/triggers_03.inc
index 9ef6a9ac9af..f48d1979f77 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03.inc
@@ -62,9 +62,7 @@ let $message= Testcase 3.5.3.2/6:;
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -155,9 +153,7 @@ let $message=Testcase 3.5.3.7a:;
grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs_424a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs_424a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection no_privs_424a;
@@ -209,9 +205,7 @@ let $message= Testcase 3.5.3.7b:;
grant UPDATE on priv_db.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -263,9 +257,7 @@ let $message= Testcase 3.5.3.7c;
grant UPDATE on priv_db.t1 to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs_424c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs_424c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -316,9 +308,7 @@ let $message= Testcase 3.5.3.7d:;
grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs_424d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs_424d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -369,9 +359,7 @@ let $message= Testcase 3.5.3.8a:;
grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs_425a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs_425a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -426,9 +414,7 @@ let $message= Testcase: 3.5.3.8b;
grant SELECT on priv_db.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs_425b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs_425b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -482,9 +468,7 @@ let $message= Testcase 3.5.3.8c:;
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs_425c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs_425c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -534,9 +518,7 @@ let $message=Testcase: 3.5.3.8d:;
grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs_425d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs_425d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -592,7 +574,6 @@ let $message=Testcase: 3.5.3.x:;
grant SELECT on priv_db.t2 to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_353x,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection yes_353x;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc
index 475063587d4..2f0ad2c1ccc 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc
@@ -36,10 +36,8 @@ let $message= ####### Testcase for column privileges of triggers: #######;
grant SELECT,UPDATE on priv_db.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
# grant TRIGGER and UPDATE on column -> succeed
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
index e5933eb84a8..9e6d8598e6f 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
@@ -37,7 +37,6 @@ let $message= Testcase for db level:;
show grants for test_noprivs@localhost;
# no trigger privilege->create trigger must fail:
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
let $message= no trigger privilege on db level for create:;
--source include/show_msg.inc
@@ -47,7 +46,6 @@ let $message= no trigger privilege on db level for create:;
set new.f1 = 'trig 1_1-no';
# user with minimum privs on t1->no trigger executed;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
use priv_db;
insert into t1 (f1) values ('insert-yes');
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc
index 82f4a28f664..2bbcc5f88f0 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc
@@ -41,10 +41,8 @@ let $message= ####### Testcase for mix of db and table level: #######;
grant SELECT,INSERT on priv2_db.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
use priv1_db;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
use priv1_db;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc
index f1efff990f1..9988e1cafc2 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc
@@ -27,7 +27,6 @@ let $message= ######### Testcase for definer: ########;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
# create trigger with not existing definer shall deliver a warning:
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_global_db_mix.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_global_db_mix.inc
index b6f4af7e0a7..eebdff5b588 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_global_db_mix.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_global_db_mix.inc
@@ -38,10 +38,8 @@ let $message= #### Testcase for mix of user(global) and db level: ####;
grant SELECT,INSERT on *.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection yes_privs;
@@ -83,7 +81,6 @@ let $message= trigger privilege on user level for create:;
--disable_warnings
disconnect yes_privs;
--enable_warnings
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
select current_user;
use priv_db;
@@ -184,7 +181,6 @@ let $message= trigger privilege on db level for create:;
--disable_warnings
disconnect yes_privs;
--enable_warnings
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
select current_user;
use no_priv_db;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc
index ea7c385768c..6258b040642 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc
@@ -32,7 +32,6 @@ let $message= #### Testcase for trigger privilege on execution time ########;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
@@ -56,7 +55,6 @@ let $message= #### Testcase for trigger privilege on execution time ########;
select f1 from t1 order by f1;
prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')';
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (use_privs,localhost,test_useprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
select current_user;
use priv_db;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc
index 94f30fe13c2..ca4b9e2a0a9 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc
@@ -30,10 +30,8 @@ let $message= ######### Testcase for table level: ########;
set password for test_noprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
################ Section 3.5.3 ############
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc
index e43f4ce97a3..2f72ba64bfd 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc
@@ -27,7 +27,6 @@ let $message= ######### Testcase for transactions: ########;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_0407.inc b/mysql-test/suite/funcs_1/triggers/triggers_0407.inc
index d68b3d79086..2bc9dd66478 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_0407.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_0407.inc
@@ -22,9 +22,7 @@ let $message= Testcase: 3.5:;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (con1_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (con1_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_08.inc b/mysql-test/suite/funcs_1/triggers/triggers_08.inc
index 087f18e8e6b..996a5aa69ae 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc
@@ -23,9 +23,7 @@ let $message= Testcase: 3.5:;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (con2_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
- --replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
connect (con2_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection default;
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
index 495d5c014ce..2ff6971444e 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -500,11 +500,7 @@ INSERT INTO t2 VALUES (),();
CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2
WHERE b =(SELECT a FROM t1 LIMIT 1);
---disable_query_log
---disable_result_log
CONNECT (con1, localhost, root,,);
---enable_query_log
---enable_result_log
CONNECTION default;
DELIMITER |;
diff --git a/mysql-test/suite/ndb/r/ndb_cursor.result b/mysql-test/suite/ndb/r/ndb_cursor.result
index b3b815ef891..3e6f207e153 100644
--- a/mysql-test/suite/ndb/r/ndb_cursor.result
+++ b/mysql-test/suite/ndb/r/ndb_cursor.result
@@ -29,6 +29,8 @@ end;
select * from t2 order by a;
a b
call test_cursor();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
select * from t2 order by a;
a b
1 10
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/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/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..a6db0d39925 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,47 @@
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" 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/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_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 2d0d82ef19c..31d12598357 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 1138: 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 1118: 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 1138: 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 1118: 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 1138: 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 1118: 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 1138: 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 1118: 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 1138: 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 1118: 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 70205c7f104..8c35425029e 100644
--- a/mysql-test/suite/perfschema/r/server_init.result
+++ b/mysql-test/suite/perfschema/r/server_init.result
@@ -40,18 +40,10 @@ where name like "wait/synch/cond/mysys/THR_COND_threads";
count(name)
1
select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOCK_mysql_create_db";
-count(name)
-1
-select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_open";
count(name)
1
select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOCK_lock_db";
-count(name)
-1
-select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_thread_count";
count(name)
1
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..48891adce73 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
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..cb1d64bf1e7 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
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..3856d241d73 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
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..e52f04cbae7 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
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..aab39dfb619 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
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..0665058a469 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
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..721f9957b1e 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
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..63398bce1f5 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
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..006f0fc6002 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
@@ -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..e0377e10583 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
@@ -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..5f72cb4eba1 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
diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result
index 1d9dc731c7b..2639fb8e540 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
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/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/server_init.test b/mysql-test/suite/perfschema/t/server_init.test
index b0bbe7b1bae..2e19d2c843a 100644
--- a/mysql-test/suite/perfschema/t/server_init.test
+++ b/mysql-test/suite/perfschema/t/server_init.test
@@ -69,15 +69,9 @@ select count(name) from COND_INSTANCES
# Verify that these global mutexes have been properly initilized in sql
select count(name) from MUTEX_INSTANCES
- where name like "wait/synch/mutex/sql/LOCK_mysql_create_db";
-
-select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_open";
select count(name) from MUTEX_INSTANCES
- where name like "wait/synch/mutex/sql/LOCK_lock_db";
-
-select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_thread_count";
select count(name) from MUTEX_INSTANCES
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_begin_commit_rollback.result b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
index a65ee7d208e..1ed7e0116a2 100644
--- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
+++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
@@ -72,6 +72,8 @@ before call db1.p1()
INSERT INTO db1.t2 VALUES ('before call db1.p2()');
BEGIN;
CALL db1.p2();
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
ROLLBACK;
INSERT INTO db1.t2 VALUES ('after call db1.p2()');
SELECT * FROM db1.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_conditional_comments.result b/mysql-test/suite/rpl/r/rpl_conditional_comments.result
new file mode 100644
index 00000000000..f3de3e5eb70
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result
@@ -0,0 +1,67 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1(c1 INT);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
+
+# Case 1:
+# ------------------------------------------------------------------
+# In a statement, some CCs are applied while others are not. The CCs
+# which are not applied on master will be binlogged as common comments.
+/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; /* 99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /* 99999 ,(11)*/
+master-bin.000001 # Query # # COMMIT
+Comparing tables master:test.t1 and slave:test.t1
+
+# Case 2:
+# -----------------------------------------------------------------
+# Verify whether it can be binlogged correctly when executing prepared
+# statement.
+PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/';
+EXECUTE stmt;
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT);
+EXECUTE stmt;
+Comparing tables master:test.t1 and slave:test.t1
+
+SET @value=62;
+PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/';
+EXECUTE stmt USING @value;
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT);
+EXECUTE stmt USING @value;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO /* 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`; 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)*/
+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`; 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)*/
+master-bin.000001 # Query # # COMMIT
+Comparing tables master:test.t1 and slave:test.t1
+
+# Case 3:
+# -----------------------------------------------------------------
+# Verify it can restore the '!', if the it is an uncomplete conditional
+# comments
+SELECT c1 FROM /*!99999 t1 WHEREN;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!99999 t1 WHEREN' at line 1
+DROP TABLE t1;
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 7c1ef59d9bd..d716886e5bf 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
@@ -3661,6 +3661,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
SELECT fc_i_nt_5_suc (135, 4);
fc_i_nt_5_suc (135, 4)
fc_i_nt_5_suc
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -3689,6 +3691,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (136, 4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -3781,6 +3785,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
SELECT fc_i_nt_5_suc (139, 4);
fc_i_nt_5_suc (139, 4)
fc_i_nt_5_suc
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -3809,6 +3815,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (140, 4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -3907,6 +3915,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
SELECT fc_i_nt_5_suc (143, 4);
fc_i_nt_5_suc (143, 4)
fc_i_nt_5_suc
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -3937,6 +3947,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (144, 4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4033,6 +4045,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
SELECT fc_i_nt_5_suc (147, 4);
fc_i_nt_5_suc (147, 4)
fc_i_nt_5_suc
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4063,6 +4077,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (148, 4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4295,6 +4311,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
SELECT fc_i_nt_5_suc (155, 4);
fc_i_nt_5_suc (155, 4)
fc_i_nt_5_suc
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4325,6 +4343,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (156, 4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4423,6 +4443,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
SELECT fc_i_nt_5_suc (159, 4);
fc_i_nt_5_suc (159, 4)
fc_i_nt_5_suc
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4453,6 +4475,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (160, 4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4557,6 +4581,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
SELECT fc_i_nt_5_suc (163, 4);
fc_i_nt_5_suc (163, 4)
fc_i_nt_5_suc
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4589,6 +4615,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (164, 4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4691,6 +4719,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
SELECT fc_i_nt_5_suc (167, 4);
fc_i_nt_5_suc (167, 4)
fc_i_nt_5_suc
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4723,6 +4753,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (168, 4);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -5291,6 +5323,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (185, 2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
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_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185), NAME_CONST('in_stmt_id',1))
@@ -5329,6 +5363,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (186, 2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
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_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186), NAME_CONST('in_stmt_id',1))
@@ -5367,6 +5403,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (187, 2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
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_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187), NAME_CONST('in_stmt_id',1))
@@ -5407,6 +5445,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (188, 2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
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_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188), NAME_CONST('in_stmt_id',1))
@@ -5885,6 +5925,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (201, 2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
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_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201), NAME_CONST('in_stmt_id',1))
@@ -5925,6 +5967,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (202, 2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
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_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202), NAME_CONST('in_stmt_id',1))
@@ -5967,6 +6011,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (203, 2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
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_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203), NAME_CONST('in_stmt_id',1))
@@ -6007,6 +6053,8 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
CALL pc_i_nt_5_suc (204, 2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
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_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204), NAME_CONST('in_stmt_id',1))
diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result
index 0a9495751fe..1ec9259a1fb 100644
--- a/mysql-test/suite/rpl/r/rpl_packet.result
+++ b/mysql-test/suite/rpl/r/rpl_packet.result
@@ -49,6 +49,14 @@ Slave_IO_Running = No (expect No)
SELECT "Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'" AS Last_IO_Error;
Last_IO_Error
Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'
+STOP SLAVE;
+RESET SLAVE;
+RESET MASTER;
+SET @max_allowed_packet_0= @@session.max_allowed_packet;
+SHOW BINLOG EVENTS;
+SET @max_allowed_packet_1= @@session.max_allowed_packet;
+SHOW BINLOG EVENTS;
+SET @max_allowed_packet_2= @@session.max_allowed_packet;
==== clean up ====
DROP TABLE t1;
SET @@global.max_allowed_packet= 1024;
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 896ba90b865..459dc83e01d 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
@@ -165,10 +165,6 @@ 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`; SET PASSWORD FOR 'user'@'localhost'='*D8DECEC305209EEFEC43008E1D420E1AA06B19E0'
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (mysql.user)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-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_sp005.result b/mysql-test/suite/rpl/r/rpl_row_sp005.result
index 01e1970e0df..58c53b394b2 100644
--- a/mysql-test/suite/rpl/r/rpl_row_sp005.result
+++ b/mysql-test/suite/rpl/r/rpl_row_sp005.result
@@ -77,6 +77,8 @@ id2
< ---- Master selects-- >
-------------------------
CALL test.p1();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
SELECT * FROM test.t3 ORDER BY id3;
id3 c
1 MySQL
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
index 6792a701577..079e750e2eb 100644
--- a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
+++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
@@ -38,6 +38,8 @@ INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '
END|
CALL p2();
CALL p1();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_trig003.result b/mysql-test/suite/rpl/r/rpl_row_trig003.result
index 43c2ecde2b4..131af933b41 100644
--- a/mysql-test/suite/rpl/r/rpl_row_trig003.result
+++ b/mysql-test/suite/rpl/r/rpl_row_trig003.result
@@ -69,9 +69,15 @@ INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL C
UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
DELETE FROM test.t1 WHERE id = 1;
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DELETE FROM test.t2 WHERE id = 1;
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DROP TRIGGER test.t1_bi;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t1_bu;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
index 72de5950bb3..7cbe1d73254 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
@@ -39,6 +39,8 @@ INSERT INTO t2 VALUES (NULL);
RETURN i;
END//
CALL p1();
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
@@ -123,6 +125,8 @@ SELECT * FROM t2;
id
DROP TRIGGER tr1;
CALL p2();
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
diff --git a/mysql-test/suite/rpl/t/rpl_conditional_comments.test b/mysql-test/suite/rpl/t/rpl_conditional_comments.test
new file mode 100644
index 00000000000..14251d5eb37
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_conditional_comments.test
@@ -0,0 +1,74 @@
+###############################################################################
+# After the patch for BUG#49124:
+# - Use ' ' instead of '!' in the conditional comments which are not applied on
+# master. So they become common comments and will not be applied on slave.
+#
+# - Example:
+# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/
+# will be binlogged as
+# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'.
+###############################################################################
+source include/master-slave.inc;
+source include/have_binlog_format_statement.inc;
+
+CREATE TABLE t1(c1 INT);
+source include/show_binlog_events.inc;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # Case 1:
+--echo # ------------------------------------------------------------------
+--echo # In a statement, some CCs are applied while others are not. The CCs
+--echo # which are not applied on master will be binlogged as common comments.
+
+/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/;
+
+source include/show_binlog_events.inc;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+sync_slave_with_master;
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+--echo
+--echo # Case 2:
+--echo # -----------------------------------------------------------------
+--echo # Verify whether it can be binlogged correctly when executing prepared
+--echo # statement.
+PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/';
+EXECUTE stmt;
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT);
+EXECUTE stmt;
+
+sync_slave_with_master;
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+--echo
+SET @value=62;
+PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/';
+EXECUTE stmt USING @value;
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT);
+EXECUTE stmt USING @value;
+
+source include/show_binlog_events.inc;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+sync_slave_with_master;
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+--echo
+--echo # Case 3:
+--echo # -----------------------------------------------------------------
+--echo # Verify it can restore the '!', if the it is an uncomplete conditional
+--echo # comments
+--error 1064
+SELECT c1 FROM /*!99999 t1 WHEREN;
+
+DROP TABLE t1;
+source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
index 61a1ad9d987..38b868cb59d 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -1,7 +1,12 @@
+# ==== Purpose ====
#
# Check replication protocol packet size handling
-# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
#
+# ==== Related bugs ====
+# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
+# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits
+# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors
+# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
# max-out size db name
source include/master-slave.inc;
@@ -114,6 +119,38 @@ let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
eval SELECT "$last_io_error" AS Last_IO_Error;
+# Remove the bad binlog and clear error status on slave.
+STOP SLAVE;
+RESET SLAVE;
+--connection master
+RESET MASTER;
+
+
+#
+# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
+#
+# In BUG#55322, @@session.max_allowed_packet increased each time SHOW
+# BINLOG EVENTS was issued. To verify that this bug is fixed, we
+# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet
+# never changes. We turn off the result log because we don't care
+# about the contents of the binlog.
+
+--disable_result_log
+SET @max_allowed_packet_0= @@session.max_allowed_packet;
+SHOW BINLOG EVENTS;
+SET @max_allowed_packet_1= @@session.max_allowed_packet;
+SHOW BINLOG EVENTS;
+SET @max_allowed_packet_2= @@session.max_allowed_packet;
+--enable_result_log
+if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`)
+{
+ --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS
+ --source include/show_rpl_debug_info.inc
+ SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2;
+ --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS
+}
+
+
--echo ==== clean up ====
connection master;
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result
index 047402f826f..21a2cfe5441 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result
@@ -38,6 +38,8 @@ INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '
END|
CALL p2();
CALL p1();
+Warnings:
+Error 1329 No data - zero rows fetched, selected, or processed
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
diff --git a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def
index 6bfb20f2205..8eda2f18958 100644
--- a/mysql-test/suite/rpl_ndb/t/disabled.def
+++ b/mysql-test/suite/rpl_ndb/t/disabled.def
@@ -12,6 +12,7 @@
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
rpl_ndb_2ndb : Bug#45974: rpl_ndb_2ndb fails sporadically
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index d7f7a12cbf8..5b5fdf50c16 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1128,3 +1128,19 @@ INSERT INTO t1 VALUES (1), (2);
ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2);
DROP TABLE t1;
+
+--echo #
+--echo # Test for bug #53820 "ALTER a MEDIUMINT column table causes full
+--echo # table copy".
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a INT, b MEDIUMINT);
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+--echo # The below ALTER should not copy table and so no rows should
+--echo # be shown as affected.
+--enable_info
+ALTER TABLE t1 CHANGE a id INT;
+--disable_info
+DROP TABLE t1;
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 609a49c7634..028b6453a04 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1553,26 +1553,25 @@ drop table t1;
# whole alter table code is being tested all around the test suite already.
#
-create table t1 (v varchar(32) not null);
+create table t1 (v varchar(32) not null) engine=csv;
insert into t1 values ('def'),('abc'),('hij'),('3r4f');
select * from t1;
# Fast alter, no copy performed
-alter table t1 change v v2 varchar(32);
+alter table t1 change v v2 varchar(32) not null;
select * from t1;
# Fast alter, no copy performed
-alter table t1 change v2 v varchar(64);
+alter table t1 change v2 v varchar(64) not null;
select * from t1;
update t1 set v = 'lmn' where v = 'hij';
select * from t1;
# Regular alter table
-alter table t1 add i int auto_increment not null primary key first;
+alter table t1 add i int not null first;
select * from t1;
-update t1 set i=5 where i=3;
+update t1 set i=3 where v = 'abc';
select * from t1;
-alter table t1 change i i bigint;
+alter table t1 change i i bigint not null;
select * from t1;
-alter table t1 add unique key (i, v);
-select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+select * from t1 where i between 2 and 4 and v in ('def','3r4f','abc');
drop table t1;
#
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 6dbc8a05789..2914bb15d18 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1085,3 +1085,13 @@ drop table t1;
--echo #
--echo End of 5.1 tests
+--echo #
+--echo # Bug#55648: Server crash on MIX/MAX on maximum time value
+--echo #
+CREATE TABLE t1(c1 TIME NOT NULL);
+INSERT INTO t1 VALUES('837:59:59');
+INSERT INTO t1 VALUES('838:59:59');
+SELECT MAX(c1) FROM t1;
+DROP TABLE t1;
+--echo # End of the bug#55648
+
diff --git a/mysql-test/t/innodb_mysql_lock.test b/mysql-test/t/innodb_mysql_lock.test
index 36d09b4c411..c8ece729b19 100644
--- a/mysql-test/t/innodb_mysql_lock.test
+++ b/mysql-test/t/innodb_mysql_lock.test
@@ -209,6 +209,74 @@ disconnect con1;
DROP TABLE t1;
+--echo #
+--echo # Bug#49891 View DDL breaks REPEATABLE READ
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v2;
+--enable_warnings
+
+CREATE TABLE t1 ( f1 INTEGER ) ENGINE = innodb;
+CREATE TABLE t2 ( f1 INTEGER );
+CREATE VIEW v1 AS SELECT 1 FROM t1;
+
+connect (con2, localhost, root);
+connect (con3, localhost, root);
+
+--echo # Connection con3
+connection con3;
+LOCK TABLE t1 WRITE;
+
+--echo # Connection default
+connection default;
+START TRANSACTION;
+# This should block due to t1 being locked.
+--echo # Sending:
+--send SELECT * FROM v1
+
+--echo # Connection con2
+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";
+--source include/wait_condition.inc
+# This should block due to v1 being locked.
+--echo # Sending:
+--send ALTER VIEW v1 AS SELECT 2 FROM t2
+
+--echo # Connection con3
+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";
+--source include/wait_condition.inc
+# Unlock t1 allowing SELECT * FROM v1 to proceed.
+UNLOCK TABLES;
+
+--echo # Connection default;
+connection default;
+--echo # Reaping: SELECT * FROM v1
+--reap
+SELECT * FROM v1;
+COMMIT;
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: ALTER VIEW v1 AS SELECT 2 FROM t2
+--reap
+
+--echo # Connection default
+connection default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
+disconnect con2;
+disconnect con3;
+
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/innodb_mysql_sync.test b/mysql-test/t/innodb_mysql_sync.test
index ee92ee9f52e..07f75afec40 100644
--- a/mysql-test/t/innodb_mysql_sync.test
+++ b/mysql-test/t/innodb_mysql_sync.test
@@ -80,6 +80,32 @@ disconnect con1;
SET DEBUG_SYNC= "RESET";
+--echo #
+--echo # Bug#53757 assert in mysql_truncate_by_delete
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1(a INT) Engine=InnoDB;
+CREATE TABLE t2(id INT);
+INSERT INTO t1 VALUES (1), (2);
+
+connect (con1, localhost, root);
+INSERT INTO t2 VALUES(connection_id());
+SET DEBUG_SYNC= "open_and_process_table SIGNAL opening WAIT_FOR killed";
+--echo # Sending: (not reaped since connection is killed later)
+--send TRUNCATE t1
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR opening";
+SELECT ((@id := id) - id) FROM t2;
+KILL @id;
+SET DEBUG_SYNC= "now SIGNAL killed";
+DROP TABLE t1, t2;
+
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test
index 19f9b396087..6b721ace07f 100644
--- a/mysql-test/t/mdl_sync.test
+++ b/mysql-test/t/mdl_sync.test
@@ -3705,6 +3705,481 @@ DROP TABLE t1;
disconnect con1;
+--echo #
+--echo # Tests for schema-scope locks
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+DROP DATABASE IF EXISTS db2;
+--enable_warnings
+
+connect (con2, localhost, root);
+connect (con3, localhost, root);
+
+--echo # Test 1:
+--echo # CREATE DATABASE blocks database DDL on the same database, but
+--echo # not database DDL on different databases. Tests X vs X lock.
+--echo #
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send CREATE DATABASE db1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should block.
+--send CREATE DATABASE db1
+
+--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';
+--source include/wait_condition.inc
+# This should not block.
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: CREATE DATABASE db1
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: CREATE DATABASE db1
+--error ER_DB_CREATE_EXISTS
+--reap
+
+--echo # Test 2:
+--echo # ALTER DATABASE blocks database DDL on the same database, but
+--echo # not database DDL on different databases. Tests X vs X lock.
+--echo #
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should block.
+--send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+
+--echo # Connection con3
+connection con3;
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state='Waiting for table'
+ AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
+--source include/wait_condition.inc
+# This should not block.
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+--reap
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should also block.
+--send DROP DATABASE db1
+
+--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';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: DROP DATABASE db1
+--reap
+# Recreate the database
+CREATE DATABASE db1;
+
+--echo # Test 3:
+--echo # Two ALTER..UPGRADE of the same database are mutually exclusive, but
+--echo # two ALTER..UPGRADE of different databases are not. Tests X vs X lock.
+--echo #
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+# Manually make a 5.0 database from the template
+--mkdir $MYSQLD_DATADIR/a-b-c
+--copy_file $MYSQLD_DATADIR/db1/db.opt $MYSQLD_DATADIR/a-b-c/db.opt
+--mkdir $MYSQLD_DATADIR/a-b-c-d
+--copy_file $MYSQLD_DATADIR/db1/db.opt $MYSQLD_DATADIR/a-b-c-d/db.opt
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should block.
+--send ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME
+
+--echo # Connection con3
+connection con3;
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state='Waiting for table'
+ AND info='ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME';
+--source include/wait_condition.inc
+# This should not block.
+ALTER DATABASE `#mysql50#a-b-c-d` UPGRADE DATA DIRECTORY NAME;
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
+--error ER_BAD_DB_ERROR
+--reap
+DROP DATABASE `a-b-c`;
+DROP DATABASE `a-b-c-d`;
+
+--echo # Test 4:
+--echo # DROP DATABASE blocks database DDL on the same database, but
+--echo # not database DDL on different databases. Tests X vs X lock.
+--echo #
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should block.
+--send DROP DATABASE db1
+
+--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';
+--source include/wait_condition.inc
+# This should not block.
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: DROP DATABASE db1
+--error ER_DB_DROP_EXISTS
+--reap
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should also block.
+--send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+
+--echo # Connection con3
+connection con3;
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state='Waiting for table'
+ AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--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
+--reap
+
+
+--echo # Test 5:
+--echo # Locked database name prevents CREATE of tables in that database.
+--echo # Tests X vs IX lock.
+--echo #
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should block.
+--send CREATE TABLE db1.t1 (a INT)
+
+--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)';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: CREATE TABLE db1.t1 (a INT)
+--error ER_BAD_DB_ERROR
+--reap
+
+--echo # Test 6:
+--echo # Locked database name prevents RENAME of tables to/from that database.
+--echo # Tests X vs IX lock.
+--echo #
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should block.
+--send RENAME TABLE db1.t1 TO test.t1
+
+--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';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: RENAME TABLE db1.t1 TO test.t1
+--error ER_FILE_NOT_FOUND, ER_FILE_NOT_FOUND
+--reap
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE TABLE test.t2 (a INT);
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should block.
+--send RENAME TABLE test.t2 TO db1.t2
+
+--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';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--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
+--reap
+DROP TABLE test.t2;
+
+
+--echo # Test 7:
+--echo # Locked database name prevents DROP of tables in that database.
+--echo # Tests X vs IX lock.
+--echo #
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # Sending:
+# This should block.
+--send DROP TABLE db1.t1
+
+--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';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= 'now SIGNAL blocked';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: DROP TABLE db1.t1
+--error ER_BAD_TABLE_ERROR
+--reap
+
+--echo # Connection default
+connection default;
+disconnect con2;
+disconnect con3;
+SET DEBUG_SYNC= 'RESET';
+
+--echo #
+--echo # End of tests for schema-scope locks
+--echo #
+
+--echo #
+--echo # Tests of granted global S lock (FLUSH TABLE WITH READ LOCK)
+--echo #
+
+CREATE DATABASE db1;
+CREATE TABLE db1.t1(a INT);
+connect(con2, localhost, root);
+connect(con3, localhost, root);
+
+--echo # Connection default
+connection default;
+FLUSH TABLE WITH READ LOCK;
+
+--echo # Connection con2
+connection con2;
+# IX global lock should block
+--send CREATE TABLE db1.t2(a INT)
+
+--echo # Connection default
+connection default;
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state='Waiting for release of readlock'
+ AND info='CREATE TABLE db1.t2(a INT)';
+--source include/wait_condition.inc
+UNLOCK TABLES;
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping CREATE TABLE db1.t2(a INT)
+--reap
+
+--echo # Connection default
+connection default;
+FLUSH TABLE WITH READ LOCK;
+
+--echo # Connection con2
+connection con2;
+# X global lock should block
+--send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+
+--echo # Connection default
+connection default;
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state='Waiting for release of readlock'
+ AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
+--source include/wait_condition.inc
+UNLOCK TABLES;
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
+--reap
+
+--echo # Connection default
+connection default;
+FLUSH TABLE WITH READ LOCK;
+
+--echo # Connection con2
+connection con2;
+# S global lock should not block
+FLUSH TABLE WITH READ LOCK;
+UNLOCK TABLES;
+
+--echo # Connection default
+connection default;
+UNLOCK TABLES;
+DROP DATABASE db1;
+disconnect con2;
+disconnect con3;
+
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/merge-big.test b/mysql-test/t/merge-big.test
index 33bd93791f1..509c7742dac 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 = 'Table lock';
+ WHERE ID = $con1_id AND STATE = 'Waiting for table';
--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 = 'Table lock';
+ WHERE ID = $con1_id AND STATE = 'Waiting for table';
--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 a06da03cbcd..31bc8a5e881 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -2,6 +2,12 @@
# Test of MERGE TABLES
#
+# MERGE tables require MyISAM tables
+let $default=`select @@global.storage_engine`;
+set global storage_engine=myisam;
+set session storage_engine=myisam;
+
+# Clean up resources used in this test case.
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6;
drop database if exists mysqltest;
@@ -222,7 +228,6 @@ CREATE TABLE t2 (c1 INT NOT NULL);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2);
---error ER_WRONG_MRG_TABLE
SELECT * FROM t3;
CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL);
CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL);
@@ -254,7 +259,6 @@ create table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
drop table t3;
create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
---error ER_WRONG_MRG_TABLE
select * from t3;
drop table t3, t2, t1;
--echo # CREATE...SELECT is not implemented for MERGE tables.
@@ -891,12 +895,9 @@ INSERT INTO t4 VALUES (4);
--echo # If the temporary MERGE table uses the locked children only,
--echo # it can even be used.
CREATE TEMPORARY TABLE t4 LIKE t3;
---error ER_WRONG_MRG_TABLE
SHOW CREATE TABLE t4;
---error ER_WRONG_MRG_TABLE
INSERT INTO t4 VALUES (4);
UNLOCK TABLES;
---error ER_WRONG_MRG_TABLE
INSERT INTO t4 VALUES (4);
DROP TABLE t4;
#
@@ -2117,6 +2118,325 @@ OPTIMIZE TABLE t1;
DROP TABLE t1;
--echo #
+--echo # Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
+--echo # More tests with TEMPORARY MERGE table and permanent children.
+--echo # First without locked tables.
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3, t4, m1, m2;
+--enable_warnings
+#
+--echo #
+CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
+CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE m1;
+SELECT * FROM m1;
+INSERT INTO t1 VALUES (111, 121);
+INSERT INTO m1 VALUES (211, 221);
+SELECT * FROM m1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+#
+--echo #
+ALTER TABLE m1 RENAME m2;
+SHOW CREATE TABLE m2;
+SELECT * FROM m2;
+#
+--echo #
+CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+--error ER_TABLE_EXISTS_ERROR
+ALTER TABLE m2 RENAME m1;
+DROP TABLE m1;
+ALTER TABLE m2 RENAME m1;
+SHOW CREATE TABLE m1;
+SELECT * FROM m1;
+#
+--echo #
+ALTER TABLE m1 ADD COLUMN c3 INT;
+--error ER_WRONG_MRG_TABLE
+INSERT INTO m1 VALUES (212, 222, 232);
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM m1;
+ALTER TABLE t1 ADD COLUMN c3 INT;
+ALTER TABLE t2 ADD COLUMN c3 INT;
+INSERT INTO m1 VALUES (212, 222, 232);
+SELECT * FROM m1;
+#
+--echo #
+ALTER TABLE m1 DROP COLUMN c3;
+--error ER_WRONG_MRG_TABLE
+INSERT INTO m1 VALUES (213, 223);
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM m1;
+ALTER TABLE t1 DROP COLUMN c3;
+ALTER TABLE t2 DROP COLUMN c3;
+INSERT INTO m1 VALUES (213, 223);
+SELECT * FROM m1;
+#
+--echo #
+CREATE TABLE t3 (c1 INT, c2 INT) ENGINE=MyISAM;
+ALTER TABLE m1 UNION=(t1,t2,t3);
+INSERT INTO m1 VALUES (311, 321);
+SELECT * FROM m1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+#
+--echo #
+CREATE TEMPORARY TABLE t4 (c1 INT, c2 INT) ENGINE=MyISAM;
+ALTER TABLE m1 UNION=(t1,t2,t3,t4);
+INSERT INTO m1 VALUES (411, 421);
+SELECT * FROM m1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t4;
+#
+--echo #
+ALTER TABLE m1 ENGINE=MyISAM;
+SHOW CREATE TABLE m1;
+INSERT INTO m1 VALUES (511, 521);
+SELECT * FROM m1;
+#
+--echo #
+ALTER TABLE m1 ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+SELECT * FROM m1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+#
+--echo #
+CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (611, 621);
+SELECT * FROM m1;
+DROP TABLE t1;
+SELECT * FROM m1;
+#
+#
+--echo #
+--echo #
+SHOW CREATE TABLE m1;
+#
+--echo #
+CREATE TABLE m2 SELECT * FROM m1;
+SHOW CREATE TABLE m2;
+SELECT * FROM m2;
+DROP TABLE m2;
+#
+--echo #
+CREATE TEMPORARY TABLE m2 SELECT * FROM m1;
+SHOW CREATE TABLE m2;
+SELECT * FROM m2;
+DROP TABLE m2;
+#
+--echo #
+CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+ INSERT_METHOD=LAST;
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM m2;
+DROP TABLE m2;
+#
+--echo #
+--error ER_WRONG_OBJECT
+CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+ INSERT_METHOD=LAST SELECT * FROM m1;
+#
+--echo #
+--error ER_WRONG_OBJECT
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+ INSERT_METHOD=LAST SELECT * FROM m1;
+#
+--echo #
+CREATE TABLE m2 LIKE m1;
+SHOW CREATE TABLE m2;
+SELECT * FROM m2;
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+DROP TABLE m2;
+#
+--echo #
+CREATE TEMPORARY TABLE m2 LIKE m1;
+SHOW CREATE TABLE m2;
+SELECT * FROM m2;
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+DROP TABLE m2;
+#
+--echo #
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+ INSERT_METHOD=LAST;
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+#
+#
+--echo #
+--echo #
+LOCK TABLE m1 WRITE, m2 WRITE;
+SELECT * FROM m1,m2 WHERE m1.c1=m2.c1;
+UNLOCK TABLES;
+#
+DROP TABLE t1, t2, t3, t4, m1, m2;
+#
+#
+#
+--echo #
+--echo # Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
+--echo # More tests with TEMPORARY MERGE table and permanent children.
+--echo # (continued) Now the same with locked table.
+--echo #
+CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
+CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE m1;
+SELECT * FROM m1;
+INSERT INTO t1 VALUES (111, 121);
+INSERT INTO m1 VALUES (211, 221);
+SELECT * FROM m1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+#
+--echo #
+LOCK TABLE m1 WRITE, t1 WRITE, t2 WRITE;
+#
+--echo #
+ALTER TABLE m1 RENAME m2;
+SHOW CREATE TABLE m2;
+SELECT * FROM m2;
+#
+--echo #
+CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+--error ER_TABLE_EXISTS_ERROR
+ALTER TABLE m2 RENAME m1;
+DROP TABLE m1;
+ALTER TABLE m2 RENAME m1;
+SHOW CREATE TABLE m1;
+SELECT * FROM m1;
+#
+--echo #
+ALTER TABLE m1 ADD COLUMN c3 INT;
+--error ER_WRONG_MRG_TABLE
+INSERT INTO m1 VALUES (212, 222, 232);
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM m1;
+ALTER TABLE t1 ADD COLUMN c3 INT;
+ALTER TABLE t2 ADD COLUMN c3 INT;
+INSERT INTO m1 VALUES (212, 222, 232);
+SELECT * FROM m1;
+#
+--echo #
+ALTER TABLE m1 DROP COLUMN c3;
+--error ER_WRONG_MRG_TABLE
+INSERT INTO m1 VALUES (213, 223);
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM m1;
+ALTER TABLE t1 DROP COLUMN c3;
+ALTER TABLE t2 DROP COLUMN c3;
+INSERT INTO m1 VALUES (213, 223);
+SELECT * FROM m1;
+#
+--echo #
+UNLOCK TABLES;
+CREATE TABLE t3 (c1 INT, c2 INT) ENGINE=MyISAM;
+ALTER TABLE m1 UNION=(t1,t2,t3);
+LOCK TABLE m1 WRITE;
+INSERT INTO m1 VALUES (311, 321);
+SELECT * FROM m1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+#
+--echo #
+CREATE TEMPORARY TABLE t4 (c1 INT, c2 INT) ENGINE=MyISAM;
+ALTER TABLE m1 UNION=(t1,t2,t3,t4);
+INSERT INTO m1 VALUES (411, 421);
+SELECT * FROM m1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t4;
+#
+--echo #
+ALTER TABLE m1 ENGINE=MyISAM;
+SHOW CREATE TABLE m1;
+INSERT INTO m1 VALUES (511, 521);
+SELECT * FROM m1;
+#
+--echo #
+ALTER TABLE m1 ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+SELECT * FROM m1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+#
+--echo #
+CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (611, 621);
+SELECT * FROM m1;
+DROP TABLE t1;
+SELECT * FROM m1;
+#
+#
+--echo #
+--echo #
+SHOW CREATE TABLE m1;
+--error ER_TABLE_NOT_LOCKED
+CREATE TABLE m2 SELECT * FROM m1;
+#
+--echo #
+CREATE TEMPORARY TABLE m2 SELECT * FROM m1;
+SHOW CREATE TABLE m2;
+SELECT * FROM m2;
+DROP TABLE m2;
+#
+--echo #
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+ INSERT_METHOD=LAST;
+SELECT * FROM m2;
+LOCK TABLE m1 WRITE, m2 WRITE;
+UNLOCK TABLES;
+DROP TABLE m2;
+LOCK TABLE m1 WRITE;
+#
+--echo #
+--echo # ER_TABLE_NOT_LOCKED is returned in ps-protocol
+--error ER_WRONG_OBJECT, ER_TABLE_NOT_LOCKED
+CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+ INSERT_METHOD=LAST SELECT * FROM m1;
+#
+--echo #
+--error ER_WRONG_OBJECT
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+ INSERT_METHOD=LAST SELECT * FROM m1;
+#
+--echo #
+CREATE TEMPORARY TABLE m2 LIKE m1;
+SHOW CREATE TABLE m2;
+LOCK TABLE m1 WRITE, m2 WRITE;
+SHOW CREATE TABLE m2;
+SELECT * FROM m2;
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+DROP TABLE m2;
+#
+--echo #
+CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
+ INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+#
+--echo #
+UNLOCK TABLES;
+DROP TABLE t1, t2, t3, t4, m1, m2;
+
+--echo #
--echo # Bug47098 assert in MDL_context::destroy on HANDLER
--echo # <damaged merge table> OPEN
--echo #
@@ -2225,6 +2545,130 @@ show create table m1;
show create table m2;
drop tables m1, m2, t1;
+--echo #
+--echo # Test case for Bug#54811 "Assert in mysql_lock_have_duplicate()"
+--echo # Check that unique_table() works correctly for merge tables.
+--echo #
+--disable_warnings
+drop table if exists t1, t2, t3, m1, m2;
+--enable_warnings
+create table t1 (a int);
+create table t2 (a int);
+create table t3 (b int);
+create view v1 as select * from t3,t1;
+create table m1 (a int) engine=merge union (t1, t2) insert_method=last;
+create table m2 (a int) engine=merge union (t1, t2) insert_method=first;
+create temporary table tmp (b int);
+insert into tmp (b) values (1);
+
+insert into t1 (a) values (1);
+insert into t3 (b) values (1);
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from m1));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from m2));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from t1));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from t2));
+
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from t3, m1));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from t3, m2));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from t3, t1));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from t3, t2));
+
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from tmp, m1));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from tmp, m2));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from tmp, t1));
+--error ER_UPDATE_TABLE_USED
+insert into m1 (a) values ((select max(a) from tmp, t2));
+
+--error ER_VIEW_PREVENT_UPDATE
+insert into m1 (a) values ((select max(a) from v1));
+--error ER_VIEW_PREVENT_UPDATE
+insert into m1 (a) values ((select max(a) from tmp, v1));
+
+
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from m1));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from m2));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from t1));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from t2));
+
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from t3, m1));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from t3, m2));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from t3, t1));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from t3, t2));
+
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from tmp, m1));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from tmp, m2));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from tmp, t1));
+--error ER_UPDATE_TABLE_USED
+update m1 set a = ((select max(a) from tmp, t2));
+
+--error ER_VIEW_PREVENT_UPDATE
+update m1 set a = ((select max(a) from v1));
+--error ER_VIEW_PREVENT_UPDATE
+update m1 set a = ((select max(a) from tmp, v1));
+
+
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from m1);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from m2);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from t1);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from t2);
+
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from t3, m1);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from t3, m2);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from t3, t1);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from t3, t2);
+
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from tmp, m1);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from tmp, m2);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from tmp, t1);
+--error ER_UPDATE_TABLE_USED
+delete from m1 where a = (select max(a) from tmp, t2);
+
+--error ER_VIEW_PREVENT_UPDATE
+delete from m1 where a = (select max(a) from v1);
+--error ER_VIEW_PREVENT_UPDATE
+delete from m1 where a = (select max(a) from tmp, v1);
+
+drop view v1;
+drop temporary table tmp;
+drop table t1, t2, t3, m1, m2;
--echo End of 6.0 tests
+--disable_result_log
+--disable_query_log
+eval set global storage_engine=$default;
+--enable_result_log
+--enable_query_log
diff --git a/mysql-test/t/merge_mmap-master.opt b/mysql-test/t/merge_mmap-master.opt
new file mode 100644
index 00000000000..9606fb57187
--- /dev/null
+++ b/mysql-test/t/merge_mmap-master.opt
@@ -0,0 +1 @@
+--myisam-use-mmap
diff --git a/mysql-test/t/merge_mmap.test b/mysql-test/t/merge_mmap.test
new file mode 100644
index 00000000000..c97b029754d
--- /dev/null
+++ b/mysql-test/t/merge_mmap.test
@@ -0,0 +1,151 @@
+#
+# Test of MERGE TABLES with MyISAM memory mapping enabled (--myisam-use-mmap)
+#
+
+# MERGE tables require MyISAM tables
+--let $default=`SELECT @@global.storage_engine`
+SET GLOBAL storage_engine = MyISAM;
+SET SESSION storage_engine = MyISAM;
+
+# Clean up resources used in this test case.
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, m1, m2;
+--enable_warnings
+
+####################
+## No locked tables.
+####################
+#
+# INSERT-SELECT with no TEMPORARY table.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+SELECT * FROM t2;
+DROP TABLE m2, m1, t2, t1;
+#
+# INSERT-SELECT with TEMPORARY select table.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+DROP TABLE m2, m1, t2, t1;
+#
+# INSERT-SELECT with TEMPORARY insert table.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+DROP TABLE m2, m1, t2, t1;
+#
+# INSERT-SELECT with TEMPORARY both tables.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+DROP TABLE m2, m1, t2, t1;
+
+####################
+## With LOCK TABLES.
+####################
+#
+# INSERT-SELECT with no TEMPORARY table.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+SELECT * FROM t2;
+UNLOCK TABLES;
+DROP TABLE m2, m1, t2, t1;
+#
+# INSERT-SELECT with TEMPORARY select table.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+UNLOCK TABLES;
+DROP TABLE m2, m1, t2, t1;
+#
+# INSERT-SELECT with TEMPORARY insert table.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+UNLOCK TABLES;
+DROP TABLE m2, m1, t2, t1;
+#
+# INSERT-SELECT with TEMPORARY both tables.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
+ INSERT_METHOD=LAST;
+LOCK TABLE m1 WRITE, m2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2), (3), (4);
+INSERT INTO m2 SELECT * FROM m1;
+SELECT * FROM m2;
+UNLOCK TABLES;
+DROP TABLE m2, m1, t2, t1;
+
+--echo End of 6.0 tests
+
+--disable_result_log
+--disable_query_log
+eval SET GLOBAL storage_engine = $default;
+--enable_result_log
+--enable_query_log
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 3ea612d2ca7..3c6cc45da38 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -1,31 +1,4 @@
-# Can't run test of external client with embedded server
--- source include/not_embedded.inc
-
-# Only run test if "mysql_upgrade" is found
---require r/have_mysql_upgrade.result
---disable_query_log
-select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
---enable_query_log
-
-#
-# Hack:
-#
-# If running with Valgrind ($VALGRIND_TEST <> 0) then the resource
-# consumption (CPU) for upgrading a large log table will be intense.
-# Therefore, truncate the log table in advance and issue a statement
-# that should be logged.
-#
-if (`SELECT $VALGRIND_TEST`)
-{
- --disable_query_log
- --disable_result_log
- --disable_abort_on_error
- TRUNCATE TABLE mysql.general_log;
- SELECT 1;
- --enable_abort_on_error
- --enable_result_log
- --enable_query_log
-}
+-- source include/mysql_upgrade_preparation.inc
#
# Basic test that we can run mysql_upgrde and that it finds the
diff --git a/mysql-test/t/mysql_upgrade_ssl.test b/mysql-test/t/mysql_upgrade_ssl.test
new file mode 100644
index 00000000000..d1c029bf33a
--- /dev/null
+++ b/mysql-test/t/mysql_upgrade_ssl.test
@@ -0,0 +1,10 @@
+# mysql_upgrade tests requiring SSL support
+
+-- source include/have_ssl_communication.inc
+-- source include/mysql_upgrade_preparation.inc
+
+--echo #
+--echo # Bug#55672 mysql_upgrade dies with internal error
+--echo #
+--exec $MYSQL_UPGRADE --skip-verbose --ssl --force 2>&1
+--exit
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 25293ff29e7..031c51a0720 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -326,6 +326,15 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
--exec echo "disable_abort_on_error; error 1000; select 3 from t1; error 1000; select 3 from t1;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
+# Check some non-query statements that would fail
+# ----------------------------------------------------------------------------
+--exec illegal_command
+--cat_file does_not_exist
+--perl
+ exit(1);
+EOF
+
+# ----------------------------------------------------------------------------
# Switch the abort on error on and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error ER_PARSE_ERROR
@@ -863,7 +872,7 @@ while ($outer)
}
# Test source in an if in a while which is false on 1st iteration
-# Also test --error in same context
+# Also test --error and --disable_abort_on_error in same context
let $outer= 2; # Number of outer loops
let $ifval= 0; # false 1st time
while ($outer)
@@ -874,6 +883,10 @@ while ($outer)
--source $MYSQLTEST_VARDIR/tmp/sourced.inc
--error ER_NO_SUCH_TABLE
SELECT * from nowhere;
+ --disable_abort_on_error
+# Statement giving a different error, to make sure we don't mask it
+ SELECT * FROM nowhere else;
+ --enable_abort_on_error
}
dec $outer;
inc $ifval;
@@ -1093,6 +1106,36 @@ if (!$counter)
}
# ----------------------------------------------------------------------------
+# Test if with some non-numerics
+# ----------------------------------------------------------------------------
+
+let $counter=alpha;
+if ($counter)
+{
+ echo Counter is true, (counter=alpha);
+}
+let $counter= ;
+if ($counter)
+{
+ echo oops, space is true;
+}
+let $counter=-0;
+if ($counter)
+{
+ echo oops, -0 is true;
+}
+if (beta)
+{
+ echo Beta is true;
+}
+let $counter=gamma;
+while ($counter)
+{
+ echo while with string, only once;
+ let $counter=000;
+}
+
+# ----------------------------------------------------------------------------
# Test while, { and }
# ----------------------------------------------------------------------------
@@ -1437,7 +1480,6 @@ EOF
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# connect when "disable_abort_on_error" caused "connection not found"
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--disable_abort_on_error
connect (con1,localhost,root,,);
connection default;
@@ -1724,7 +1766,16 @@ select 1;
--reap
EOF
--error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1
+# Must filter unpredictable extra warning from output
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in > $MYSQL_TMP_DIR/mysqltest.out 2>&1
+--perl
+ my $dir= $ENV{'MYSQL_TMP_DIR'};
+ open (FILE, "$dir/mysqltest.out");
+ while (<FILE>) {
+ print unless /Note: net_clear/; # This shows up on rare occations
+ }
+EOF
+remove_file $MYSQL_TMP_DIR/mysqltest.out;
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in;
drop table t1;
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_debug_sync.test b/mysql-test/t/partition_debug_sync.test
index 9165006f537..cde94856ae6 100644
--- a/mysql-test/t/partition_debug_sync.test
+++ b/mysql-test/t/partition_debug_sync.test
@@ -65,7 +65,7 @@ ENGINE = MYISAM
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN (100),
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
-SET DEBUG_SYNC= 'open_tables_acquire_upgradable_mdl SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
+SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
--send ALTER TABLE t2 REMOVE PARTITIONING
connection default;
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 30f5894716c..f6adf014468 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -9,6 +9,50 @@ drop table if exists t1, t2;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--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_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/schema.test b/mysql-test/t/schema.test
index f106b9e4865..ed3b98ec2f7 100644
--- a/mysql-test/t/schema.test
+++ b/mysql-test/t/schema.test
@@ -23,6 +23,7 @@ drop schema foo;
--disable_warnings
DROP SCHEMA IF EXISTS schema1;
+DROP SCHEMA IF EXISTS schema2;
--enable_warnings
connect(con2, localhost, root);
@@ -31,6 +32,7 @@ connect(con2, localhost, root);
connection default;
CREATE SCHEMA schema1;
+CREATE SCHEMA schema2;
CREATE TABLE schema1.t1 (a INT);
SET autocommit= FALSE;
@@ -46,9 +48,7 @@ let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
WHERE state= 'Waiting for table'
AND info='DROP SCHEMA schema1';
--source include/wait_condition.inc
-# Listing the error twice to prevent result diffences based on filename
---error 1,1
-ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
+ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
SET autocommit= TRUE;
--echo # Connection 2
@@ -57,6 +57,7 @@ connection con2;
--echo # Connection default
connection default;
+DROP SCHEMA schema2;
disconnect con2;
@@ -102,6 +103,98 @@ connection con2;
connection default;
disconnect con2;
+
+--echo #
+--echo # Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
+--echo #
+
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+INSERT INTO db1.t1 VALUES (1), (2);
+
+--echo # Connection con1
+connect (con1, localhost, root);
+HANDLER db1.t1 OPEN;
+
+--echo # Connection default
+connection default;
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connect (con2, localhost, root);
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state='Waiting for table' AND info='DROP DATABASE db1';
+--source include/wait_condition.inc
+
+--echo # Connection con1
+connection con1;
+# All these statements before resulted in deadlock.
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+HANDLER t1 CLOSE;
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP DATABASE db1
+--reap
+disconnect con1;
+disconnect con2;
+
+
+--echo #
+--echo # Tests for increased CREATE/ALTER/DROP DATABASE concurrency with
+--echo # database name locks.
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+DROP DATABASE IF EXISTS db2;
+--enable_warnings
+
+connect (con2, localhost, root);
+connect (con3, localhost, root);
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (id INT);
+START TRANSACTION;
+INSERT INTO db1.t1 VALUES (1);
+
+--echo # Connection 2
+connection con2;
+--echo # DROP DATABASE should block due to the active transaction
+--echo # Sending:
+--send DROP DATABASE db1
+
+--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';
+--source include/wait_condition.inc
+--echo # But it should still be possible to CREATE/ALTER/DROP other databases.
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+
+--echo # Connection default
+connection default;
+--echo # End the transaction so DROP DATABASE db1 can continue
+COMMIT;
+
+--echo # Connection 2
+connection con2;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Connection default;
+connection default;
+disconnect con2;
+disconnect con3;
+
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 3821701ad19..fa9dc7472fe 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -1246,6 +1246,85 @@ UNLOCK TABLES;
DROP TABLE t1;
+--echo #
+--echo # Bug#54905 Connection with WRITE lock cannot ALTER table due to
+--echo # concurrent SHOW CREATE
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+
+--echo # Connection con1
+connect (con1,localhost,root);
+LOCK TABLE t1 WRITE;
+
+--echo # Connection default
+connection default;
+START TRANSACTION;
+SHOW CREATE TABLE t1;
+
+--echo # Connection con1
+connection con1;
+# Used to block
+ALTER TABLE t1 CHARACTER SET = utf8;
+UNLOCK TABLES;
+
+--echo # Connection default
+connection default;
+COMMIT;
+disconnect con1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#55498 SHOW CREATE TRIGGER takes wrong type of metadata lock.
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1;
+
+--echo # Test 1: SHOW CREATE TRIGGER with WRITE locked table.
+
+--echo # Connection con1
+connect (con1, localhost, root);
+LOCK TABLE t1 WRITE;
+
+--echo # Connection default
+connection default;
+# Should not block.
+SHOW CREATE TRIGGER t1_bi;
+
+--echo # Connection con1
+connection con1;
+UNLOCK TABLES;
+
+--echo # Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction
+
+--echo # Connection default
+connection default;
+START TRANSACTION;
+SHOW CREATE TRIGGER t1_bi;
+
+--echo # Connection con1
+connection con1;
+# Should not block.
+ALTER TABLE t1 CHARACTER SET = utf8;
+
+--echo # Connection default
+connection default;
+COMMIT;
+DROP TRIGGER t1_bi;
+DROP TABLE t1;
+disconnect con1;
+
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/signal.test b/mysql-test/t/signal.test
index bdb6625ba32..4c8e6159371 100644
--- a/mysql-test/t/signal.test
+++ b/mysql-test/t/signal.test
@@ -2408,6 +2408,7 @@ BEGIN
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '2';
+ SHOW WARNINGS;
RESIGNAL x SET MYSQL_ERRNO = 9999;
END;
@@ -2415,9 +2416,10 @@ BEGIN
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '1';
+ SHOW WARNINGS;
RESIGNAL x SET
SCHEMA_NAME = 'test',
- MYSQL_ERRNO= 1231;
+ MYSQL_ERRNO= 1232;
END;
/* Raises ER_WRONG_VALUE_FOR_VAR : 1231, SQLSTATE 42000 */
SET @@sql_mode=NULL;
@@ -2431,6 +2433,7 @@ BEGIN
DECLARE EXIT HANDLER FOR x
BEGIN
SELECT '3';
+ SHOW WARNINGS;
RESIGNAL x SET
MESSAGE_TEXT = 'Hi, I am a useless error message',
MYSQL_ERRNO = 9999;
diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test
index 247c84fda39..90b4c18895a 100644
--- a/mysql-test/t/sp-code.test
+++ b/mysql-test/t/sp-code.test
@@ -649,3 +649,56 @@ END//
DELIMITER ;//
SHOW PROCEDURE CODE p1;
DROP PROCEDURE p1;
+
+--echo #
+--echo # Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
+--echo #
+
+--echo
+--echo # - Case 4: check that "No Data trumps Warning".
+--echo
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+
+delimiter |;
+
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE c CURSOR FOR SELECT a FROM t1;
+
+ OPEN c;
+
+ BEGIN
+ DECLARE v INT;
+
+ DECLARE CONTINUE HANDLER FOR SQLWARNING
+ BEGIN
+ SELECT "Warning found!";
+ SHOW WARNINGS;
+ END;
+
+ DECLARE EXIT HANDLER FOR NOT FOUND
+ BEGIN
+ SELECT "End of Result Set found!";
+ SHOW WARNINGS;
+ END;
+
+ WHILE TRUE DO
+ FETCH c INTO v;
+ END WHILE;
+ END;
+
+ CLOSE c;
+
+ SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack
+END|
+
+delimiter ;|
+
+SET SESSION debug="+d,bug23032_emit_warning";
+CALL p1();
+SET SESSION debug="-d,bug23032_emit_warning";
+
+DROP PROCEDURE p1;
+DROP TABLE t1;
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index c8b2595e23d..13ca55a0127 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -2543,3 +2543,273 @@ DROP TABLE t1;
--echo End of 5.1 tests
+--echo #
+--echo # Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
+--echo #
+
+--echo
+--echo # - Case 1
+--echo
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+DROP PROCEDURE IF EXISTS p3;
+DROP PROCEDURE IF EXISTS p4;
+DROP PROCEDURE IF EXISTS p5;
+DROP PROCEDURE IF EXISTS p6;
+--enable_warnings
+
+delimiter |;
+
+CREATE PROCEDURE p1()
+ BEGIN
+ SELECT CAST('10 ' as unsigned integer);
+ SELECT 1;
+ CALL p2();
+ END|
+
+CREATE PROCEDURE p2()
+ BEGIN
+ SELECT CAST('10 ' as unsigned integer);
+ END|
+
+delimiter ;|
+
+CALL p1();
+
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+
+--echo
+--echo # - Case 2
+--echo
+
+delimiter |;
+
+CREATE PROCEDURE p1()
+ BEGIN
+ DECLARE c INT DEFAULT 0;
+ DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+ CALL p2();
+ CALL p3();
+ CALL p4();
+ SELECT c;
+ SELECT @@warning_count;
+ SHOW WARNINGS;
+ END|
+
+CREATE PROCEDURE p2()
+ BEGIN
+ SELECT CAST('10 ' as unsigned integer);
+ END|
+
+CREATE PROCEDURE p3()
+ BEGIN
+ SELECT CAST('10 ' as unsigned integer);
+ SELECT 1;
+ END|
+
+CREATE PROCEDURE p4()
+ BEGIN
+ SELECT CAST('10 ' as unsigned integer);
+ CALL p2();
+ END|
+
+CREATE PROCEDURE p5()
+ BEGIN
+ SELECT CAST('10 ' as unsigned integer);
+ SHOW WARNINGS;
+ END|
+
+CREATE PROCEDURE P6()
+ BEGIN
+ DECLARE c INT DEFAULT 0;
+ DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+ CALL p5();
+ SELECT c;
+ END|
+
+delimiter ;|
+
+CALL p1();
+CALL p6();
+
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP PROCEDURE p3;
+DROP PROCEDURE p4;
+DROP PROCEDURE p5;
+DROP PROCEDURE p6;
+
+--echo
+--echo # - Case 3: check that "Exception trumps No Data".
+--echo
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+
+delimiter |;
+
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE c CURSOR FOR SELECT a FROM t1;
+
+ OPEN c;
+
+ BEGIN
+ DECLARE v1 INT;
+ DECLARE v2 INT;
+
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ SELECT "Error caught (expected)";
+
+ DECLARE EXIT HANDLER FOR NOT FOUND
+ SELECT "End of Result Set found!";
+
+ WHILE TRUE DO
+ FETCH c INTO v1, v2;
+ END WHILE;
+ END;
+
+ CLOSE c;
+
+ SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack
+END|
+
+delimiter ;|
+
+CALL p1();
+
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#36185: Incorrect precedence for warning and exception handlers
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT, b INT NOT NULL);
+
+delimiter |;
+
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLWARNING SELECT 'warning';
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'exception';
+ INSERT INTO t1 VALUES (CAST('10 ' AS SIGNED), NULL);
+END|
+
+delimiter ;|
+
+CALL p1();
+
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
+--echo #
+--echo # Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
+--echo #
+
+--echo
+--echo # - Case 1
+--echo
+
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1, 2);
+
+delimiter |;
+
+CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
+BEGIN
+ DECLARE EXIT HANDLER FOR SQLWARNING
+ SET NEW.a = 10;
+
+ SET NEW.a = 99999999999;
+END|
+
+delimiter ;|
+
+UPDATE t1 SET b = 20;
+
+SHOW WARNINGS;
+
+SELECT * FROM t1;
+
+DROP TRIGGER t1_bu;
+DROP TABLE t1;
+
+--echo
+--echo # - Case 2
+--echo
+
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(b CHAR(1));
+
+delimiter |;
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+ INSERT INTO t2 VALUES('ab'); # Produces a warning.
+
+ INSERT INTO t2 VALUES('b'); # Does not produce a warning,
+ # previous warning should be cleared.
+END|
+
+delimiter ;|
+
+INSERT INTO t1 VALUES(0);
+
+SHOW WARNINGS;
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+DROP TRIGGER t1_bi;
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo #
+--echo # Bug#9857: Stored procedures: handler for sqlwarning ignored
+--echo #
+
+SET @sql_mode_saved = @@sql_mode;
+SET sql_mode = traditional;
+
+delimiter |;
+
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLWARNING
+ SELECT 'warning caught (expected)';
+
+ SELECT 5 / 0;
+END|
+
+CREATE PROCEDURE p2()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+ SELECT 'error caught (unexpected)';
+
+ SELECT 5 / 0;
+END|
+
+delimiter ;|
+
+CALL p1();
+SHOW WARNINGS;
+
+CALL p2();
+SHOW WARNINGS;
+
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+SET sql_mode = @sql_mode_saved;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index da949016a03..11edeaf9811 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -5432,6 +5432,8 @@ drop procedure if exists bug15231_1|
drop procedure if exists bug15231_2|
drop procedure if exists bug15231_3|
drop procedure if exists bug15231_4|
+drop procedure if exists bug15231_5|
+drop procedure if exists bug15231_6|
--enable_warnings
create table t3 (id int not null)|
@@ -5461,7 +5463,7 @@ end|
create procedure bug15231_3()
begin
declare exit handler for sqlwarning
- select 'Caught it (wrong)' as 'Result';
+ select 'Caught it (correct)' as 'Result';
call bug15231_4();
end|
@@ -5472,16 +5474,37 @@ begin
set x = 'zap';
select 'Missed it (correct)' as 'Result';
+ show warnings;
+end|
+
+create procedure bug15231_5()
+begin
+ declare exit handler for sqlwarning
+ select 'Caught it (wrong)' as 'Result';
+
+ call bug15231_6();
+end|
+
+create procedure bug15231_6()
+begin
+ declare x decimal(2,1);
+
+ set x = 'zap';
+ select 'Missed it (correct)' as 'Result';
+ select id from t3;
end|
call bug15231_1()|
call bug15231_3()|
+call bug15231_5()|
-drop table if exists t3|
-drop procedure if exists bug15231_1|
-drop procedure if exists bug15231_2|
-drop procedure if exists bug15231_3|
-drop procedure if exists bug15231_4|
+drop table t3|
+drop procedure bug15231_1|
+drop procedure bug15231_2|
+drop procedure bug15231_3|
+drop procedure bug15231_4|
+drop procedure bug15231_5|
+drop procedure bug15231_6|
#
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index 2bfa4936c91..92c22242cdb 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -235,4 +235,19 @@ INSERT INTO t2 SELECT f1();
DROP TABLE t1,t2,t3;
DROP FUNCTION f1;
+--echo #
+--echo # Bug #48067: A temp table with the same name as an existing table,
+--echo # makes drop database fail.
+--echo #
+--disable_warnings
+DROP TEMPORARY TABLE IF EXISTS bug48067.t1;
+DROP DATABASE IF EXISTS bug48067;
+--enable_warnings
+CREATE DATABASE bug48067;
+CREATE TABLE bug48067.t1 (c1 int);
+INSERT INTO bug48067.t1 values (1);
+CREATE TEMPORARY TABLE bug48067.t1 (c1 int);
+DROP DATABASE bug48067;
+DROP TEMPORARY table bug48067.t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index d865851841f..75099523062 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1405,4 +1405,30 @@ SET @@sql_quote_show_create = @sql_quote_show_create_saved;
--echo # End of Bug#34828.
--echo
+--echo # Make sure we can manipulate with autocommit in the
+--echo # along with other variables.
+
+
+--disable_warnings
+drop table if exists t1;
+drop function if exists t1_max;
+drop function if exists t1_min;
+--enable_warnings
+
+create table t1 (a int) engine=innodb;
+insert into t1(a) values (0), (1);
+create function t1_max() returns int return (select max(a) from t1);
+create function t1_min() returns int return (select min(a) from t1);
+select t1_min();
+select t1_max();
+set @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
+ @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
+ @@session.autocommit=t1_min(), @@session.autocommit=t1_max();
+
+--echo # Cleanup.
+drop table t1;
+drop function t1_min;
+drop function t1_max;
+
+
###########################################################################
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index ae41151a981..49a2e4f6728 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB, 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,9 +11,7 @@
#
# 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
-
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys)
diff --git a/mysys/errors.c b/mysys/errors.c
index 9342ab2d2dd..8bc310652f1 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -49,7 +49,9 @@ const char *globerrs[GLOBERRS]=
"Can't sync file '%s' to disk (Errcode: %d)",
"Collation '%s' is not a compiled collation and is not specified in the '%s' file",
"File '%s' not found (Errcode: %d)",
- "File '%s' (fileno: %d) was not closed"
+ "File '%s' (fileno: %d) was not closed",
+ "Can't change ownership of the file '%s' (Errcode: %d)",
+ "Can't change permissions of the file '%s' (Errcode: %d)",
};
void init_glob_errs(void)
@@ -90,6 +92,8 @@ void init_glob_errs()
EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file";
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
+ EE(EE_CHANGE_OWNERSHIP) = "Can't change ownership of the file '%s' (Errcode: %d)";
+ EE(EE_CHANGE_PERMISSIONS) = "Can't change permissions of the file '%s' (Errcode: %d)";
}
#endif
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index c4bba9c4e72..173b678cdd1 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -454,7 +454,9 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
RETURN
0 we succeeded in reading all data
- 1 Error: can't read requested characters
+ 1 Error: couldn't read requested characters. In this case:
+ If info->error == -1, we got a read error.
+ Otherwise info->error contains the number of bytes in Buffer.
*/
int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
@@ -463,6 +465,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
my_off_t pos_in_file;
DBUG_ENTER("_my_b_read");
+ /* If the buffer is not empty yet, copy what is available. */
if ((left_length= (size_t) (info->read_end-info->read_pos)))
{
DBUG_ASSERT(Count >= left_length); /* User is not using my_b_read() */
@@ -474,7 +477,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
/* pos_in_file always point on where info->buffer was read */
pos_in_file=info->pos_in_file+ (size_t) (info->read_end - info->buffer);
- /*
+ /*
Whenever a function which operates on IO_CACHE flushes/writes
some part of the IO_CACHE to disk it will set the property
"seek_not_done" to indicate this to other functions operating
@@ -501,19 +504,38 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
}
}
+ /*
+ Calculate, how much we are within a IO_SIZE block. Ideally this
+ should be zero.
+ */
diff_length= (size_t) (pos_in_file & (IO_SIZE-1));
+
+ /*
+ If more than a block plus the rest of the current block is wanted,
+ we do read directly, without filling the buffer.
+ */
if (Count >= (size_t) (IO_SIZE+(IO_SIZE-diff_length)))
{ /* Fill first intern buffer */
size_t read_length;
if (info->end_of_file <= pos_in_file)
- { /* End of file */
+ {
+ /* End of file. Return, what we did copy from the buffer. */
info->error= (int) left_length;
DBUG_RETURN(1);
}
+ /*
+ Crop the wanted count to a multiple of IO_SIZE and subtract,
+ what we did already read from a block. That way, the read will
+ end aligned with a block.
+ */
length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
if ((read_length= my_read(info->file,Buffer, length, info->myflags))
!= length)
{
+ /*
+ If we didn't get, what we wanted, we either return -1 for a read
+ error, or (it's end of file), how much we got in total.
+ */
info->error= (read_length == (size_t) -1 ? -1 :
(int) (read_length+left_length));
DBUG_RETURN(1);
@@ -525,15 +547,27 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
diff_length=0;
}
+ /*
+ At this point, we want less than one and a partial block.
+ We will read a full cache, minus the number of bytes, we are
+ within a block already. So we will reach new alignment.
+ */
max_length= info->read_length-diff_length;
+ /* We will not read past end of file. */
if (info->type != READ_FIFO &&
max_length > (info->end_of_file - pos_in_file))
max_length= (size_t) (info->end_of_file - pos_in_file);
+ /*
+ If there is nothing left to read,
+ we either are done, or we failed to fulfill the request.
+ Otherwise, we read max_length into the cache.
+ */
if (!max_length)
{
if (Count)
{
- info->error= left_length; /* We only got this many char */
+ /* We couldn't fulfil the request. Return, how much we got. */
+ info->error= left_length;
DBUG_RETURN(1);
}
length=0; /* Didn't read any chars */
@@ -542,13 +576,23 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
info->myflags)) < Count ||
length == (size_t) -1)
{
+ /*
+ We got an read error, or less than requested (end of file).
+ If not a read error, copy, what we got.
+ */
if (length != (size_t) -1)
memcpy(Buffer, info->buffer, length);
info->pos_in_file= pos_in_file;
+ /* For a read error, return -1, otherwise, what we got in total. */
info->error= length == (size_t) -1 ? -1 : (int) (length+left_length);
info->read_pos=info->read_end=info->buffer;
DBUG_RETURN(1);
}
+ /*
+ Count is the remaining number of bytes requested.
+ length is the amount of data in the cache.
+ Read Count bytes from the cache.
+ */
info->read_pos=info->buffer+Count;
info->read_end=info->buffer+length;
info->pos_in_file=pos_in_file;
@@ -1702,16 +1746,19 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
#endif
-int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
+int my_b_flush_io_cache(IO_CACHE *info,
+ int need_append_buffer_lock __attribute__((unused)))
{
size_t length;
- my_bool append_cache;
my_off_t pos_in_file;
+ my_bool append_cache= (info->type == SEQ_READ_APPEND);
DBUG_ENTER("my_b_flush_io_cache");
DBUG_PRINT("enter", ("cache: 0x%lx", (long) info));
- if (!(append_cache = (info->type == SEQ_READ_APPEND)))
- need_append_buffer_lock=0;
+#ifdef THREAD
+ if (!append_cache)
+ need_append_buffer_lock= 0;
+#endif
if (info->type == WRITE_CACHE || append_cache)
{
diff --git a/mysys/my_copy.c b/mysys/my_copy.c
index 878aebd3684..35324dd4cef 100644
--- a/mysys/my_copy.c
+++ b/mysys/my_copy.c
@@ -16,6 +16,7 @@
#include "mysys_priv.h"
#include <my_dir.h> /* for stat */
#include <m_string.h>
+#include "mysys_err.h"
#if defined(HAVE_UTIME_H)
#include <utime.h>
#elif defined(HAVE_SYS_UTIME_H)
@@ -56,7 +57,6 @@ int my_copy(const char *from, const char *to, myf MyFlags)
File from_file,to_file;
uchar buff[IO_SIZE];
MY_STAT stat_buff,new_stat_buff;
- int res;
DBUG_ENTER("my_copy");
DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
@@ -102,9 +102,23 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
DBUG_RETURN(0); /* File copyed but not stat */
- res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */
+ /* Copy modes */
+ if (chmod(to, stat_buff.st_mode & 07777))
+ {
+ my_errno= errno;
+ if (MyFlags & (MY_FAE+MY_WME))
+ my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno);
+ goto err;
+ }
#if !defined(__WIN__)
- res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */
+ /* Copy ownership */
+ if (chown(to, stat_buff.st_uid, stat_buff.st_gid))
+ {
+ my_errno= errno;
+ if (MyFlags & (MY_FAE+MY_WME))
+ my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno);
+ goto err;
+ }
#endif
if (MyFlags & MY_COPYTIME)
diff --git a/mysys/my_redel.c b/mysys/my_redel.c
index 300bac6e296..92aa6e42073 100644
--- a/mysys/my_redel.c
+++ b/mysys/my_redel.c
@@ -76,11 +76,8 @@ end:
int my_copystat(const char *from, const char *to, int MyFlags)
{
struct stat statbuf;
-#if !defined(__WIN__)
- int res;
-#endif
- if (stat((char*) from, &statbuf))
+ if (stat(from, &statbuf))
{
my_errno=errno;
if (MyFlags & (MY_FAE+MY_WME))
@@ -89,7 +86,15 @@ int my_copystat(const char *from, const char *to, int MyFlags)
}
if ((statbuf.st_mode & S_IFMT) != S_IFREG)
return 1;
- (void) chmod(to, statbuf.st_mode & 07777); /* Copy modes */
+
+ /* Copy modes */
+ if (chmod(to, statbuf.st_mode & 07777))
+ {
+ my_errno= errno;
+ if (MyFlags & (MY_FAE+MY_WME))
+ my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno);
+ return -1;
+ }
#if !defined(__WIN__)
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
@@ -97,7 +102,14 @@ int my_copystat(const char *from, const char *to, int MyFlags)
if (MyFlags & MY_LINK_WARNING)
my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
}
- res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */
+ /* Copy ownership */
+ if (chown(to, statbuf.st_uid, statbuf.st_gid))
+ {
+ my_errno= errno;
+ if (MyFlags & (MY_FAE+MY_WME))
+ my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno);
+ return -1;
+ }
#endif /* !__WIN__ */
if (MyFlags & MY_COPYTIME)
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 9d10ba1fb01..7ba0490cb29 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -107,7 +107,7 @@ my_bool init_thr_lock()
}
static inline my_bool
-thr_lock_owner_equal(THR_LOCK_OWNER *rhs, THR_LOCK_OWNER *lhs)
+thr_lock_owner_equal(THR_LOCK_INFO *rhs, THR_LOCK_INFO *lhs)
{
return rhs == lhs;
}
@@ -122,7 +122,7 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
{
THR_LOCK_DATA *data,**prev;
uint count=0;
- THR_LOCK_OWNER *UNINIT_VAR(first_owner);
+ THR_LOCK_INFO *UNINIT_VAR(first_owner);
prev= &list->data;
if (list->data)
@@ -341,7 +341,6 @@ void thr_lock_info_init(THR_LOCK_INFO *info)
struct st_my_thread_var *tmp= my_thread_var;
info->thread= tmp->pthread_self;
info->thread_id= tmp->id;
- info->n_cursors= 0;
}
/* Initialize a lock instance */
@@ -357,7 +356,7 @@ void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, void *param)
static inline my_bool
-has_old_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner)
+has_old_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner)
{
for ( ; data ; data=data->next)
{
@@ -506,13 +505,12 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
enum enum_thr_lock_result
-thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
+thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner,
enum thr_lock_type lock_type, ulong lock_wait_timeout)
{
THR_LOCK *lock=data->lock;
enum enum_thr_lock_result result= THR_LOCK_SUCCESS;
struct st_lock_list *wait_queue;
- THR_LOCK_DATA *lock_owner;
DBUG_ENTER("thr_lock");
data->next=0;
@@ -521,7 +519,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
data->owner= owner; /* Must be reset ! */
mysql_mutex_lock(&lock->mutex);
DBUG_PRINT("lock",("data: 0x%lx thread: 0x%lx lock: 0x%lx type: %d",
- (long) data, data->owner->info->thread_id,
+ (long) data, data->owner->thread_id,
(long) lock, (int) lock_type));
check_locks(lock,(uint) lock_type <= (uint) TL_READ_NO_INSERT ?
"enter read_lock" : "enter write_lock",0);
@@ -558,7 +556,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
*/
DBUG_PRINT("lock",("write locked 1 by thread: 0x%lx",
- lock->write.data->owner->info->thread_id));
+ lock->write.data->owner->thread_id));
if (thr_lock_owner_equal(data->owner, lock->write.data->owner) ||
(lock->write.data->type <= TL_WRITE_DELAYED &&
(((int) lock_type <= (int) TL_READ_HIGH_PRIORITY) ||
@@ -707,7 +705,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
goto end;
}
DBUG_PRINT("lock",("write locked 2 by thread: 0x%lx",
- lock->write.data->owner->info->thread_id));
+ lock->write.data->owner->thread_id));
}
else
{
@@ -743,23 +741,10 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
}
}
DBUG_PRINT("lock",("write locked 3 by thread: 0x%lx type: %d",
- lock->read.data->owner->info->thread_id, data->type));
+ lock->read.data->owner->thread_id, data->type));
}
wait_queue= &lock->write_wait;
}
- /*
- Try to detect a trivial deadlock when using cursors: attempt to
- lock a table that is already locked by an open cursor within the
- same connection. lock_owner can be zero if we succumbed to a high
- priority writer in the write_wait queue.
- */
- lock_owner= lock->read.data ? lock->read.data : lock->write.data;
- if (lock_owner && lock_owner->owner->info == owner->info)
- {
- DBUG_PRINT("lock",("deadlock"));
- result= THR_LOCK_DEADLOCK;
- goto end;
- }
/* Can't get lock yet; Wait for it */
DBUG_RETURN(wait_for_lock(wait_queue, data, 0, lock_wait_timeout));
end:
@@ -807,7 +792,7 @@ static inline void free_all_read_locks(THR_LOCK *lock,
}
/* purecov: begin inspected */
DBUG_PRINT("lock",("giving read lock to thread: 0x%lx",
- data->owner->info->thread_id));
+ data->owner->thread_id));
/* purecov: end */
data->cond=0; /* Mark thread free */
mysql_cond_signal(cond);
@@ -826,7 +811,7 @@ void thr_unlock(THR_LOCK_DATA *data)
enum thr_lock_type lock_type=data->type;
DBUG_ENTER("thr_unlock");
DBUG_PRINT("lock",("data: 0x%lx thread: 0x%lx lock: 0x%lx",
- (long) data, data->owner->info->thread_id, (long) lock));
+ (long) data, data->owner->thread_id, (long) lock));
mysql_mutex_lock(&lock->mutex);
check_locks(lock,"start of release lock",0);
@@ -915,7 +900,7 @@ static void wake_up_waiters(THR_LOCK *lock)
data->type=TL_WRITE; /* Upgrade lock */
/* purecov: begin inspected */
DBUG_PRINT("lock",("giving write lock of type %d to thread: 0x%lx",
- data->type, data->owner->info->thread_id));
+ data->type, data->owner->thread_id));
/* purecov: end */
{
mysql_cond_t *cond= data->cond;
@@ -1020,7 +1005,7 @@ static void sort_locks(THR_LOCK_DATA **data,uint count)
enum enum_thr_lock_result
-thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_OWNER *owner,
+thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_INFO *owner,
ulong lock_wait_timeout)
{
THR_LOCK_DATA **pos,**end;
@@ -1144,7 +1129,7 @@ void thr_multi_unlock(THR_LOCK_DATA **data,uint count)
else
{
DBUG_PRINT("lock",("Free lock: data: 0x%lx thread: 0x%lx lock: 0x%lx",
- (long) *pos, (*pos)->owner->info->thread_id,
+ (long) *pos, (*pos)->owner->thread_id,
(long) (*pos)->lock));
}
}
@@ -1200,7 +1185,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread_id)
mysql_mutex_lock(&lock->mutex);
for (data= lock->read_wait.data; data ; data= data->next)
{
- if (data->owner->info->thread_id == thread_id) /* purecov: tested */
+ if (data->owner->thread_id == thread_id) /* purecov: tested */
{
DBUG_PRINT("info",("Aborting read-wait lock"));
data->type= TL_UNLOCK; /* Mark killed */
@@ -1217,7 +1202,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread_id)
}
for (data= lock->write_wait.data; data ; data= data->next)
{
- if (data->owner->info->thread_id == thread_id) /* purecov: tested */
+ if (data->owner->thread_id == thread_id) /* purecov: tested */
{
DBUG_PRINT("info",("Aborting write-wait lock"));
data->type= TL_UNLOCK;
@@ -1387,7 +1372,7 @@ static void thr_print_lock(const char* name,struct st_lock_list *list)
prev= &list->data;
for (data=list->data; data && count++ < MAX_LOCKS ; data=data->next)
{
- printf("0x%lx (%lu:%d); ", (ulong) data, data->owner->info->thread_id,
+ printf("0x%lx (%lu:%d); ", (ulong) data, data->owner->thread_id,
(int) data->type);
if (data->prev != prev)
printf("\nWarning: prev didn't point at previous lock\n");
@@ -1525,7 +1510,6 @@ static void *test_thread(void *arg)
{
int i,j,param=*((int*) arg);
THR_LOCK_DATA data[MAX_LOCK_COUNT];
- THR_LOCK_OWNER owner;
THR_LOCK_INFO lock_info;
THR_LOCK_DATA *multi_locks[MAX_LOCK_COUNT];
my_thread_init();
@@ -1534,7 +1518,6 @@ static void *test_thread(void *arg)
thr_lock_info_init(&lock_info);
- thr_lock_owner_init(&owner, &lock_info);
for (i=0; i < lock_counts[param] ; i++)
thr_lock_data_init(locks+tests[param][i].lock_nr,data+i,NULL);
for (j=1 ; j < 10 ; j++) /* try locking 10 times */
@@ -1544,7 +1527,7 @@ static void *test_thread(void *arg)
multi_locks[i]= &data[i];
data[i].type= tests[param][i].lock_type;
}
- thr_multi_lock(multi_locks, lock_counts[param], &owner, TEST_TIMEOUT);
+ thr_multi_lock(multi_locks, lock_counts[param], &lock_info, TEST_TIMEOUT);
mysql_mutex_lock(&LOCK_thread_count);
{
int tmp=rand() & 7; /* Do something from 0-2 sec */
diff --git a/plugin/audit_null/CMakeLists.txt b/plugin/audit_null/CMakeLists.txt
index 4baa1da35fe..b88c4922f60 100644
--- a/plugin/audit_null/CMakeLists.txt
+++ b/plugin/audit_null/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2010 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MYSQL_ADD_PLUGIN(audit_null audit_null.c
MODULE_ONLY MODULE_OUTPUT_NAME "adt_null")
diff --git a/plugin/audit_null/audit_null.c b/plugin/audit_null/audit_null.c
index e0c53ed0f19..4d231d3e39b 100644
--- a/plugin/audit_null/audit_null.c
+++ b/plugin/audit_null/audit_null.c
@@ -144,7 +144,7 @@ mysql_declare_plugin(audit_null)
MYSQL_AUDIT_PLUGIN, /* type */
&audit_null_descriptor, /* descriptor */
"NULL_AUDIT", /* name */
- "MySQL AB", /* author */
+ "Oracle Corp", /* author */
"Simple NULL Audit", /* description */
PLUGIN_LICENSE_GPL,
audit_null_plugin_init, /* init function (when loaded) */
diff --git a/plugin/daemon_example/CMakeLists.txt b/plugin/daemon_example/CMakeLists.txt
index de4310b0244..60aa00687ba 100644
--- a/plugin/daemon_example/CMakeLists.txt
+++ b/plugin/daemon_example/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MYSQL_ADD_PLUGIN(daemon_example daemon_example.cc
MODULE_ONLY MODULE_OUTPUT_NAME "libdaemon_example")
diff --git a/plugin/fulltext/CMakeLists.txt b/plugin/fulltext/CMakeLists.txt
index 394cb8dc51d..305ae7fe143 100644
--- a/plugin/fulltext/CMakeLists.txt
+++ b/plugin/fulltext/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MYSQL_ADD_PLUGIN(ftexample plugin_example.c
MODULE_ONLY MODULE_OUTPUT_NAME "mypluglib")
diff --git a/plugin/semisync/CMakeLists.txt b/plugin/semisync/CMakeLists.txt
index 2ebd67292f3..f1ada507f4f 100644
--- a/plugin/semisync/CMakeLists.txt
+++ b/plugin/semisync/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems,Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,9 +11,7 @@
#
# 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
-
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(SEMISYNC_MASTER_SOURCES
semisync.cc semisync_master.cc semisync_master_plugin.cc
diff --git a/regex/CMakeLists.txt b/regex/CMakeLists.txt
index 02132eefaad..83c13015671 100644
--- a/regex/CMakeLists.txt
+++ b/regex/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
diff --git a/regex/engine.c b/regex/engine.c
index 1968ca61a96..be08adf8601 100644
--- a/regex/engine.c
+++ b/regex/engine.c
@@ -256,7 +256,6 @@ sopno stopst;
register char *ssp; /* start of string matched by subsubRE */
register char *sep; /* end of string matched by subsubRE */
register char *oldssp; /* previous ssp */
- register char *dp; /* used in debug mode to check asserts */
AT("diss", start, stop, startst, stopst);
sp = start;
@@ -314,11 +313,9 @@ sopno stopst;
ssub = ss + 1;
esub = es - 1;
/* did innards match? */
- if (slow(charset, m, sp, rest, ssub, esub) != NULL) {
- dp = dissect(charset, m, sp, rest, ssub, esub);
- assert(dp == rest);
- } else /* no */
- assert(sp == rest);
+ if (slow(charset, m, sp, rest, ssub, esub) != NULL)
+ sp = dissect(charset, m, sp, rest, ssub, esub);
+ assert(sp == rest);
sp = rest;
break;
case OPLUS_:
@@ -353,8 +350,8 @@ sopno stopst;
}
assert(sep == rest); /* must exhaust substring */
assert(slow(charset, m, ssp, sep, ssub, esub) == rest);
- dp = dissect(charset, m, ssp, sep, ssub, esub);
- assert(dp == sep);
+ sp = dissect(charset, m, ssp, sep, ssub, esub);
+ assert(sp == sep);
sp = rest;
break;
case OCH_:
@@ -388,8 +385,8 @@ sopno stopst;
else
assert(OP(m->g->strip[esub]) == O_CH);
}
- dp = dissect(charset, m, sp, rest, ssub, esub);
- assert(dp == rest);
+ sp = dissect(charset, m, sp, rest, ssub, esub);
+ assert(sp == rest);
sp = rest;
break;
case O_PLUS:
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index ced207da98b..c7eafac2781 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Build comp_sql - used for embedding SQL in C or C++ programs
IF(NOT CMAKE_CROSSCOMPILING)
@@ -24,6 +23,7 @@ ENDIF()
# Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts)
IF(NOT WIN32 OR CMAKE_CROSSCOMPILING)
FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable")
+ MARK_AS_ADVANCED(CAT_EXECUTABLE)
ENDIF()
IF(CAT_EXECUTABLE)
@@ -251,43 +251,40 @@ IF(POLICY CMP0007)
CMAKE_POLICY(SET CMP0007 OLD)
ENDIF()
-LIST(REMOVE_ITEM mysqlclient_LIB_DEPENDS "")
-LIST(REMOVE_DUPLICATES mysqlclient_LIB_DEPENDS)
-FOREACH(lib ${mysqlclient_LIB_DEPENDS})
- # Filter out "general", it is not a library, just CMake hint
- IF(NOT lib STREQUAL "general" AND NOT CLIENT_LIBS MATCHES "-l${lib} ")
- IF (lib MATCHES "^\\-l")
- SET(CLIENT_LIBS "${CLIENT_LIBS} ${lib} ")
- ELSEIF(lib MATCHES "^/")
- # Full path, convert to just filename, strip "lib" prefix and extension
- GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
- STRING(REGEX REPLACE "^lib" "" lib "${lib}")
- SET(CLIENT_LIBS "${CLIENT_LIBS}-l${lib} " )
- ELSE()
- SET(CLIENT_LIBS "${CLIENT_LIBS}-l${lib} " )
- ENDIF()
+# Extract dependencies using CMake's internal ${target}_LIB_DEPENDS variable
+# returned string in ${var} is can be passed to linker's command line
+MACRO(EXTRACT_LINK_LIBRARIES target var)
+ IF(${target}_LIB_DEPENDS)
+ LIST(REMOVE_ITEM ${target}_LIB_DEPENDS "")
+ LIST(REMOVE_DUPLICATES ${target}_LIB_DEPENDS)
+ FOREACH(lib ${${target}_LIB_DEPENDS})
+ # Filter out "general", it is not a library, just CMake hint
+ # Also, remove duplicates
+ IF(NOT lib STREQUAL "general" AND NOT ${var} MATCHES "-l${lib} ")
+ IF (lib MATCHES "^\\-l")
+ SET(${var} "${${var}} ${lib} ")
+ ELSEIF(lib MATCHES "^/")
+ # Full path, convert to just filename, strip "lib" prefix and extension
+ GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
+ STRING(REGEX REPLACE "^lib" "" lib "${lib}")
+ SET(${var} "${${var}}-l${lib} " )
+ ELSE()
+ SET(${var} "${${var}}-l${lib} " )
+ ENDIF()
+ ENDIF()
+ ENDFOREACH()
ENDIF()
-ENDFOREACH()
-
-
-IF(LIBDL AND NOT LIBDL MATCHES "-l")
- SET(LIBDL "-l${LIBDL}")
-ENDIF()
-
-IF(LIBWRAP)
- SET(WRAPLIBS "-lwrap")
-ENDIF()
+ IF(MSVC)
+ STRING(REPLACE "-l" "" ${var} "${${var}}")
+ ENDIF()
+ENDMACRO()
-SET(LIBS "${CLIENT_LIBS}")
+EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS)
+EXTRACT_LINK_LIBRARIES(mysqlserver LIBS)
-IF(LIBCRYPT)
- SET(LIBS "${LIBS} -l${LIBCRYPT}")
-ENDIF()
-
-IF(MSVC)
- STRING(REPLACE "-l" "" CLIENT_LIBS "${CLIENT_LIBS}")
- STRING(REPLACE "-l" "" LIBS "${LIBS}" )
-ENDIF()
+# mysql_config evaluates ${LIBDL}, we want to avoid it
+# as our CLIENT_LIBS and LIBS are already correct
+SET(LIBDL)
SET(NON_THREADED_LIBS ${CLIENT_LIBS})
SET(mysql_config_COMPONENT COMPONENT Development)
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index 10755fc698b..69ec88d6724 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -108,7 +108,7 @@ fi
# We intentionally add a space to the beginning and end of lib strings, simplifies replace later
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
-libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
+libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @CLIENT_LIBS@ @openssl_libs@ "
embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @openssl_libs@ "
if [ -r "$pkglibdir/libmygcc.a" ]; then
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index b5ee4d6dd41..dd620b80475 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/sql-bench/CMakeLists.txt b/sql-bench/CMakeLists.txt
index be0aeca70b0..f8be18c6653 100644
--- a/sql-bench/CMakeLists.txt
+++ b/sql-bench/CMakeLists.txt
@@ -1,25 +1,19 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Install sql-bench files
-FILE(GLOB all_files
-${CMAKE_SOURCE_DIR}/sql-bench/*
-${CMAKE_SOURCE_DIR}/sql-bench/Data/ATIS/*
-${CMAKE_SOURCE_DIR}/sql-bench/Data/Wisconsin/*
-${CMAKE_SOURCE_DIR}/sql-bench/limits/*
-)
IF(NOT INSTALL_SQLBENCHDIR)
RETURN()
@@ -31,30 +25,39 @@ ELSE()
SET(prefix ${INSTALL_SQLBENCHDIR}/)
ENDIF()
-GET_FILENAME_COMPONENT(basedir ${CMAKE_SOURCE_DIR} ABSOLUTE)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Data/ATIS
+ DESTINATION ${prefix}sql-bench/Data)
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Data/Wisconsin
+ DESTINATION ${prefix}sql-bench/Data)
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/limits
+ DESTINATION ${prefix}sql-bench)
+
+FILE(GLOB all_files ${CMAKE_CURRENT_SOURCE_DIR}/*)
+
FOREACH(file ${all_files})
IF(NOT IS_DIRECTORY ${file} AND NOT ${file} MATCHES "Make|as3ap|/example$" )
- FILE(RELATIVE_PATH relpath ${basedir} ${file})
- SET(target_relpath ${relpath})
GET_FILENAME_COMPONENT(ext ${file} EXT)
- GET_FILENAME_COMPONENT(dir ${relpath} PATH)
+ GET_FILENAME_COMPONENT(name ${file} NAME)
+ SET(target ${name})
IF(ext MATCHES ".sh$")
# Those are perl files actually
- STRING(REPLACE ".sh" "" target_relpath ${target_relpath} )
+ STRING(REPLACE ".sh" "" target ${target} )
IF(WIN32)
IF(NOT ext MATCHES ".pl")
- SET(target_relpath "${target_relpath}.pl")
+ SET(target "${target}.pl")
ENDIF()
ENDIF()
ENDIF()
- SET(target "${CMAKE_BINARY_DIR}/${target_relpath}")
+ SET(target "${CMAKE_CURRENT_BINARY_DIR}/${target}")
CONFIGURE_FILE(${file} ${target} COPYONLY)
IF (ext MATCHES ".bat")
IF(WIN32)
- INSTALL(FILES ${target} DESTINATION ${prefix}${dir})
+ INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
ENDIF()
ELSE()
- INSTALL(FILES ${target} DESTINATION ${prefix}${dir})
+ INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
ENDIF()
ENDIF()
ENDFOREACH()
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index e8a594c4d8b..0fb203ed0fb 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
@@ -42,7 +41,6 @@ SET (SQL_SOURCE
../sql-common/client.c derror.cc des_key_file.cc
discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
filesort.cc gstream.cc sha2.cc
- ha_partition.cc
handler.cc hash_filo.h sql_plugin_services.h
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
item_create.cc item_func.cc item_geofunc.cc item_row.cc
@@ -72,9 +70,9 @@ 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
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE})
@@ -83,6 +81,7 @@ MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY
RECOMPILE_FOR_EMBEDDED)
ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
+ADD_DEPENDENCIES(sql GenServerSource)
DTRACE_INSTRUMENT(sql)
TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
mysys dbug strings vio regex
@@ -189,6 +188,7 @@ ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
COMMAND gen_lex_hash > lex_hash.h
+ DEPENDS gen_lex_hash
)
MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc)
@@ -266,18 +266,20 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
ENDIF()
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data)
ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm
+ OUTPUT initdb.dep
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}
DEPENDS mysqld
)
ADD_CUSTOM_TARGET(initial_database
ALL
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm
+ DEPENDS initdb.dep
)
- INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION . COMPONENT DataFiles
- PATTERN "bootstrap.sql" EXCLUDE)
+ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
+ COMPONENT DataFiles PATTERN "initdb.dep" EXCLUDE PATTERN "bootstrap.sql" EXCLUDE)
ELSE()
# Not windows or cross compiling, just install an empty directory
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql)
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 7fed55f3cd6..4fb7bfe919c 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -122,11 +122,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 datadict.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \
@@ -143,7 +143,8 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.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 +172,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
diff --git a/sql/datadict.cc b/sql/datadict.cc
index 33c3b6bc700..362435a94db 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;
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_data_objects.cc b/sql/event_data_objects.cc
index dd1845b29bc..52c509621ac 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1402,6 +1402,8 @@ Event_job_data::execute(THD *thd, bool drop)
*/
thd->set_db(dbname.str, dbname.length);
+ lex_start(thd);
+
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (event_sctx.change_security_context(thd,
&definer_user, &definer_host,
@@ -1411,7 +1413,7 @@ Event_job_data::execute(THD *thd, bool drop)
"[%s].[%s.%s] execution failed, "
"failed to authenticate the user.",
definer.str, dbname.str, name.str);
- goto end_no_lex_start;
+ goto end;
}
#endif
@@ -1427,11 +1429,11 @@ Event_job_data::execute(THD *thd, bool drop)
"[%s].[%s.%s] execution failed, "
"user no longer has EVENT privilege.",
definer.str, dbname.str, name.str);
- goto end_no_lex_start;
+ goto end;
}
if (construct_sp_sql(thd, &sp_sql))
- goto end_no_lex_start;
+ goto end;
/*
Set up global thread attributes to reflect the properties of
@@ -1451,8 +1453,6 @@ Event_job_data::execute(THD *thd, bool drop)
if (parser_state.init(thd, thd->query(), thd->query_length()))
goto end;
- lex_start(thd);
-
if (parse_sql(thd, & parser_state, creation_ctx))
{
sql_print_error("Event Scheduler: "
@@ -1484,13 +1484,6 @@ Event_job_data::execute(THD *thd, bool drop)
}
end:
- if (thd->lex->sphead) /* NULL only if a parse error */
- {
- delete thd->lex->sphead;
- thd->lex->sphead= NULL;
- }
-
-end_no_lex_start:
if (drop && !thd->is_fatal_error)
{
/*
@@ -1529,7 +1522,6 @@ end_no_lex_start:
if (save_sctx)
event_sctx.restore_security_context(thd, save_sctx);
#endif
- lex_end(thd->lex);
thd->lex->unit.cleanup();
thd->end_statement();
thd->cleanup_after_query();
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index b7c01f10066..d47f1641bb0 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -518,17 +518,20 @@ Event_db_repository::table_scan_all_for_i_s(THD *thd, TABLE *schema_table,
*/
bool
-Event_db_repository::fill_schema_events(THD *thd, TABLE_LIST *tables,
+Event_db_repository::fill_schema_events(THD *thd, TABLE_LIST *i_s_table,
const char *db)
{
- TABLE *schema_table= tables->table;
- TABLE *event_table= NULL;
+ TABLE *schema_table= i_s_table->table;
+ Open_tables_backup open_tables_backup;
+ TABLE_LIST event_table;
int ret= 0;
DBUG_ENTER("Event_db_repository::fill_schema_events");
DBUG_PRINT("info",("db=%s", db? db:"(null)"));
- if (open_event_table(thd, TL_READ, &event_table))
+ event_table.init_one_table("mysql", 5, "event", 5, "event", TL_READ);
+
+ if (open_system_tables_for_read(thd, &event_table, &open_tables_backup))
DBUG_RETURN(TRUE);
/*
@@ -541,11 +544,11 @@ Event_db_repository::fill_schema_events(THD *thd, TABLE_LIST *tables,
every single row's `db` with the schema which we show.
*/
if (db)
- ret= index_read_for_db_for_i_s(thd, schema_table, event_table, db);
+ ret= index_read_for_db_for_i_s(thd, schema_table, event_table.table, db);
else
- ret= table_scan_all_for_i_s(thd, schema_table, event_table);
+ ret= table_scan_all_for_i_s(thd, schema_table, event_table.table);
- close_thread_tables(thd);
+ close_system_tables(thd, &open_tables_backup);
DBUG_PRINT("info", ("Return code=%d", ret));
DBUG_RETURN(ret);
@@ -584,10 +587,7 @@ Event_db_repository::open_event_table(THD *thd, enum thr_lock_type lock_type,
tables.init_one_table("mysql", 5, "event", 5, "event", lock_type);
if (open_and_lock_tables(thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
- {
- close_thread_tables(thd);
DBUG_RETURN(TRUE);
- }
*table= tables.table;
tables.table->use_all_columns();
@@ -700,7 +700,8 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
end:
if (table)
- close_thread_tables(thd);
+ close_mysql_tables(thd);
+
thd->variables.sql_mode= saved_mode;
DBUG_RETURN(test(ret));
}
@@ -811,7 +812,8 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
end:
if (table)
- close_thread_tables(thd);
+ close_mysql_tables(thd);
+
thd->variables.sql_mode= saved_mode;
DBUG_RETURN(test(ret));
}
@@ -865,7 +867,7 @@ Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name,
end:
if (table)
- close_thread_tables(thd);
+ close_mysql_tables(thd);
DBUG_RETURN(test(ret));
}
@@ -934,33 +936,13 @@ Event_db_repository::find_named_event(LEX_STRING db, LEX_STRING name,
void
Event_db_repository::drop_schema_events(THD *thd, LEX_STRING schema)
{
- DBUG_ENTER("Event_db_repository::drop_schema_events");
- drop_events_by_field(thd, ET_FIELD_DB, schema);
- DBUG_VOID_RETURN;
-}
-
-
-/**
- Drops all events which have a specific value of a field.
-
- @pre The thread handle has no open tables.
-
- @param[in,out] thd Thread
- @param[in,out] table mysql.event TABLE
- @param[in] field Which field of the row to use for matching
- @param[in] field_value The value that should match
-*/
-
-void
-Event_db_repository::drop_events_by_field(THD *thd,
- enum enum_events_table_field field,
- LEX_STRING field_value)
-{
int ret= 0;
TABLE *table= NULL;
READ_RECORD read_record_info;
- DBUG_ENTER("Event_db_repository::drop_events_by_field");
- DBUG_PRINT("enter", ("field=%d field_value=%s", field, field_value.str));
+ enum enum_events_table_field field= ET_FIELD_DB;
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ DBUG_ENTER("Event_db_repository::drop_schema_events");
+ DBUG_PRINT("enter", ("field=%d schema=%s", field, schema.str));
if (open_event_table(thd, TL_WRITE, &table))
DBUG_VOID_RETURN;
@@ -979,7 +961,7 @@ Event_db_repository::drop_events_by_field(THD *thd,
get_field(thd->mem_root,
table->field[ET_FIELD_NAME])));
- if (!sortcmp_lex_string(et_field_lex, field_value, system_charset_info))
+ if (!sortcmp_lex_string(et_field_lex, schema, system_charset_info))
{
DBUG_PRINT("info", ("Dropping"));
if ((ret= table->file->ha_delete_row(table->record[0])))
@@ -989,6 +971,11 @@ Event_db_repository::drop_events_by_field(THD *thd,
}
end_read_record(&read_record_info);
close_thread_tables(thd);
+ /*
+ Make sure to only release the MDL lock on mysql.event, not other
+ metadata locks DROP DATABASE might have acquired.
+ */
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
DBUG_VOID_RETURN;
}
@@ -1026,7 +1013,7 @@ Event_db_repository::load_named_event(THD *thd, LEX_STRING dbname,
else if ((ret= etn->load_from_row(thd, table)))
my_error(ER_CANNOT_LOAD_FROM_TABLE, MYF(0), "event");
- close_thread_tables(thd);
+ close_mysql_tables(thd);
}
thd->variables.sql_mode= saved_mode;
@@ -1104,7 +1091,8 @@ update_timing_fields_for_event(THD *thd,
end:
if (table)
- close_thread_tables(thd);
+ close_mysql_tables(thd);
+
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -1151,7 +1139,7 @@ Event_db_repository::check_system_tables(THD *thd)
if (table_intact.check(tables.table, &mysql_db_table_def))
ret= 1;
- close_thread_tables(thd);
+ close_mysql_tables(thd);
}
/* Check mysql.user */
tables.init_one_table("mysql", 5, "user", 4, "user", TL_READ);
@@ -1171,7 +1159,7 @@ Event_db_repository::check_system_tables(THD *thd)
event_priv_column_position);
ret= 1;
}
- close_thread_tables(thd);
+ close_mysql_tables(thd);
}
/* Check mysql.event */
tables.init_one_table("mysql", 5, "event", 5, "event", TL_READ);
@@ -1185,7 +1173,7 @@ Event_db_repository::check_system_tables(THD *thd)
{
if (table_intact.check(tables.table, &event_table_def))
ret= 1;
- close_thread_tables(thd);
+ close_mysql_tables(thd);
}
DBUG_RETURN(test(ret));
diff --git a/sql/event_db_repository.h b/sql/event_db_repository.h
index ef778407d1e..ea7f3bbac0e 100644
--- a/sql/event_db_repository.h
+++ b/sql/event_db_repository.h
@@ -91,7 +91,7 @@ public:
bool
load_named_event(THD *thd, LEX_STRING dbname, LEX_STRING name, Event_basic *et);
- bool
+ static bool
open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table);
bool
@@ -109,9 +109,6 @@ public:
static bool
check_system_tables(THD *thd);
private:
- void
- drop_events_by_field(THD *thd, enum enum_events_table_field field,
- LEX_STRING field_value);
bool
index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, TABLE *event_table,
const char *db);
diff --git a/sql/events.cc b/sql/events.cc
index a548bda53e2..5379ec2c9eb 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -16,7 +16,7 @@
#include "sql_priv.h"
#include "unireg.h"
#include "sql_parse.h" // check_access
-#include "sql_base.h" // close_thread_tables
+#include "sql_base.h" // close_mysql_tables
#include "sql_show.h" // append_definer
#include "events.h"
#include "sql_db.h" // check_db_dir_existence
@@ -754,7 +754,6 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
{
char *db= NULL;
int ret;
- Open_tables_backup open_tables_backup;
DBUG_ENTER("Events::fill_schema_events");
if (check_if_system_tables_error())
@@ -773,15 +772,7 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
DBUG_RETURN(1);
db= thd->lex->select_lex.db;
}
- /*
- Reset and backup of the currently open tables in this thread
- is a way to allow SELECTs from INFORMATION_SCHEMA.events under
- LOCK TABLES and in pre-locked mode. See also
- Events::show_create_event for additional comments.
- */
- thd->reset_n_backup_open_tables_state(&open_tables_backup);
ret= db_repository->fill_schema_events(thd, tables, db);
- thd->restore_backup_open_tables_state(&open_tables_backup);
DBUG_RETURN(ret);
}
@@ -1161,8 +1152,7 @@ Events::load_events_from_db(THD *thd)
end:
end_read_record(&read_record_info);
- close_thread_tables(thd);
-
+ close_mysql_tables(thd);
DBUG_RETURN(ret);
}
diff --git a/sql/examples/CMakeLists.txt b/sql/examples/CMakeLists.txt
index 3c5cc23ec3b..abe4de402bf 100644
--- a/sql/examples/CMakeLists.txt
+++ b/sql/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFE_MUTEX")
diff --git a/sql/field.cc b/sql/field.cc
index 75576c59876..3c93ffadac5 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5446,7 +5446,6 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
int Field_date::store(double nr)
{
longlong tmp;
- int error= 0;
if (nr >= 19000000000000.0 && nr <= 99991231235959.0)
nr=floor(nr/1000000.0); // Timestamp to date
if (nr < 0.0 || nr > 99991231.0)
@@ -5455,7 +5454,6 @@ int Field_date::store(double nr)
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DATA_OUT_OF_RANGE,
nr, MYSQL_TIMESTAMP_DATE);
- error= 1;
}
else
tmp= (longlong) rint(nr);
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index ecf2984a4c0..d4a98265c49 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -36,6 +36,7 @@
#include "discover.h" // readfrm
#include "sql_acl.h" // wild_case_compare
#include "rpl_mi.h"
+#include "transaction.h"
/*
There is an incompatibility between GNU ar and the Solaris linker
@@ -7417,7 +7418,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
FALSE, /* drop_temporary */
FALSE, /* drop_view */
TRUE /* dont_log_query*/);
-
+ trans_commit_implicit(thd); /* Safety, should be unnecessary. */
+ thd->mdl_context.release_transactional_locks();
/* Clear error message that is returned when table is deleted */
thd->clear_error();
}
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index 4f8bb66fcb0..26fdb8e1425 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -36,6 +36,7 @@
#include "lock.h" // MYSQL_LOCK_IGNORE_FLUSH,
// mysql_unlock_tables
#include "sql_parse.h" // mysql_parse
+#include "transaction.h"
#ifdef ndb_dynamite
#undef assert
@@ -298,13 +299,6 @@ static void run_query(THD *thd, char *buf, char *end,
thd_ndb->m_error_code,
(int) thd->is_error(), thd->is_slave_error);
}
-
- /*
- After executing statement we should unlock and close tables open
- by it as well as release meta-data locks obtained by it.
- */
- close_thread_tables(thd);
-
/*
XXX: this code is broken. mysql_parse()/mysql_reset_thd_for_next_command()
can not be called from within a statement, and
@@ -2422,7 +2416,11 @@ int ndb_add_ndb_binlog_index(THD *thd, void *_row)
}
add_ndb_binlog_index_err:
+ thd->stmt_da->can_overwrite_status= TRUE;
+ thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
+ thd->stmt_da->can_overwrite_status= FALSE;
close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
ndb_binlog_index= 0;
thd->variables.option_bits= saved_options;
return error;
@@ -3969,7 +3967,9 @@ restart:
{
if (ndb_binlog_index->s->needs_reopen())
{
+ trans_commit_stmt(thd);
close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
ndb_binlog_index= 0;
}
}
@@ -4280,7 +4280,9 @@ restart:
if (do_ndbcluster_binlog_close_connection == BCCC_restart)
{
ndb_binlog_tables_inited= FALSE;
+ trans_commit_stmt(thd);
close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
ndb_binlog_index= 0;
goto restart;
}
@@ -4288,7 +4290,11 @@ err:
sql_print_information("Stopping Cluster Binlog");
DBUG_PRINT("info",("Shutting down cluster binlog thread"));
thd->proc_info= "Shutting down";
+ thd->stmt_da->can_overwrite_status= TRUE;
+ thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
+ thd->stmt_da->can_overwrite_status= FALSE;
close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
mysql_mutex_lock(&injector_mutex);
/* don't mess with the injector_ndb anymore from other threads */
injector_thd= 0;
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/handler.cc b/sql/handler.cc
index efbc335f9b2..9893b3cac16 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1132,6 +1132,7 @@ int ha_commit_trans(THD *thd, bool all)
if (thd->in_sub_stmt)
{
+ DBUG_ASSERT(0);
/*
Since we don't support nested statement transactions in 5.0,
we can't commit or rollback stmt transactions while we are inside
@@ -1146,7 +1147,6 @@ int ha_commit_trans(THD *thd, bool all)
bail out with error even before ha_commit_trans() call. To be 100% safe
let us throw error in non-debug builds.
*/
- DBUG_ASSERT(0);
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(2);
}
@@ -1329,6 +1329,7 @@ int ha_rollback_trans(THD *thd, bool all)
if (thd->in_sub_stmt)
{
+ DBUG_ASSERT(0);
/*
If we are inside stored function or trigger we should not commit or
rollback current statement transaction. See comment in ha_commit_trans()
@@ -1336,7 +1337,6 @@ int ha_rollback_trans(THD *thd, bool all)
*/
if (!all)
DBUG_RETURN(0);
- DBUG_ASSERT(0);
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(1);
}
diff --git a/sql/handler.h b/sql/handler.h
index a7951ddf781..cad97c1f751 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -842,6 +842,7 @@ struct THD_TRANS
bool modified_non_trans_table;
void reset() { no_2pc= FALSE; modified_non_trans_table= FALSE; }
+ bool is_empty() const { return ha_list == NULL; }
};
diff --git a/sql/item.cc b/sql/item.cc
index 92cf2df8a4c..24f57342668 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -301,11 +301,10 @@ my_decimal *Item::val_decimal_from_int(my_decimal *decimal_value)
my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
{
String *res;
- char *end_ptr;
+
if (!(res= val_str(&str_value)))
- return 0; // NULL or EOM
+ return NULL;
- end_ptr= (char*) res->ptr()+ res->length();
if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
res->ptr(), res->length(), res->charset(),
decimal_value) & E_DEC_BAD_NUM)
@@ -5932,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
@@ -7511,13 +7511,13 @@ String *Item_cache_datetime::val_str(String *str)
if (cached_field_type == MYSQL_TYPE_TIME)
{
ulonglong time= int_value;
- DBUG_ASSERT(time < TIME_MAX_VALUE);
+ DBUG_ASSERT(time <= TIME_MAX_VALUE);
set_zero_time(&ltime, MYSQL_TIMESTAMP_TIME);
ltime.second= time % 100;
time/= 100;
ltime.minute= time % 100;
time/= 100;
- ltime.hour= time % 100;
+ ltime.hour= time;
}
else
{
diff --git a/sql/item.h b/sql/item.h
index c7a97ca716a..d1957c46d25 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3266,6 +3266,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 +3341,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/lock.cc b/sql/lock.cc
index 0743120ec6b..1a77b576e67 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -313,7 +313,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, uint flags)
rc= thr_lock_errno_to_mysql[(int) thr_multi_lock(sql_lock->locks +
sql_lock->lock_count,
sql_lock->lock_count,
- thd->lock_id, timeout)];
+ &thd->lock_info, timeout)];
if (rc)
{
if (sql_lock->table_count)
@@ -627,110 +627,6 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b)
}
-/**
- Find duplicate lock in tables.
-
- Temporary tables are ignored here like they are ignored in
- get_lock_data(). If we allow two opens on temporary tables later,
- both functions should be checked.
-
- @param thd The current thread.
- @param needle The table to check for duplicate lock.
- @param haystack The list of tables to search for the dup lock.
-
- @note
- This is mainly meant for MERGE tables in INSERT ... SELECT
- situations. The 'real', underlying tables can be found only after
- the MERGE tables are opened. This function assumes that the tables are
- already locked.
-
- @retval
- NULL No duplicate lock found.
- @retval
- !NULL First table from 'haystack' that matches a lock on 'needle'.
-*/
-
-TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
- TABLE_LIST *haystack)
-{
- MYSQL_LOCK *mylock;
- TABLE **lock_tables;
- TABLE *table;
- TABLE *table2;
- THR_LOCK_DATA **lock_locks;
- THR_LOCK_DATA **table_lock_data;
- THR_LOCK_DATA **end_data;
- THR_LOCK_DATA **lock_data2;
- THR_LOCK_DATA **end_data2;
- DBUG_ENTER("mysql_lock_have_duplicate");
-
- /*
- Table may not be defined for derived or view tables.
- Table may not be part of a lock for delayed operations.
- */
- if (! (table= needle->table) || ! table->lock_count)
- goto end;
-
- /* A temporary table does not have locks. */
- if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
- goto end;
-
- /* Get command lock or LOCK TABLES lock. Maybe empty for INSERT DELAYED. */
- if (! (mylock= thd->lock))
- goto end;
-
- /* If we have less than two tables, we cannot have duplicates. */
- if (mylock->table_count < 2)
- goto end;
-
- lock_locks= mylock->locks;
- lock_tables= mylock->table;
-
- /* Prepare table related variables that don't change in loop. */
- DBUG_ASSERT((table->lock_position < mylock->table_count) &&
- (table == lock_tables[table->lock_position]));
- table_lock_data= lock_locks + table->lock_data_start;
- end_data= table_lock_data + table->lock_count;
-
- for (; haystack; haystack= haystack->next_global)
- {
- if (haystack->placeholder())
- continue;
- table2= haystack->table;
- if (table2->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
- continue;
-
- /* All tables in list must be in lock. */
- DBUG_ASSERT((table2->lock_position < mylock->table_count) &&
- (table2 == lock_tables[table2->lock_position]));
-
- for (lock_data2= lock_locks + table2->lock_data_start,
- end_data2= lock_data2 + table2->lock_count;
- lock_data2 < end_data2;
- lock_data2++)
- {
- THR_LOCK_DATA **lock_data;
- THR_LOCK *lock2= (*lock_data2)->lock;
-
- for (lock_data= table_lock_data;
- lock_data < end_data;
- lock_data++)
- {
- if ((*lock_data)->lock == lock2)
- {
- DBUG_PRINT("info", ("haystack match: '%s'", haystack->table_name));
- DBUG_RETURN(haystack);
- }
- }
- }
- }
-
- end:
- DBUG_PRINT("info", ("no duplicate found"));
- DBUG_RETURN(NULL);
-}
-
-
/** Unlock a set of external. */
static int unlock_external(THD *thd, TABLE **table,uint count)
@@ -851,62 +747,48 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
}
-/*****************************************************************************
- Lock table based on the name.
- This is used when we need total access to a closed, not open table
-*****************************************************************************/
-
/**
- Obtain exclusive metadata locks on the list of tables.
+ Obtain an exclusive metadata lock on a schema name.
- @param thd Thread handle
- @param table_list List of tables to lock
+ @param thd Thread handle.
+ @param db The database name.
- @note This function assumes that no metadata locks were acquired
- before calling it. Also it cannot be called while holding
- LOCK_open mutex. Both these invariants are enforced by asserts
- in MDL_context::acquire_locks().
- @note Initialization of MDL_request members of TABLE_LIST elements
- is a responsibility of the caller.
+ This function cannot be called while holding LOCK_open mutex.
+ To avoid deadlocks, we do not try to obtain exclusive metadata
+ locks in LOCK TABLES mode, since in this mode there may be
+ other metadata locks already taken by the current connection,
+ and we must not wait for MDL locks while holding locks.
- @retval FALSE Success.
- @retval TRUE Failure (OOM or thread was killed).
+ @retval FALSE Success.
+ @retval TRUE Failure: we're in LOCK TABLES mode, or out of memory,
+ or this connection was killed.
*/
-bool lock_table_names(THD *thd, TABLE_LIST *table_list)
+bool lock_schema_name(THD *thd, const char *db)
{
MDL_request_list mdl_requests;
MDL_request global_request;
- TABLE_LIST *lock_table;
+ MDL_request mdl_request;
- global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
+ if (thd->locked_tables_mode)
+ {
+ my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
+ ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
+ return TRUE;
+ }
- for (lock_table= table_list; lock_table; lock_table= lock_table->next_local)
- mdl_requests.push_front(&lock_table->mdl_request);
+ global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
+ mdl_request.init(MDL_key::SCHEMA, db, "", MDL_EXCLUSIVE);
+ mdl_requests.push_front(&mdl_request);
mdl_requests.push_front(&global_request);
if (thd->mdl_context.acquire_locks(&mdl_requests,
thd->variables.lock_wait_timeout))
- return 1;
-
- return 0;
-}
-
-
-/**
- Release all metadata locks previously obtained by lock_table_names().
-
- @param thd Thread handle.
-
- @note Cannot be called while holding LOCK_open mutex.
-*/
+ return TRUE;
-void unlock_table_names(THD *thd)
-{
- DBUG_ENTER("unlock_table_names");
- thd->mdl_context.release_transactional_locks();
- DBUG_VOID_RETURN;
+ DEBUG_SYNC(thd, "after_wait_locked_schema_name");
+ return FALSE;
}
@@ -941,6 +823,7 @@ bool lock_routine_name(THD *thd, bool is_function,
MDL_key::PROCEDURE);
MDL_request_list mdl_requests;
MDL_request global_request;
+ MDL_request schema_request;
MDL_request mdl_request;
if (thd->locked_tables_mode)
@@ -954,9 +837,11 @@ bool lock_routine_name(THD *thd, bool is_function,
DEBUG_SYNC(thd, "before_wait_locked_pname");
global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
+ schema_request.init(MDL_key::SCHEMA, db, "", MDL_INTENTION_EXCLUSIVE);
mdl_request.init(mdl_type, db, name, MDL_EXCLUSIVE);
mdl_requests.push_front(&mdl_request);
+ mdl_requests.push_front(&schema_request);
mdl_requests.push_front(&global_request);
if (thd->mdl_context.acquire_locks(&mdl_requests,
diff --git a/sql/lock.h b/sql/lock.h
index 84c7bce0679..0083dd3ba18 100644
--- a/sql/lock.h
+++ b/sql/lock.h
@@ -60,12 +60,9 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock);
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
-TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
- TABLE_LIST *haystack);
void broadcast_refresh(void);
/* Lock based on name */
-bool lock_table_names(THD *thd, TABLE_LIST *table_list);
-void unlock_table_names(THD *thd);
+bool lock_schema_name(THD *thd, const char *db);
/* Lock based on stored routine name */
bool lock_routine_name(THD *thd, bool is_function, const char *db,
const char *name);
diff --git a/sql/log.cc b/sql/log.cc
index b398cb1e73f..86f8100be07 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -27,7 +27,7 @@
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "log.h"
-#include "sql_base.h" // close_thread_tables
+#include "sql_base.h" // open_log_table
#include "sql_repl.h"
#include "sql_delete.h" // mysql_truncate
#include "sql_parse.h" // command_name
@@ -4704,7 +4704,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
file= cache_mngr->get_binlog_cache_log(is_trans_cache);
cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache);
- if (thd->stmt_accessed_non_trans_temp_table())
+ if (thd->lex->stmt_accessed_non_trans_temp_table())
cache_data->set_changes_to_non_trans_temp_table();
thd->binlog_start_trans_and_stmt();
@@ -5447,6 +5447,22 @@ void sql_perror(const char *message)
}
+/*
+ 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;
+ }
+
+ return TRUE;
+}
+
+
bool flush_error_log()
{
bool result=0;
@@ -5474,11 +5490,7 @@ bool flush_error_log()
setbuf(stderr, NULL);
my_delete(err_renamed, MYF(0));
my_rename(log_error_file, err_renamed, MYF(0));
- if (freopen(log_error_file,"a+",stdout))
- {
- freopen(log_error_file,"a+",stderr);
- setbuf(stderr, NULL);
- }
+ redirect_std_streams(log_error_file);
if ((fd= my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
{
@@ -5493,13 +5505,7 @@ bool flush_error_log()
result= 1;
#else
my_rename(log_error_file, err_renamed, MYF(0));
- if (freopen(log_error_file,"a+",stdout))
- {
- FILE *reopen;
- reopen= freopen(log_error_file,"a+",stderr);
- setbuf(stderr, NULL);
- }
- else
+ if (redirect_std_streams(log_error_file))
result= 1;
#endif
mysql_mutex_unlock(&LOCK_error_log);
@@ -5551,25 +5557,9 @@ static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
#endif /* _WIN32 */
-/**
- Prints a printf style message to the error log and, under NT, to the
- Windows event log.
-
- This function prints the message into a buffer and then sends that buffer
- to other functions to write that message to other logging sources.
-
- @param event_type Type of event to write (Error, Warning, or Info)
- @param format Printf style format of message
- @param args va_list list of arguments for the message
-
- @returns
- The function always returns 0. The return value is present in the
- signature to be compatible with other logging routines, which could
- return an error (e.g. logging to the log tables)
-*/
-
#ifndef EMBEDDED_LIBRARY
-static void print_buffer_to_file(enum loglevel level, const char *buffer)
+static void print_buffer_to_file(enum loglevel level, const char *buffer,
+ size_t length)
{
time_t skr;
struct tm tm_tmp;
@@ -5583,7 +5573,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
localtime_r(&skr, &tm_tmp);
start=&tm_tmp;
- fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n",
+ fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %.*s\n",
start->tm_year % 100,
start->tm_mon+1,
start->tm_mday,
@@ -5592,7 +5582,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
start->tm_sec,
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
"Warning" : "Note"),
- buffer);
+ (int) length, buffer);
fflush(stderr);
@@ -5600,7 +5590,22 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
DBUG_VOID_RETURN;
}
+/**
+ Prints a printf style message to the error log and, under NT, to the
+ Windows event log.
+ This function prints the message into a buffer and then sends that buffer
+ to other functions to write that message to other logging sources.
+
+ @param level The level of the msg significance
+ @param format Printf style format of message
+ @param args va_list list of arguments for the message
+
+ @returns
+ The function always returns 0. The return value is present in the
+ signature to be compatible with other logging routines, which could
+ return an error (e.g. logging to the log tables)
+*/
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
{
char buff[1024];
@@ -5608,7 +5613,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
DBUG_ENTER("vprint_msg_to_log");
length= my_vsnprintf(buff, sizeof(buff), format, args);
- print_buffer_to_file(level, buff);
+ print_buffer_to_file(level, buff, length);
#ifdef _WIN32
print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff));
@@ -5616,7 +5621,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
DBUG_RETURN(0);
}
-#endif /*EMBEDDED_LIBRARY*/
+#endif /* EMBEDDED_LIBRARY */
void sql_print_error(const char *format, ...)
diff --git a/sql/log_event.cc b/sql/log_event.cc
index fe8d13fac9c..d224f555cf2 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -679,7 +679,7 @@ Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
server_id= thd->server_id;
when= thd->start_time;
cache_type= ((using_trans || stmt_has_updated_trans_table(thd) ||
- (thd->stmt_accessed_temp_table() &&
+ (thd->lex->stmt_accessed_temp_table() &&
trans_has_updated_trans_table(thd)))
? Log_event::EVENT_TRANSACTIONAL_CACHE :
Log_event::EVENT_STMT_CACHE);
@@ -2573,7 +2573,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
else
{
cache_type= ((using_trans || stmt_has_updated_trans_table(thd) || trx_cache ||
- (thd->stmt_accessed_temp_table() &&
+ (thd->lex->stmt_accessed_temp_table() &&
trans_has_updated_trans_table(thd)))
? Log_event::EVENT_TRANSACTIONAL_CACHE :
Log_event::EVENT_STMT_CACHE);
@@ -3332,6 +3332,19 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
thd->table_map_for_update= (table_map)table_map_for_update;
thd->set_invoker(&user, &host);
+ /*
+ Flag if we need to rollback the statement transaction on
+ slave if it by chance succeeds.
+ If we expected a non-zero error code and get nothing and,
+ it is a concurrency issue or ignorable issue, effects
+ of the statement should be rolled back.
+ */
+ if (expected_error &&
+ (ignored_error_code(expected_error) ||
+ concurrency_error_code(expected_error)))
+ {
+ thd->variables.option_bits|= OPTION_MASTER_SQL_ERROR;
+ }
/* Execute the query (note that we bypass dispatch_command()) */
Parser_state parser_state;
if (!parser_state.init(thd, thd->query(), thd->query_length()))
@@ -3340,6 +3353,8 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
log_slow_statement(thd);
}
+ thd->variables.option_bits&= ~OPTION_MASTER_SQL_ERROR;
+
/*
Resetting the enable_slow_log thd variable.
@@ -3382,7 +3397,6 @@ START SLAVE; . Query: '%s'", expected_error, thd->query());
general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
compare_errors:
-
/*
In the slave thread, we may sometimes execute some DROP / * 40005
TEMPORARY * / TABLE that come from parts of binlogs (likely if we
@@ -3430,26 +3444,8 @@ Default database: '%s'. Query: '%s'",
DBUG_PRINT("info",("error ignored"));
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
thd->killed= THD::NOT_KILLED;
- /*
- When an error is expected and matches the actual error the
- slave does not report any error and by consequence changes
- on transactional tables are not rolled back in the function
- close_thread_tables(). For that reason, we explicitly roll
- them back here.
- */
- if (expected_error && expected_error == actual_error)
- trans_rollback_stmt(thd);
}
/*
- If we expected a non-zero error code and get nothing and, it is a concurrency
- issue or should be ignored.
- */
- else if (expected_error && !actual_error &&
- (concurrency_error_code(expected_error) ||
- ignored_error_code(expected_error)))
- trans_rollback_stmt(thd);
-
- /*
Other cases: mostly we expected no error and get one.
*/
else if (thd->is_slave_error || thd->is_fatal_error)
@@ -3516,7 +3512,6 @@ end:
thd->set_db(NULL, 0); /* will free the current database */
thd->set_query(NULL, 0);
DBUG_PRINT("info", ("end: query= 0"));
- close_thread_tables(thd);
/*
As a disk space optimization, future masters will not log an event for
LAST_INSERT_ID() if that function returned 0 (and thus they will be able
@@ -4947,7 +4942,22 @@ error:
thd->catalog= 0;
thd->set_db(NULL, 0); /* will free the current database */
thd->set_query(NULL, 0);
+ thd->stmt_da->can_overwrite_status= TRUE;
+ thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
+ thd->stmt_da->can_overwrite_status= FALSE;
close_thread_tables(thd);
+ /*
+ - If inside a multi-statement transaction,
+ defer the release of metadata locks until the current
+ transaction is either committed or rolled back. This prevents
+ other statements from modifying the table for the entire
+ duration of this transaction. This provides commit ordering
+ and guarantees serializability across multiple transactions.
+ - If in autocommit mode, or outside a transactional context,
+ automatically release metadata locks of the current statement.
+ */
+ if (! thd->in_multi_stmt_transaction_mode())
+ thd->mdl_context.release_transactional_locks();
DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error",
thd->is_slave_error= 0; thd->is_fatal_error= 1;);
@@ -5532,11 +5542,9 @@ int Xid_log_event::do_apply_event(Relay_log_info const *rli)
/* For a slave Xid_log_event is COMMIT */
general_log_print(thd, COM_QUERY,
"COMMIT /* implicit, from Xid_log_event */");
- if (!(res= trans_commit(thd)))
- {
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
- }
+ res= trans_commit(thd); /* Automatically rolls back on error. */
+ thd->mdl_context.release_transactional_locks();
+
return res;
}
@@ -7611,8 +7619,6 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
We should not honour --slave-skip-errors at this point as we are
having severe errors which should not be skiped.
*/
- mysql_unlock_tables(thd, thd->lock);
- thd->lock= 0;
thd->is_slave_error= 1;
const_cast<Relay_log_info*>(rli)->slave_close_thread_tables(thd);
DBUG_RETURN(ERR_BAD_TABLE_DEF);
diff --git a/sql/mdl.cc b/sql/mdl.cc
index 0426a410d98..ca66799baed 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -284,8 +284,6 @@ public:
public:
/** The key of the object (data) being protected. */
MDL_key key;
- void *cached_object;
- mdl_cached_object_release_hook cached_object_release_hook;
/**
Read-write lock protecting this lock context.
@@ -362,8 +360,6 @@ public:
MDL_lock(const MDL_key *key_arg)
: key(key_arg),
- cached_object(NULL),
- cached_object_release_hook(NULL),
m_ref_usage(0),
m_ref_release(0),
m_is_destroyed(FALSE)
@@ -405,14 +401,15 @@ public:
/**
- An implementation of the global metadata lock. The only locking modes
- which are supported at the moment are SHARED and INTENTION EXCLUSIVE.
+ An implementation of the scoped metadata lock. The only locking modes
+ which are supported at the moment are SHARED and INTENTION EXCLUSIVE
+ and EXCLUSIVE
*/
-class MDL_global_lock : public MDL_lock
+class MDL_scoped_lock : public MDL_lock
{
public:
- MDL_global_lock(const MDL_key *key_arg)
+ MDL_scoped_lock(const MDL_key *key_arg)
: MDL_lock(key_arg)
{ }
@@ -674,9 +671,6 @@ void MDL_map::remove(MDL_lock *lock)
{
uint ref_usage, ref_release;
- if (lock->cached_object)
- (*lock->cached_object_release_hook)(lock->cached_object);
-
/*
Destroy the MDL_lock object, but ensure that anyone that is
holding a reference to the object is not remaining, if so he
@@ -838,7 +832,8 @@ inline MDL_lock *MDL_lock::create(const MDL_key *mdl_key)
switch (mdl_key->mdl_namespace())
{
case MDL_key::GLOBAL:
- return new MDL_global_lock(mdl_key);
+ case MDL_key::SCHEMA:
+ return new MDL_scoped_lock(mdl_key);
default:
return new MDL_object_lock(mdl_key);
}
@@ -886,67 +881,6 @@ uint MDL_ticket::get_deadlock_weight() const
}
-/**
- Helper functions and macros to be used for killable waiting in metadata
- locking subsystem.
-
- @sa THD::enter_cond()/exit_cond()/killed.
-
- @note We can't use THD::enter_cond()/exit_cond()/killed directly here
- since this will make metadata subsystem dependent on THD class
- and thus prevent us from writing unit tests for it. And usage of
- wrapper functions to access THD::killed/enter_cond()/exit_cond()
- will probably introduce too much overhead.
-*/
-
-#define MDL_ENTER_COND(A, B, C, D) \
- mdl_enter_cond(A, B, C, D, __func__, __FILE__, __LINE__)
-
-static inline const char *mdl_enter_cond(THD *thd,
- st_my_thread_var *mysys_var,
- mysql_cond_t *cond,
- mysql_mutex_t *mutex,
- const char *calling_func,
- const char *calling_file,
- const unsigned int calling_line)
-{
- mysql_mutex_assert_owner(mutex);
-
- mysys_var->current_mutex= mutex;
- mysys_var->current_cond= cond;
-
- DEBUG_SYNC(thd, "mdl_enter_cond");
-
- return set_thd_proc_info(thd, "Waiting for table",
- calling_func, calling_file, calling_line);
-}
-
-#define MDL_EXIT_COND(A, B, C, D) \
- mdl_exit_cond(A, B, C, D, __func__, __FILE__, __LINE__)
-
-static inline void mdl_exit_cond(THD *thd,
- st_my_thread_var *mysys_var,
- mysql_mutex_t *mutex,
- const char* old_msg,
- const char *calling_func,
- const char *calling_file,
- const unsigned int calling_line)
-{
- DBUG_ASSERT(mutex == mysys_var->current_mutex);
-
- mysql_mutex_unlock(mutex);
- mysql_mutex_lock(&mysys_var->mutex);
- mysys_var->current_mutex= NULL;
- mysys_var->current_cond= NULL;
- mysql_mutex_unlock(&mysys_var->mutex);
-
- DEBUG_SYNC(thd, "mdl_exit_cond");
-
- (void) set_thd_proc_info(thd, old_msg, calling_func,
- calling_file, calling_line);
-}
-
-
/** Construct an empty wait slot. */
MDL_wait::MDL_wait()
@@ -1026,15 +960,14 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
{
const char *old_msg;
enum_wait_status result;
- st_my_thread_var *mysys_var= my_thread_var;
int wait_result= 0;
mysql_mutex_lock(&m_LOCK_wait_status);
- old_msg= MDL_ENTER_COND(thd, mysys_var, &m_COND_wait_status,
- &m_LOCK_wait_status);
+ old_msg= thd_enter_cond(thd, &m_COND_wait_status, &m_LOCK_wait_status,
+ "Waiting for table");
- while (!m_wait_status && !mysys_var->abort &&
+ while (!m_wait_status && !thd_killed(thd) &&
wait_result != ETIMEDOUT && wait_result != ETIME)
wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status,
abs_timeout);
@@ -1053,14 +986,14 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
false, which means that the caller intends to restart the
wait.
*/
- if (mysys_var->abort)
+ if (thd_killed(thd))
m_wait_status= KILLED;
else if (set_status_on_timeout)
m_wait_status= TIMEOUT;
}
result= m_wait_status;
- MDL_EXIT_COND(thd, mysys_var, &m_LOCK_wait_status, old_msg);
+ thd_exit_cond(thd, old_msg);
return result;
}
@@ -1181,11 +1114,6 @@ void MDL_lock::reschedule_waiters()
*/
m_waiting.remove_ticket(ticket);
m_granted.add_ticket(ticket);
-
- /* If we are granting an X lock, release the cached object. */
- if (ticket->get_type() == MDL_EXCLUSIVE && cached_object)
- (*cached_object_release_hook)(cached_object);
- cached_object= NULL;
}
/*
If we could not update the wait slot of the waiter,
@@ -1201,61 +1129,66 @@ void MDL_lock::reschedule_waiters()
/**
- Compatibility (or rather "incompatibility") matrices for global metadata
+ Compatibility (or rather "incompatibility") matrices for scoped metadata
lock. Arrays of bitmaps which elements specify which granted/waiting locks
are incompatible with type of lock being requested.
- Here is how types of individual locks are translated to type of global lock:
+ Here is how types of individual locks are translated to type of scoped lock:
----------------+-------------+
Type of request | Correspond. |
- for indiv. lock | global lock |
+ for indiv. lock | scoped lock |
----------------+-------------+
S, SH, SR, SW | IS |
SNW, SNRW, X | IX |
SNW, SNRW -> X | IX (*) |
The first array specifies if particular type of request can be satisfied
- if there is granted global lock of certain type.
+ if there is granted scoped lock of certain type.
- | Type of active |
- Request | global lock |
- type | IS(**) IX S |
- ---------+----------------+
- IS | + + + |
- IX | + + - |
- S | + - + |
+ | Type of active |
+ Request | scoped lock |
+ type | IS(**) IX S X |
+ ---------+------------------+
+ IS | + + + + |
+ IX | + + - - |
+ S | + - + - |
+ X | + - - - |
The second array specifies if particular type of request can be satisfied
- if there is already waiting request for the global lock of certain type.
+ if there is already waiting request for the scoped lock of certain type.
I.e. it specifies what is the priority of different lock types.
- | Pending |
- Request | global lock |
- type | IS(**) IX S |
- ---------+--------------+
- IS | + + + |
- IX | + + - |
- S | + + + |
+ | Pending |
+ Request | scoped lock |
+ type | IS(**) IX S X |
+ ---------+-----------------+
+ IS | + + + + |
+ IX | + + - - |
+ S | + + + - |
+ X | + + + + |
Here: "+" -- means that request can be satisfied
"-" -- means that request can't be satisfied and should wait
- (*) Since for upgradable locks we always take intention exclusive global
+ (*) Since for upgradable locks we always take intention exclusive scoped
lock at the same time when obtaining the shared lock, there is no
need to obtain such lock during the upgrade itself.
- (**) Since intention shared global locks are compatible with all other
+ (**) Since intention shared scoped locks are compatible with all other
type of locks we don't even have any accounting for them.
*/
-const MDL_lock::bitmap_t MDL_global_lock::m_granted_incompatible[MDL_TYPE_END] =
+const MDL_lock::bitmap_t MDL_scoped_lock::m_granted_incompatible[MDL_TYPE_END] =
{
- MDL_BIT(MDL_SHARED), MDL_BIT(MDL_INTENTION_EXCLUSIVE), 0, 0, 0, 0, 0, 0
+ MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED),
+ MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_INTENTION_EXCLUSIVE), 0, 0, 0, 0, 0,
+ MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED) | MDL_BIT(MDL_INTENTION_EXCLUSIVE)
};
-const MDL_lock::bitmap_t MDL_global_lock::m_waiting_incompatible[MDL_TYPE_END] =
+const MDL_lock::bitmap_t MDL_scoped_lock::m_waiting_incompatible[MDL_TYPE_END] =
{
- MDL_BIT(MDL_SHARED), 0, 0, 0, 0, 0, 0, 0
+ MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED),
+ MDL_BIT(MDL_EXCLUSIVE), 0, 0, 0, 0, 0, 0
};
@@ -1655,10 +1588,6 @@ MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
{
lock->m_granted.add_ticket(ticket);
- if (mdl_request->type == MDL_EXCLUSIVE && lock->cached_object)
- (*lock->cached_object_release_hook)(lock->cached_object);
- lock->cached_object= NULL;
-
mysql_prlock_unlock(&lock->m_rwlock);
m_tickets.push_front(ticket);
@@ -1894,7 +1823,7 @@ extern "C" int mdl_request_ptr_cmp(const void* ptr1, const void* ptr2)
@note The list of requests should not contain non-exclusive lock requests.
There should not be any acquired locks in the context.
- @note Assumes that one already owns global intention exclusive lock.
+ @note Assumes that one already owns scoped intention exclusive lock.
@retval FALSE Success
@retval TRUE Failure
@@ -1911,13 +1840,6 @@ bool MDL_context::acquire_locks(MDL_request_list *mdl_requests,
if (req_count == 0)
return FALSE;
- /*
- To reduce deadlocks, the server acquires all exclusive
- locks at once. For shared locks, try_acquire_lock() is
- used instead.
- */
- DBUG_ASSERT(m_tickets.is_empty() || m_tickets.front() == m_trans_sentinel);
-
/* Sort requests according to MDL_key. */
if (! (sort_buf= (MDL_request **)my_malloc(req_count *
sizeof(MDL_request*),
@@ -2434,69 +2356,6 @@ bool MDL_ticket::has_pending_conflicting_lock() const
/**
- Associate pointer to an opaque object with a lock.
-
- @param cached_object Pointer to the object
- @param release_hook Cleanup function to be called when MDL subsystem
- decides to remove lock or associate another object.
-
- This is used to cache a pointer to TABLE_SHARE in the lock
- structure. Such caching can save one acquisition of LOCK_open
- and one table definition cache lookup for every table.
-
- Since the pointer may be stored only inside an acquired lock,
- the caching is only effective when there is more than one lock
- granted on a given table.
-
- This function has the following usage pattern:
- - try to acquire an MDL lock
- - when done, call for mdl_get_cached_object(). If it returns NULL, our
- thread has the only lock on this table.
- - look up TABLE_SHARE in the table definition cache
- - call mdl_set_cache_object() to assign the share to the opaque pointer.
-
- The release hook is invoked when the last shared metadata
- lock on this name is released.
-*/
-
-void
-MDL_ticket::set_cached_object(void *cached_object,
- mdl_cached_object_release_hook release_hook)
-{
- DBUG_ENTER("mdl_set_cached_object");
- DBUG_PRINT("enter", ("db=%s name=%s cached_object=%p",
- m_lock->key.db_name(), m_lock->key.name(),
- cached_object));
- /*
- TODO: This assumption works now since we do get_cached_object()
- and set_cached_object() in the same critical section. Once
- this becomes false we will have to call release_hook here and
- use additional mutex protecting 'cached_object' member.
- */
- DBUG_ASSERT(!m_lock->cached_object);
-
- m_lock->cached_object= cached_object;
- m_lock->cached_object_release_hook= release_hook;
-
- DBUG_VOID_RETURN;
-}
-
-
-/**
- Get a pointer to an opaque object that associated with the lock.
-
- @param ticket Lock ticket for the lock which the object is associated to.
-
- @return Pointer to an opaque object associated with the lock.
-*/
-
-void *MDL_ticket::get_cached_object()
-{
- return m_lock->cached_object;
-}
-
-
-/**
Releases metadata locks that were acquired after a specific savepoint.
@note Used to release tickets acquired during a savepoint unit.
diff --git a/sql/mdl.h b/sql/mdl.h
index 43d88c143c0..c8acd69c0f1 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -40,15 +40,16 @@ class Deadlock_detection_visitor;
Type of metadata lock request.
@sa Comments for MDL_object_lock::can_grant_lock() and
- MDL_global_lock::can_grant_lock() for details.
+ MDL_scoped_lock::can_grant_lock() for details.
*/
enum enum_mdl_type {
/*
- An intention exclusive metadata lock. Used only for global locks.
+ An intention exclusive metadata lock. Used only for scoped locks.
Owner of this type of lock can acquire upgradable exclusive locks on
individual objects.
- Compatible with other IX locks, but is incompatible with global S lock.
+ Compatible with other IX locks, but is incompatible with scoped S and
+ X locks.
*/
MDL_INTENTION_EXCLUSIVE= 0,
/*
@@ -179,6 +180,7 @@ public:
MDL_key is also used outside of the MDL subsystem.
*/
enum enum_mdl_namespace { GLOBAL=0,
+ SCHEMA,
TABLE,
FUNCTION,
PROCEDURE,
@@ -396,9 +398,6 @@ public:
public:
bool has_pending_conflicting_lock() const;
- void *get_cached_object();
- void set_cached_object(void *cached_object,
- mdl_cached_object_release_hook release_hook);
MDL_context *get_ctx() const { return m_ctx; }
bool is_upgradable_or_exclusive() const
{
@@ -646,6 +645,8 @@ private:
closes all open HANDLERs.
However, one can open a few HANDLERs after entering the
read only mode.
+ * LOCK TABLES locks include intention exclusive locks on
+ involved schemas.
*/
Ticket_list m_tickets;
/**
@@ -720,10 +721,10 @@ void mdl_destroy();
extern bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
bool needs_thr_lock_abort);
-extern "C" const char *set_thd_proc_info(void *thd_arg, const char *info,
- const char *calling_function,
- const char *calling_file,
- const unsigned int calling_line);
+extern "C" const char* thd_enter_cond(MYSQL_THD thd, mysql_cond_t *cond,
+ mysql_mutex_t *mutex, const char *msg);
+extern "C" void thd_exit_cond(MYSQL_THD thd, const char *old_msg);
+
#ifndef DBUG_OFF
extern mysql_mutex_t LOCK_open;
#endif
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index cb579324644..afc515a9d8c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -27,8 +27,8 @@
// reset_status_vars
#include "strfunc.h" // find_set_from_flags
#include "parse_file.h" // File_parser_dummy_hook
-#include "sql_db.h" // my_database_names_free,
- // my_database_names_init
+#include "sql_db.h" // my_dboptions_cache_free
+ // my_dboptions_cache_init
#include "sql_table.h" // release_ddl_log, execute_ddl_log_recovery
#include "sql_connect.h" // free_max_user_conn, init_max_user_conn,
// handle_one_connection
@@ -183,7 +183,7 @@ typedef fp_except fp_except_t;
# define fpu_control_t unsigned int
# define _FPU_EXTENDED 0x300
# define _FPU_DOUBLE 0x200
-# if defined(__GNUC__) || defined(__SUNPRO_CC)
+# if defined(__GNUC__) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
# define _FPU_GETCW(cw) asm volatile ("fnstcw %0" : "=m" (*&cw))
# define _FPU_SETCW(cw) asm volatile ("fldcw %0" : : "m" (*&cw))
# else
@@ -601,7 +601,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_mysql_create_db, LOCK_open,
+mysql_mutex_t LOCK_open,
LOCK_status, LOCK_global_read_lock,
LOCK_error_log, LOCK_uuid_generator,
LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create,
@@ -1420,7 +1420,7 @@ void clean_up(bool print_message)
bitmap_free(&slave_error_mask);
#endif
my_tz_free();
- my_database_names_free();
+ my_dboptions_cache_free();
#ifndef NO_EMBEDDED_ACCESS_CHECKS
servers_free(1);
acl_free(1);
@@ -1525,8 +1525,6 @@ static void wait_for_signal_thread_to_end()
static void clean_up_mutexes()
{
- mysql_mutex_destroy(&LOCK_mysql_create_db);
- mysql_mutex_destroy(&LOCK_lock_db);
mysql_rwlock_destroy(&LOCK_grant);
mysql_mutex_destroy(&LOCK_open);
mysql_mutex_destroy(&LOCK_thread_count);
@@ -3445,7 +3443,7 @@ static int init_common_variables()
use_temp_pool= 0;
#endif
- if (my_database_names_init())
+ if (my_dboptions_cache_init())
return 1;
/*
@@ -3502,9 +3500,6 @@ You should consider changing lower_case_table_names to 1 or 2",
static int init_thread_environment()
{
- mysql_mutex_init(key_LOCK_mysql_create_db,
- &LOCK_mysql_create_db, MY_MUTEX_INIT_SLOW);
- mysql_mutex_init(key_LOCK_lock_db, &LOCK_lock_db, MY_MUTEX_INIT_SLOW);
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);
@@ -3703,7 +3698,6 @@ static void end_ssl()
static int init_server_components()
{
- FILE *reopen;
DBUG_ENTER("init_server_components");
/*
We need to call each of these following functions to ensure that
@@ -3751,8 +3745,8 @@ static int init_server_components()
if (freopen(log_error_file, "a+", stdout))
#endif
{
- reopen= freopen(log_error_file, "a+", stderr);
- setbuf(stderr, NULL);
+ if (freopen(log_error_file, "a+", stderr))
+ setbuf(stderr, NULL);
}
}
}
@@ -6967,7 +6961,7 @@ mysqld_get_one_option(int optid,
*val= 0;
val+= 2;
while (*val && my_isspace(mysqld_charset, *val))
- *val++;
+ val++;
if (!*val)
{
sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db!\n");
@@ -7685,8 +7679,8 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
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_lock_db, key_LOCK_manager,
- key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count,
+ key_LOCK_manager,
+ key_LOCK_open, 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,
@@ -7724,9 +7718,7 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_gdl, "LOCK_gdl", PSI_FLAG_GLOBAL},
{ &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_lock_db, "LOCK_lock_db", PSI_FLAG_GLOBAL},
{ &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL},
- { &key_LOCK_mysql_create_db, "LOCK_mysql_create_db", 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},
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 91bdc600cda..22e757e6e8a 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -228,8 +228,8 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
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_lock_db, key_LOCK_logger, key_LOCK_manager,
- key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count,
+ key_LOCK_logger, key_LOCK_manager,
+ key_LOCK_open, 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,
@@ -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_mysql_create_db, LOCK_open, LOCK_lock_db,
+extern mysql_mutex_t LOCK_open,
LOCK_user_locks, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 43934551016..caf28fdd83e 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1535,13 +1535,11 @@ bool partition_info::set_up_charset_field_preps()
i= 0;
while ((field= *(ptr++)))
{
- CHARSET_INFO *cs;
uchar *field_buf;
LINT_INIT(field_buf);
if (!field_is_partition_charset(field))
continue;
- cs= ((Field_str*)field)->charset();
size= field->pack_length();
if (!(field_buf= (uchar*) sql_calloc(size)))
goto error;
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 87a54eaf10d..953656d3a4f 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -658,7 +658,11 @@ void Protocol::end_partial_result_set(THD *thd_arg)
bool Protocol::flush()
{
#ifndef EMBEDDED_LIBRARY
- return net_flush(&thd->net);
+ bool error;
+ thd->stmt_da->can_overwrite_status= TRUE;
+ error= net_flush(&thd->net);
+ thd->stmt_da->can_overwrite_status= FALSE;
+ return error;
#else
return 0;
#endif
@@ -698,7 +702,8 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
if (flags & SEND_NUM_ROWS)
{ // Packet with number of elements
uchar *pos= net_store_length(buff, list->elements);
- (void) my_net_write(&thd->net, buff, (size_t) (pos-buff));
+ if (my_net_write(&thd->net, buff, (size_t) (pos-buff)))
+ DBUG_RETURN(1);
}
#ifndef DBUG_OFF
@@ -803,7 +808,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
if (flags & SEND_DEFAULTS)
item->send(&prot, &tmp); // Send default value
if (prot.write())
- break; /* purecov: inspected */
+ DBUG_RETURN(1);
#ifndef DBUG_OFF
field_types[count++]= field.type;
#endif
@@ -816,8 +821,9 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
to show that there is no cursor.
Send no warning information, as it will be sent at statement end.
*/
- write_eof_packet(thd, &thd->net, thd->server_status,
- thd->warning_info->statement_warn_count());
+ if (write_eof_packet(thd, &thd->net, thd->server_status,
+ thd->warning_info->statement_warn_count()))
+ DBUG_RETURN(1);
}
DBUG_RETURN(prepare_for_send(list->elements));
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 03c369394bf..af9b452acd8 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1257,7 +1257,23 @@ void Relay_log_info::clear_tables_to_lock()
void Relay_log_info::slave_close_thread_tables(THD *thd)
{
+ thd->stmt_da->can_overwrite_status= TRUE;
+ thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
+ thd->stmt_da->can_overwrite_status= FALSE;
+
close_thread_tables(thd);
+ /*
+ - If inside a multi-statement transaction,
+ defer the release of metadata locks until the current
+ transaction is either committed or rolled back. This prevents
+ other statements from modifying the table for the entire
+ duration of this transaction. This provides commit ordering
+ and guarantees serializability across multiple transactions.
+ - If in autocommit mode, or outside a transactional context,
+ automatically release metadata locks of the current statement.
+ */
+ if (! thd->in_multi_stmt_transaction_mode())
+ thd->mdl_context.release_transactional_locks();
clear_tables_to_lock();
}
#endif
diff --git a/sql/set_var.cc b/sql/set_var.cc
index ec9c09f02a3..9daaf883ea8 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -27,7 +27,6 @@
#include "mysqld.h" // lc_messages_dir
#include "sys_vars_shared.h"
#include "transaction.h"
-#include "sql_base.h" // close_thread_tables
#include "sql_locale.h" // my_locale_by_number,
// my_locale_by_name
#include "strfunc.h" // find_set_from_flags, find_set
diff --git a/sql/share/CMakeLists.txt b/sql/share/CMakeLists.txt
index 14de851aaa2..f8fd51fda23 100644
--- a/sql/share/CMakeLists.txt
+++ b/sql/share/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET (dirs
danish
diff --git a/sql/slave.cc b/sql/slave.cc
index 25860138cf2..dff6b6946d4 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3032,7 +3032,6 @@ err:
change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE);
DBUG_ASSERT(thd->net.buff != 0);
net_end(&thd->net); // destructor will not free it, because net.vio is 0
- close_thread_tables(thd);
mysql_mutex_lock(&LOCK_thread_count);
THD_CHECK_SENTRY(thd);
delete thd;
@@ -3263,11 +3262,8 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
mysql_mutex_lock(&rli->data_lock);
if (rli->slave_skip_counter)
{
- char *pos;
- pos= strmake(saved_log_name, rli->group_relay_log_name, FN_REFLEN - 1);
- pos= '\0';
- pos= strmake(saved_master_log_name, rli->group_master_log_name, FN_REFLEN - 1);
- pos= '\0';
+ strmake(saved_log_name, rli->group_relay_log_name, FN_REFLEN - 1);
+ strmake(saved_master_log_name, rli->group_master_log_name, FN_REFLEN - 1);
saved_log_pos= rli->group_relay_log_pos;
saved_master_log_pos= rli->group_master_log_pos;
saved_skip= rli->slave_skip_counter;
diff --git a/sql/sp.cc b/sql/sp.cc
index 5328471f4c0..0265ef45a2a 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -450,10 +450,7 @@ 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);
-
DBUG_RETURN(NULL);
-
}
@@ -856,6 +853,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
}
end:
+ thd->lex->sphead= NULL;
lex_end(thd->lex);
thd->lex= old_lex;
return ret;
@@ -1159,8 +1157,6 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
done:
thd->count_cuted_fields= saved_count_cuted_fields;
thd->variables.sql_mode= saved_mode;
-
- close_thread_tables(thd);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -1239,8 +1235,6 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
sp_cache_flush_obsolete(spc, &sp);
}
}
-
- close_thread_tables(thd);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -1348,7 +1342,6 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
sp_cache_invalidate();
}
err:
- close_thread_tables(thd);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -1370,6 +1363,7 @@ sp_drop_db_routines(THD *thd, char *db)
TABLE *table;
int ret;
uint key_len;
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("sp_drop_db_routines");
DBUG_PRINT("enter", ("db: %s", db));
@@ -1410,6 +1404,11 @@ sp_drop_db_routines(THD *thd, char *db)
table->file->ha_index_end();
close_thread_tables(thd);
+ /*
+ Make sure to only release the MDL lock on mysql.proc, not other
+ metadata locks DROP DATABASE might have acquired.
+ */
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
err:
DBUG_RETURN(ret);
@@ -2142,6 +2141,7 @@ sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
newlex.current_select= NULL;
sp= sp_compile(thd, &defstr, sql_mode, creation_ctx);
*free_sp_head= 1;
+ thd->lex->sphead= NULL;
lex_end(thd->lex);
thd->lex= old_lex;
return sp;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index f75acf11984..a95bbe094c0 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -38,6 +38,7 @@
#include "set_var.h"
#include "sql_parse.h" // cleanup_items
#include "sql_base.h" // close_thread_tables
+#include "transaction.h" // trans_commit_stmt
/*
Sufficient max length of printed destinations and frame offsets (all uints).
@@ -795,6 +796,7 @@ sp_head::~sp_head()
while ((lex= (LEX *)m_lex.pop()))
{
THD *thd= lex->thd;
+ thd->lex->sphead= NULL;
lex_end(thd->lex);
delete thd->lex;
thd->lex= lex;
@@ -1074,6 +1076,104 @@ void sp_head::recursion_level_error(THD *thd)
/**
+ Find an SQL handler for any condition (warning or error) after execution
+ of a stored routine instruction. Basically, this function looks for an
+ appropriate SQL handler in RT-contexts. If an SQL handler is found, it is
+ remembered in the RT-context for future activation (the context can be
+ inactive at the moment).
+
+ If there is no pending condition, the function just returns.
+
+ If there was an error during the execution, an SQL handler for it will be
+ searched within the current and outer scopes.
+
+ There might be several errors in the Warning Info (that's possible by using
+ SIGNAL/RESIGNAL in nested scopes) -- the function is looking for an SQL
+ handler for the latest (current) error only.
+
+ If there was a warning during the execution, an SQL handler for it will be
+ searched within the current scope only.
+
+ If several warnings were thrown during the execution and there are different
+ SQL handlers for them, it is not determined which SQL handler will be chosen.
+ Only one SQL handler will be executed.
+
+ If warnings and errors were thrown during the execution, the error takes
+ precedence. I.e. error handler will be executed. If there is no handler
+ for that error, condition will remain unhandled.
+
+ Once a warning or an error has been handled it is not removed from
+ Warning Info.
+
+ According to The Standard (quoting PeterG):
+
+ An SQL procedure statement works like this ...
+ SQL/Foundation 13.5 <SQL procedure statement>
+ (General Rules) (greatly summarized) says:
+ (1) Empty diagnostics area, thus clearing the condition.
+ (2) Execute statement.
+ During execution, if Exception Condition occurs,
+ set Condition Area = Exception Condition and stop
+ statement.
+ During execution, if No Data occurs,
+ set Condition Area = No Data Condition and continue
+ statement.
+ During execution, if Warning occurs,
+ and Condition Area is not already full due to
+ an earlier No Data condition, set Condition Area
+ = Warning and continue statement.
+ (3) Finish statement.
+ At end of execution, if Condition Area is not
+ already full due to an earlier No Data or Warning,
+ set Condition Area = Successful Completion.
+ In effect, this system means there is a precedence:
+ Exception trumps No Data, No Data trumps Warning,
+ Warning trumps Successful Completion.
+
+ NB: "Procedure statements" include any DDL or DML or
+ control statements. So CREATE and DELETE and WHILE
+ and CALL and RETURN are procedure statements. But
+ DECLARE and END are not procedure statements.
+
+ @param thd thread handle
+ @param ctx runtime context of the stored routine
+*/
+
+static void
+find_handler_after_execution(THD *thd, sp_rcontext *ctx)
+{
+ if (thd->is_error())
+ {
+ ctx->find_handler(thd,
+ thd->stmt_da->sql_errno(),
+ thd->stmt_da->get_sqlstate(),
+ MYSQL_ERROR::WARN_LEVEL_ERROR,
+ thd->stmt_da->message());
+ }
+ else if (thd->warning_info->statement_warn_count())
+ {
+ List_iterator<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ MYSQL_ERROR *err;
+ while ((err= it++))
+ {
+ if (err->get_level() != MYSQL_ERROR::WARN_LEVEL_WARN &&
+ err->get_level() != MYSQL_ERROR::WARN_LEVEL_NOTE)
+ continue;
+
+ if (ctx->find_handler(thd,
+ err->get_sql_errno(),
+ err->get_sqlstate(),
+ err->get_level(),
+ err->get_message_text()))
+ {
+ break;
+ }
+ }
+ }
+}
+
+
+/**
Execute the routine. The main instruction jump loop is there.
Assume the parameters already set.
@todo
@@ -1094,7 +1194,7 @@ sp_head::execute(THD *thd)
LEX_STRING saved_cur_db_name=
{ saved_cur_db_name_buf, sizeof(saved_cur_db_name_buf) };
bool cur_db_changed= FALSE;
- sp_rcontext *ctx;
+ sp_rcontext *ctx= thd->spcont;
bool err_status= FALSE;
uint ip= 0;
ulong save_sql_mode;
@@ -1155,8 +1255,6 @@ sp_head::execute(THD *thd)
goto done;
}
- if ((ctx= thd->spcont))
- ctx->clear_handler();
thd->is_slave_error= 0;
old_arena= thd->stmt_arena;
@@ -1241,7 +1339,6 @@ sp_head::execute(THD *thd)
do
{
sp_instr *i;
- uint hip;
#if defined(ENABLED_PROFILING)
/*
@@ -1263,6 +1360,9 @@ sp_head::execute(THD *thd)
break;
}
+ /* Reset number of warnings for this query. */
+ thd->warning_info->reset_for_next_command();
+
DBUG_PRINT("execute", ("Instruction %u", ip));
/*
@@ -1307,40 +1407,28 @@ sp_head::execute(THD *thd)
free_root(&execute_mem_root, MYF(0));
/*
- Check if an exception has occurred and a handler has been found
- Note: We have to check even if err_status == FALSE, since warnings (and
- some errors) don't return a non-zero value. We also have to check even
- if thd->killed != 0, since some errors return with this even when a
- handler has been found (e.g. "bad data").
+ Find and process SQL handlers unless it is a fatal error (fatal
+ errors are not catchable by SQL handlers) or the connection has been
+ killed during execution.
*/
- if (ctx)
+ if (!thd->is_fatal_error && !thd->killed_errno())
{
- uint handler_index;
+ /*
+ Find SQL handler in the appropriate RT-contexts:
+ - warnings can be handled by SQL handlers within
+ the current scope only;
+ - errors can be handled by any SQL handler from outer scope.
+ */
+ find_handler_after_execution(thd, ctx);
- switch (ctx->found_handler(& hip, & handler_index)) {
- case SP_HANDLER_NONE:
- break;
- case SP_HANDLER_CONTINUE:
- thd->restore_active_arena(&execute_arena, &backup_arena);
- thd->set_n_backup_active_arena(&execute_arena, &backup_arena);
- ctx->push_hstack(i->get_cont_dest());
- /* Fall through */
- default:
- if (ctx->end_partial_result_set)
- thd->protocol->end_partial_result_set(thd);
- ip= hip;
+ /* If found, activate handler for the current scope. */
+ if (ctx->activate_handler(thd, &ip, i, &execute_arena, &backup_arena))
err_status= FALSE;
- ctx->clear_handler();
- ctx->enter_handler(hip, handler_index);
- thd->clear_error();
- thd->is_fatal_error= 0;
- thd->killed= THD::NOT_KILLED;
- thd->mysys_var->abort= 0;
- continue;
- }
-
- ctx->end_partial_result_set= FALSE;
}
+
+ /* Reset sp_rcontext::end_partial_result_set flag. */
+ ctx->end_partial_result_set= FALSE;
+
} while (!err_status && !thd->killed && !thd->is_fatal_error);
#if defined(ENABLED_PROFILING)
@@ -1655,7 +1743,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
Field *return_value_fld)
{
ulonglong binlog_save_options;
- bool need_binlog_call;
+ bool need_binlog_call= FALSE;
uint arg_no;
sp_rcontext *octx = thd->spcont;
sp_rcontext *nctx = NULL;
@@ -1862,6 +1950,14 @@ err_with_cleanup:
free_root(&call_mem_root, MYF(0));
thd->spcont= octx;
+ /*
+ If not insided a procedure and a function printing warning
+ messsages.
+ */
+ if (need_binlog_call &&
+ thd->spcont == NULL && !thd->binlog_evt_union.do_union)
+ thd->issue_unsafe_warnings();
+
DBUG_RETURN(err_status);
}
@@ -1995,16 +2091,23 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
arguments evaluation. If arguments evaluation required prelocking mode,
we'll leave it here.
*/
+ thd->lex->unit.cleanup();
+
if (!thd->in_sub_stmt)
{
- thd->lex->unit.cleanup();
+ thd->stmt_da->can_overwrite_status= TRUE;
+ thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
+ thd->stmt_da->can_overwrite_status= FALSE;
+ }
- thd_proc_info(thd, "closing tables");
- close_thread_tables(thd);
- thd_proc_info(thd, 0);
+ thd_proc_info(thd, "closing tables");
+ close_thread_tables(thd);
+ thd_proc_info(thd, 0);
- thd->rollback_item_tree_changes();
- }
+ if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
+ thd->mdl_context.release_transactional_locks();
+
+ thd->rollback_item_tree_changes();
DBUG_PRINT("info",(" %.*s: eval args done", (int) m_name.length,
m_name.str));
@@ -2100,6 +2203,17 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
thd->spcont= save_spcont;
thd->utime_after_lock= utime_before_sp_exec;
+ /*
+ If not insided a procedure and a function printing warning
+ messsages.
+ */
+ bool need_binlog_call= mysql_bin_log.is_open() &&
+ (thd->variables.option_bits & OPTION_BIN_LOG) &&
+ !thd->is_current_stmt_binlog_format_row();
+ if (need_binlog_call && thd->spcont == NULL &&
+ !thd->binlog_evt_union.do_union)
+ thd->issue_unsafe_warnings();
+
DBUG_RETURN(err_status);
}
@@ -2197,6 +2311,7 @@ sp_head::restore_lex(THD *thd)
merge_table_list(thd, sublex->query_tables, sublex);
if (! sublex->sp_lex_in_use)
{
+ sublex->sphead= NULL;
lex_end(sublex);
delete sublex;
}
@@ -2806,12 +2921,27 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
DBUG_PRINT("info",("exec_core returned: %d", res));
}
- m_lex->unit.cleanup();
+ /*
+ Call after unit->cleanup() to close open table
+ key read.
+ */
+ if (open_tables)
+ {
+ m_lex->unit.cleanup();
+ /* Here we also commit or rollback the current statement. */
+ if (! thd->in_sub_stmt)
+ {
+ thd->stmt_da->can_overwrite_status= TRUE;
+ thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
+ thd->stmt_da->can_overwrite_status= FALSE;
+ }
+ thd_proc_info(thd, "closing tables");
+ close_thread_tables(thd);
+ thd_proc_info(thd, 0);
- thd_proc_info(thd, "closing tables");
- /* Here we also commit or rollback the current statement. */
- close_thread_tables(thd);
- thd_proc_info(thd, 0);
+ if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
+ thd->mdl_context.release_transactional_locks();
+ }
if (m_lex->query_tables_own_last)
{
@@ -3012,23 +3142,14 @@ sp_instr_set::exec_core(THD *thd, uint *nextp)
{
int res= thd->spcont->set_variable(thd, m_offset, &m_value);
- if (res && thd->spcont->found_handler_here())
+ if (res)
{
- /*
- Failed to evaluate the value, and a handler has been found. Reset the
- variable to NULL.
- */
+ /* Failed to evaluate the value. Reset the variable to NULL. */
if (thd->spcont->set_variable(thd, m_offset, 0))
{
/* If this also failed, let's abort. */
-
- sp_rcontext *spcont= thd->spcont;
-
- thd->spcont= NULL; /* Avoid handlers */
- my_error(ER_OUT_OF_RESOURCES, MYF(0));
- spcont->clear_handler();
- thd->spcont= spcont;
+ my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
}
}
@@ -3561,18 +3682,6 @@ sp_instr_copen::execute(THD *thd, uint *nextp)
if (thd->stmt_arena->free_list)
cleanup_items(thd->stmt_arena->free_list);
thd->stmt_arena= old_arena;
- /*
- Work around the fact that errors in selects are not returned properly
- (but instead converted into a warning), so if a condition handler
- caught, we have lost the result code.
- */
- if (!res)
- {
- uint dummy1, dummy2;
-
- if (thd->spcont->found_handler(&dummy1, &dummy2))
- res= -1;
- }
/* TODO: Assert here that we either have an error or a cursor */
}
DBUG_RETURN(res);
@@ -3748,13 +3857,11 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp)
{
int res= thd->spcont->set_case_expr(thd, m_case_expr_id, &m_case_expr);
- if (res &&
- !thd->spcont->get_case_expr(m_case_expr_id) &&
- thd->spcont->found_handler_here())
+ if (res && !thd->spcont->get_case_expr(m_case_expr_id))
{
/*
Failed to evaluate the value, the case expression is still not
- initialized, and a handler has been found. Set to NULL so we can continue.
+ initialized. Set to NULL so we can continue.
*/
Item *null_item= new Item_null();
@@ -3763,13 +3870,7 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp)
thd->spcont->set_case_expr(thd, m_case_expr_id, &null_item))
{
/* If this also failed, we have to abort. */
-
- sp_rcontext *spcont= thd->spcont;
-
- thd->spcont= NULL; /* Avoid handlers */
- my_error(ER_OUT_OF_RESOURCES, MYF(0));
- spcont->clear_handler();
- thd->spcont= spcont;
+ my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
}
}
else
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 9796c49fdfb..b2446c8f680 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -682,6 +682,8 @@ public:
{
if (m_lex_resp)
{
+ /* Prevent endless recursion. */
+ m_lex->sphead= NULL;
lex_end(m_lex);
delete m_lex;
}
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h
index b12d5362c6b..c27c7d22da2 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -332,13 +332,6 @@ public:
int
push_cond(LEX_STRING *name, sp_cond_type_t *val);
- inline void
- pop_cond(uint num)
- {
- while (num--)
- pop_dynamic(&m_conds);
- }
-
sp_cond_type_t *
find_cond(LEX_STRING *name, my_bool scoped=0);
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index 047cec76486..e76a5e9ebde 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -171,48 +171,50 @@ sp_rcontext::set_return_value(THD *thd, Item **return_value_item)
#define IS_NOT_FOUND_CONDITION(S) ((S)[0] == '0' && (S)[1] == '2')
#define IS_EXCEPTION_CONDITION(S) ((S)[0] != '0' || (S)[1] > '2')
-/*
- Find a handler for the given errno.
- This is called from all error message functions (e.g. push_warning,
- net_send_error, et al) when a sp_rcontext is in effect. If a handler
- is found, no error is sent, and the the SP execution loop will instead
- invoke the found handler.
- This might be called several times before we get back to the execution
- loop, so m_hfound can be >= 0 if a handler has already been found.
- (In which case we don't search again - the first found handler will
- be used.)
- Handlers are pushed on the stack m_handler, with the latest/innermost
+/**
+ Find an SQL handler for the given error.
+
+ SQL handlers are pushed on the stack m_handler, with the latest/innermost
one on the top; we then search for matching handlers from the top and
down.
+
We search through all the handlers, looking for the most specific one
(sql_errno more specific than sqlstate more specific than the rest).
Note that mysql error code handlers is a MySQL extension, not part of
the standard.
- SYNOPSIS
- sql_errno The error code
- level Warning level
+ SQL handlers for warnings are searched in the current scope only.
- RETURN
- 1 if a handler was found, m_hfound is set to its index (>= 0)
- 0 if not found, m_hfound is -1
+ SQL handlers for errors are searched in the current and in outer scopes.
+ That's why finding and activation of handler must be separated: an errror
+ handler might be located in the outer scope, which is not active at the
+ moment. Before such handler can be activated, execution flow should
+ unwind to that scope.
+
+ Found SQL handler is remembered in m_hfound for future activation.
+ If no handler is found, m_hfound is -1.
+
+ @param thd Thread handle
+ @param sql_errno The error code
+ @param sqlstate The error SQL state
+ @param level The error level
+ @param msg The error message
+
+ @retval TRUE if an SQL handler was found
+ @retval FALSE otherwise
*/
bool
sp_rcontext::find_handler(THD *thd,
uint sql_errno,
- const char* sqlstate,
+ const char *sqlstate,
MYSQL_ERROR::enum_warning_level level,
- const char* msg,
- MYSQL_ERROR ** cond_hdl)
+ const char *msg)
{
- if (m_hfound >= 0)
- {
- *cond_hdl= NULL;
- return TRUE; // Already got one
- }
+ int i= m_hcount;
- int i= m_hcount, found= -1;
+ /* Reset previously found handler. */
+ m_hfound= -1;
/*
If this is a fatal sub-statement error, and this runtime
@@ -240,105 +242,56 @@ sp_rcontext::find_handler(THD *thd,
{
case sp_cond_type_t::number:
if (sql_errno == cond->mysqlerr &&
- (found < 0 || m_handler[found].cond->type > sp_cond_type_t::number))
- found= i; // Always the most specific
+ (m_hfound < 0 || m_handler[m_hfound].cond->type > sp_cond_type_t::number))
+ m_hfound= i; // Always the most specific
break;
case sp_cond_type_t::state:
if (strcmp(sqlstate, cond->sqlstate) == 0 &&
- (found < 0 || m_handler[found].cond->type > sp_cond_type_t::state))
- found= i;
+ (m_hfound < 0 || m_handler[m_hfound].cond->type > sp_cond_type_t::state))
+ m_hfound= i;
break;
case sp_cond_type_t::warning:
if ((IS_WARNING_CONDITION(sqlstate) ||
level == MYSQL_ERROR::WARN_LEVEL_WARN) &&
- found < 0)
- found= i;
+ m_hfound < 0)
+ m_hfound= i;
break;
case sp_cond_type_t::notfound:
- if (IS_NOT_FOUND_CONDITION(sqlstate) && found < 0)
- found= i;
+ if (IS_NOT_FOUND_CONDITION(sqlstate) && m_hfound < 0)
+ m_hfound= i;
break;
case sp_cond_type_t::exception:
if (IS_EXCEPTION_CONDITION(sqlstate) &&
level == MYSQL_ERROR::WARN_LEVEL_ERROR &&
- found < 0)
- found= i;
+ m_hfound < 0)
+ m_hfound= i;
break;
}
}
- if (found < 0)
- {
- /*
- Only "exception conditions" are propagated to handlers in calling
- contexts. If no handler is found locally for a "completion condition"
- (warning or "not found") we will simply resume execution.
- */
- if (m_prev_runtime_ctx && IS_EXCEPTION_CONDITION(sqlstate) &&
- level == MYSQL_ERROR::WARN_LEVEL_ERROR)
- return m_prev_runtime_ctx->find_handler(thd,
- sql_errno,
- sqlstate,
- level,
- msg,
- cond_hdl);
- *cond_hdl= NULL;
- return FALSE;
- }
-
- m_hfound= found;
- MYSQL_ERROR *raised= NULL;
- DBUG_ASSERT(m_hfound >= 0);
- DBUG_ASSERT((uint) m_hfound < m_root_parsing_ctx->max_handler_index());
- raised= & m_raised_conditions[m_hfound];
- raised->clear();
- raised->set(sql_errno, sqlstate, level, msg);
-
- *cond_hdl= raised;
- return TRUE;
-}
-
-/*
- Handle the error for a given errno.
- The severity of the error is adjusted depending of the current sql_mode.
- If an handler is present for the error (see find_handler()),
- this function will return true.
- If a handler is found and if the severity of the error indicate
- that the current instruction executed should abort,
- the flag thd->net.report_error is also set.
- This will cause the execution of the current instruction in a
- sp_instr* to fail, and give control to the handler code itself
- in the sp_head::execute() loop.
-
- SYNOPSIS
- sql_errno The error code
- level Warning level
- thd The current thread
+ if (m_hfound >= 0)
+ {
+ DBUG_ASSERT((uint) m_hfound < m_root_parsing_ctx->max_handler_index());
- RETURN
- TRUE if a handler was found.
- FALSE if no handler was found.
-*/
-bool
-sp_rcontext::handle_condition(THD *thd,
- uint sql_errno,
- const char* sqlstate,
- MYSQL_ERROR::enum_warning_level level,
- const char* msg,
- MYSQL_ERROR ** cond_hdl)
-{
- MYSQL_ERROR::enum_warning_level elevated_level= level;
+ m_raised_conditions[m_hfound].clear();
+ m_raised_conditions[m_hfound].set(sql_errno, sqlstate, level, msg);
+ return TRUE;
+ }
- /* Depending on the sql_mode of execution,
- warnings may be considered errors */
- if ((level == MYSQL_ERROR::WARN_LEVEL_WARN) &&
- thd->really_abort_on_warning())
+ /*
+ Only "exception conditions" are propagated to handlers in calling
+ contexts. If no handler is found locally for a "completion condition"
+ (warning or "not found") we will simply resume execution.
+ */
+ if (m_prev_runtime_ctx && IS_EXCEPTION_CONDITION(sqlstate) &&
+ level == MYSQL_ERROR::WARN_LEVEL_ERROR)
{
- elevated_level= MYSQL_ERROR::WARN_LEVEL_ERROR;
+ return m_prev_runtime_ctx->find_handler(thd, sql_errno, sqlstate,
+ level, msg);
}
- return find_handler(thd, sql_errno, sqlstate, elevated_level, msg, cond_hdl);
+ return FALSE;
}
void
@@ -384,7 +337,9 @@ sp_rcontext::pop_handlers(uint count)
{
DBUG_ENTER("sp_rcontext::pop_handlers");
DBUG_ASSERT(m_hcount >= count);
+
m_hcount-= count;
+
DBUG_PRINT("info", ("m_hcount: %d", m_hcount));
DBUG_VOID_RETURN;
}
@@ -394,7 +349,9 @@ sp_rcontext::push_hstack(uint h)
{
DBUG_ENTER("sp_rcontext::push_hstack");
DBUG_ASSERT(m_hsp < m_root_parsing_ctx->max_handler_index());
+
m_hstack[m_hsp++]= h;
+
DBUG_PRINT("info", ("m_hsp: %d", m_hsp));
DBUG_VOID_RETURN;
}
@@ -405,21 +362,74 @@ sp_rcontext::pop_hstack()
uint handler;
DBUG_ENTER("sp_rcontext::pop_hstack");
DBUG_ASSERT(m_hsp);
+
handler= m_hstack[--m_hsp];
+
DBUG_PRINT("info", ("m_hsp: %d", m_hsp));
DBUG_RETURN(handler);
}
-void
-sp_rcontext::enter_handler(uint hip, uint hindex)
+/**
+ Prepare found handler to be executed.
+
+ @retval TRUE if an SQL handler is activated (was found) and IP of the
+ first handler instruction.
+ @retval FALSE if there is no active handler
+*/
+
+bool
+sp_rcontext::activate_handler(THD *thd,
+ uint *ip,
+ sp_instr *instr,
+ Query_arena *execute_arena,
+ Query_arena *backup_arena)
{
- DBUG_ENTER("sp_rcontext::enter_handler");
- DBUG_ASSERT(m_ihsp < m_root_parsing_ctx->max_handler_index());
- m_in_handler[m_ihsp].ip= hip;
- m_in_handler[m_ihsp].index= hindex;
- m_ihsp++;
- DBUG_PRINT("info", ("m_ihsp: %d", m_ihsp));
- DBUG_VOID_RETURN;
+ if (m_hfound < 0)
+ return FALSE;
+
+ switch (m_handler[m_hfound].type) {
+ case SP_HANDLER_NONE:
+ break;
+
+ case SP_HANDLER_CONTINUE:
+ thd->restore_active_arena(execute_arena, backup_arena);
+ thd->set_n_backup_active_arena(execute_arena, backup_arena);
+ push_hstack(instr->get_cont_dest());
+
+ /* Fall through */
+
+ default:
+ /* End aborted result set. */
+
+ if (end_partial_result_set)
+ thd->protocol->end_partial_result_set(thd);
+
+ /* Enter handler. */
+
+ DBUG_ASSERT(m_ihsp < m_root_parsing_ctx->max_handler_index());
+ DBUG_ASSERT(m_hfound >= 0);
+
+ m_in_handler[m_ihsp].ip= m_handler[m_hfound].handler;
+ m_in_handler[m_ihsp].index= m_hfound;
+ m_ihsp++;
+
+ DBUG_PRINT("info", ("Entering handler..."));
+ DBUG_PRINT("info", ("m_ihsp: %d", m_ihsp));
+
+ /* Reset error state. */
+
+ thd->clear_error();
+ thd->killed= THD::NOT_KILLED; // Some errors set thd->killed
+ // (e.g. "bad data").
+
+ /* Return IP of the activated SQL handler. */
+ *ip= m_handler[m_hfound].handler;
+
+ /* Reset found handler. */
+ m_hfound= -1;
+ }
+
+ return TRUE;
}
void
@@ -427,9 +437,11 @@ sp_rcontext::exit_handler()
{
DBUG_ENTER("sp_rcontext::exit_handler");
DBUG_ASSERT(m_ihsp);
+
uint hindex= m_in_handler[m_ihsp-1].index;
m_raised_conditions[hindex].clear();
m_ihsp-= 1;
+
DBUG_PRINT("info", ("m_ihsp: %d", m_ihsp));
DBUG_VOID_RETURN;
}
@@ -525,8 +537,7 @@ sp_cursor::open(THD *thd)
MYF(0));
return -1;
}
- if (mysql_open_cursor(thd, (uint) ALWAYS_MATERIALIZED_CURSOR, &result,
- &server_side_cursor))
+ if (mysql_open_cursor(thd, &result, &server_side_cursor))
return -1;
return 0;
}
@@ -568,6 +579,11 @@ sp_cursor::fetch(THD *thd, List<struct sp_variable> *vars)
return -1;
}
+ DBUG_EXECUTE_IF("bug23032_emit_warning",
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_UNKNOWN_ERROR,
+ ER(ER_UNKNOWN_ERROR)););
+
result.set_spvar_list(vars);
/* Attempt to fetch one row */
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index fad253706cb..1af758ed0af 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -131,67 +131,40 @@ class sp_rcontext : public Sql_alloc
return m_return_value_set;
}
+ /*
+ SQL handlers support.
+ */
+
void push_handler(struct sp_cond_type *cond, uint h, int type);
void pop_handlers(uint count);
- // Returns 1 if a handler was found, 0 otherwise.
bool
find_handler(THD *thd,
uint sql_errno,
- const char* sqlstate,
+ const char *sqlstate,
MYSQL_ERROR::enum_warning_level level,
- const char* msg,
- MYSQL_ERROR ** cond_hdl);
+ const char *msg);
- // If there is an error handler for this error, handle it and return TRUE.
- 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 handler type and sets *ip to location if one was found
- inline int
- found_handler(uint *ip, uint *index)
- {
- if (m_hfound < 0)
- return SP_HANDLER_NONE;
- *ip= m_handler[m_hfound].handler;
- *index= m_hfound;
- return m_handler[m_hfound].type;
- }
-
- MYSQL_ERROR* raised_condition() const;
-
- // Returns true if we found a handler in this context
- inline bool
- found_handler_here()
- {
- return (m_hfound >= 0);
- }
+ MYSQL_ERROR *
+ raised_condition() const;
- // Clears the handler find state
- inline void
- clear_handler()
- {
- m_hfound= -1;
- }
+ void
+ push_hstack(uint h);
- void push_hstack(uint h);
+ uint
+ pop_hstack();
- uint pop_hstack();
+ bool
+ activate_handler(THD *thd,
+ uint *ip,
+ sp_instr *instr,
+ Query_arena *execute_arena,
+ Query_arena *backup_arena);
- /**
- Enter a SQL exception handler.
- @param hip the handler instruction pointer
- @param index the handler index
- */
- void enter_handler(uint hip, uint index);
- void exit_handler();
+ void
+ exit_handler();
void
push_cursor(sp_lex_keeper *lex_keeper, sp_instr_cpush *i);
@@ -199,7 +172,7 @@ class sp_rcontext : public Sql_alloc
void
pop_cursors(uint count);
- void
+ inline void
pop_all_cursors()
{
pop_cursors(m_ccount);
diff --git a/sql/spatial.cc b/sql/spatial.cc
index f96196cb836..f1dd0e6cebd 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -142,11 +142,10 @@ Geometry *Geometry::construct(Geometry_buffer *buffer,
{
uint32 geom_type;
Geometry *result;
- char byte_order;
if (data_len < SRID_SIZE + WKB_HEADER_SIZE) // < 4 + (1 + 4)
return NULL;
- byte_order= data[SRID_SIZE];
+ /* + 1 to skip the byte order (stored in position SRID_SIZE). */
geom_type= uint4korr(data + SRID_SIZE + 1);
if (!(result= create_by_typeid(buffer, (int) geom_type)))
return NULL;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 074f1047d67..19373507955 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -27,7 +27,7 @@
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "sql_acl.h" // MYSQL_DB_FIELD_COUNT, ACL_ACCESS
-#include "sql_base.h" // close_thread_tables
+#include "sql_base.h" // close_mysql_tables
#include "key.h" // key_copy, key_cmp_if_same, key_restore
#include "sql_show.h" // append_identifier
#include "sql_table.h" // build_table_filename
@@ -678,16 +678,15 @@ my_bool acl_reload(THD *thd)
To avoid deadlocks we should obtain table locks before
obtaining acl_cache->lock mutex.
*/
- bzero((char*) tables, sizeof(tables));
- tables[0].alias= tables[0].table_name= (char*) "host";
- tables[1].alias= tables[1].table_name= (char*) "user";
- tables[2].alias= tables[2].table_name= (char*) "db";
- tables[0].db=tables[1].db=tables[2].db=(char*) "mysql";
+ tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("host"), "host", TL_READ);
+ tables[1].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("user"), "user", TL_READ);
+ tables[2].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("db"), "db", TL_READ);
tables[0].next_local= tables[0].next_global= tables+1;
tables[1].next_local= tables[1].next_global= tables+2;
- tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
tables[0].open_type= tables[1].open_type= tables[2].open_type= OT_BASE_ONLY;
- init_mdl_requests(tables);
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{
@@ -731,9 +730,7 @@ my_bool acl_reload(THD *thd)
if (old_initialized)
mysql_mutex_unlock(&acl_cache->lock);
end:
- trans_commit_implicit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ close_mysql_tables(thd);
DBUG_RETURN(return_val);
}
@@ -1586,6 +1583,7 @@ bool change_password(THD *thd, const char *host, const char *user,
/* Buffer should be extended when password length is extended. */
char buff[512];
ulong query_length;
+ bool save_binlog_row_based;
uint new_password_len= (uint) strlen(new_password);
bool result= 1;
DBUG_ENTER("change_password");
@@ -1615,10 +1613,17 @@ bool change_password(THD *thd, const char *host, const char *user,
DBUG_RETURN(0);
}
#endif
-
if (!(table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(1);
+ /*
+ This statement will be replicated as a statement, even when using
+ row-based replication. The flag will be reset at the end of the
+ statement.
+ */
+ if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
+ thd->clear_current_stmt_binlog_format_row();
+
mysql_mutex_lock(&acl_cache->lock);
ACL_USER *acl_user;
if (!(acl_user= find_acl_user(host, user, TRUE)))
@@ -1653,7 +1658,13 @@ bool change_password(THD *thd, const char *host, const char *user,
FALSE, FALSE, FALSE, 0);
}
end:
- close_thread_tables(thd);
+ close_mysql_tables(thd);
+
+ /* Restore the state of binlog format */
+ DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
+ if (save_binlog_row_based)
+ thd->set_current_stmt_binlog_format_row();
+
DBUG_RETURN(result);
}
@@ -1924,9 +1935,8 @@ static bool test_if_create_new_users(THD *thd)
{
TABLE_LIST tl;
ulong db_access;
- bzero((char*) &tl,sizeof(tl));
- tl.db= (char*) "mysql";
- tl.table_name= (char*) "user";
+ tl.init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("user"), "user", TL_WRITE);
create_new_users= 1;
db_access=acl_get(sctx->host, sctx->ip,
@@ -3062,7 +3072,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
class LEX_COLUMN *column;
List_iterator <LEX_COLUMN> column_iter(columns);
- if (open_and_lock_tables(thd, table_list, TRUE, 0))
+ if (open_normal_and_derived_tables(thd, table_list, 0))
DBUG_RETURN(TRUE);
while ((column = column_iter++))
@@ -3084,7 +3094,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN(TRUE);
column_priv|= column->rights;
}
- close_thread_tables(thd);
+ close_mysql_tables(thd);
}
else
{
@@ -3116,20 +3126,18 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
/* open the mysql.tables_priv and mysql.columns_priv tables */
- bzero((char*) &tables,sizeof(tables));
- tables[0].alias=tables[0].table_name= (char*) "user";
- tables[1].alias=tables[1].table_name= (char*) "tables_priv";
- tables[2].alias=tables[2].table_name= (char*) "columns_priv";
+ tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("user"), "user", TL_WRITE);
+ tables[1].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("tables_priv"),
+ "tables_priv", TL_WRITE);
+ tables[2].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("columns_priv"),
+ "columns_priv", TL_WRITE);
tables[0].next_local= tables[0].next_global= tables+1;
/* Don't open column table if we don't need it ! */
- tables[1].next_local=
- tables[1].next_global= ((column_priv ||
- (revoke_grant &&
- ((rights & COL_ACLS) || columns.elements)))
- ? tables+2 : 0);
- tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE;
- tables[0].db=tables[1].db=tables[2].db=(char*) "mysql";
- init_mdl_requests(tables);
+ if (column_priv || (revoke_grant && ((rights & COL_ACLS) || columns.elements)))
+ tables[1].next_local= tables[1].next_global= tables+2;
/*
This statement will be replicated as a statement, even when using
@@ -3176,7 +3184,6 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
thd->lex->sql_command= backup.sql_command;
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // Should never happen
- close_thread_tables(thd); /* purecov: deadcode */
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -3363,13 +3370,11 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
/* open the mysql.user and mysql.procs_priv tables */
- bzero((char*) &tables,sizeof(tables));
- tables[0].alias=tables[0].table_name= (char*) "user";
- tables[1].alias=tables[1].table_name= (char*) "procs_priv";
+ tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("user"), "user", TL_WRITE);
+ tables[1].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("procs_priv"), "procs_priv", TL_WRITE);
tables[0].next_local= tables[0].next_global= tables+1;
- tables[0].lock_type=tables[1].lock_type=TL_WRITE;
- tables[0].db=tables[1].db=(char*) "mysql";
- init_mdl_requests(tables);
/*
This statement will be replicated as a statement, even when using
@@ -3404,7 +3409,6 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // Should never happen
- close_thread_tables(thd);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -3520,13 +3524,11 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
}
/* open the mysql.user and mysql.db tables */
- bzero((char*) &tables,sizeof(tables));
- tables[0].alias=tables[0].table_name=(char*) "user";
- tables[1].alias=tables[1].table_name=(char*) "db";
+ tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("user"), "user", TL_WRITE);
+ tables[1].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("db"), "db", TL_WRITE);
tables[0].next_local= tables[0].next_global= tables+1;
- tables[0].lock_type=tables[1].lock_type=TL_WRITE;
- tables[0].db=tables[1].db=(char*) "mysql";
- init_mdl_requests(tables);
/*
This statement will be replicated as a statement, even when using
@@ -3561,7 +3563,6 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // This should never happen
- close_thread_tables(thd); /* purecov: deadcode */
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -3621,7 +3622,6 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
}
mysql_rwlock_unlock(&LOCK_grant);
- close_thread_tables(thd);
if (!result)
my_ok(thd);
@@ -3882,10 +3882,7 @@ static my_bool grant_reload_procs_priv(THD *thd)
table.open_type= OT_BASE_ONLY;
if (open_and_lock_tables(thd, &table, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
- {
- close_thread_tables(thd);
DBUG_RETURN(TRUE);
- }
mysql_rwlock_wrlock(&LOCK_grant);
/* Save a copy of the current hash if we need to undo the grant load */
@@ -3907,7 +3904,7 @@ static my_bool grant_reload_procs_priv(THD *thd)
}
mysql_rwlock_unlock(&LOCK_grant);
- close_thread_tables(thd);
+ close_mysql_tables(thd);
DBUG_RETURN(return_val);
}
@@ -3939,14 +3936,14 @@ my_bool grant_reload(THD *thd)
if (!initialized)
DBUG_RETURN(0);
- bzero((char*) tables, sizeof(tables));
- tables[0].alias= tables[0].table_name= (char*) "tables_priv";
- tables[1].alias= tables[1].table_name= (char*) "columns_priv";
- tables[0].db= tables[1].db= (char *) "mysql";
+ tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("tables_priv"),
+ "tables_priv", TL_READ);
+ tables[1].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("columns_priv"),
+ "columns_priv", TL_READ);
tables[0].next_local= tables[0].next_global= tables+1;
- tables[0].lock_type= tables[1].lock_type= TL_READ;
tables[0].open_type= tables[1].open_type= OT_BASE_ONLY;
- init_mdl_requests(tables);
/*
To avoid deadlocks we should obtain table locks before
@@ -3978,9 +3975,7 @@ my_bool grant_reload(THD *thd)
free_root(&old_mem,MYF(0));
}
mysql_rwlock_unlock(&LOCK_grant);
- trans_commit_implicit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ close_mysql_tables(thd);
/*
It is OK failing to load procs_priv table because we may be
@@ -5218,22 +5213,23 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
DBUG_RETURN(-1);
}
- bzero((char*) tables, GRANT_TABLES*sizeof(*tables));
- tables->alias= tables->table_name= (char*) "user";
- (tables+1)->alias= (tables+1)->table_name= (char*) "db";
- (tables+2)->alias= (tables+2)->table_name= (char*) "tables_priv";
- (tables+3)->alias= (tables+3)->table_name= (char*) "columns_priv";
- (tables+4)->alias= (tables+4)->table_name= (char*) "procs_priv";
+ tables->init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("user"), "user", TL_WRITE);
+ (tables+1)->init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("db"), "db", TL_WRITE);
+ (tables+2)->init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("tables_priv"),
+ "tables_priv", TL_WRITE);
+ (tables+3)->init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("columns_priv"),
+ "columns_priv", TL_WRITE);
+ (tables+4)->init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("procs_priv"),
+ "procs_priv", TL_WRITE);
tables->next_local= tables->next_global= tables+1;
(tables+1)->next_local= (tables+1)->next_global= tables+2;
(tables+2)->next_local= (tables+2)->next_global= tables+3;
(tables+3)->next_local= (tables+3)->next_global= tables+4;
- tables->lock_type= (tables+1)->lock_type=
- (tables+2)->lock_type= (tables+3)->lock_type=
- (tables+4)->lock_type= TL_WRITE;
- tables->db= (tables+1)->db= (tables+2)->db=
- (tables+3)->db= (tables+4)->db= (char*) "mysql";
- init_mdl_requests(tables);
#ifdef HAVE_REPLICATION
/*
@@ -5257,7 +5253,6 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // This should never happen
- close_thread_tables(thd);
DBUG_RETURN(-1);
}
@@ -5831,7 +5826,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
{
int result;
String wrong_users;
- ulong sql_mode;
LEX_USER *user_name, *tmp_user_name;
List_iterator <LEX_USER> user_list(list);
TABLE_LIST tables[GRANT_TABLES];
@@ -5880,7 +5874,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
}
some_users_created= TRUE;
- sql_mode= thd->variables.sql_mode;
if (replace_user_table(thd, tables[0].table, *user_name, 0, 0, 1, 0))
{
append_user(&wrong_users, user_name);
@@ -5897,7 +5890,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length());
mysql_rwlock_unlock(&LOCK_grant);
- close_thread_tables(thd);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -5982,7 +5974,6 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length());
mysql_rwlock_unlock(&LOCK_grant);
- close_thread_tables(thd);
thd->variables.sql_mode= old_sql_mode;
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
@@ -6079,7 +6070,6 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length());
mysql_rwlock_unlock(&LOCK_grant);
- close_thread_tables(thd);
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -6277,8 +6267,6 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
mysql_rwlock_unlock(&LOCK_grant);
- close_thread_tables(thd);
-
/* Restore the state of binlog format */
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
@@ -6425,7 +6413,6 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
mysql_mutex_unlock(&acl_cache->lock);
mysql_rwlock_unlock(&LOCK_grant);
- close_thread_tables(thd);
thd->pop_internal_handler();
/* Restore the state of binlog format */
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
new file mode 100644
index 00000000000..6f0405bd4a8
--- /dev/null
+++ b/sql/sql_admin.cc
@@ -0,0 +1,1004 @@
+/* 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);
+ 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);
+}
+
+
+/*
+ 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_base.cc b/sql/sql_base.cc
index 14cd8dd6354..e091c26592e 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -53,6 +53,7 @@
#include "rpl_filter.h"
#include "sql_table.h" // build_table_filename
#include "datadict.h" // dd_frm_type()
+#include "sql_hset.h" // Hash_set
#ifdef __WIN__
#include <io.h>
#endif
@@ -755,27 +756,6 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
}
-#ifdef DISABLED_UNTIL_GRL_IS_MADE_PART_OF_MDL
-/**
- @brief Mark table share as having one more user (increase its reference
- count).
-
- @param share Table share for which reference count should be increased.
-*/
-
-static void reference_table_share(TABLE_SHARE *share)
-{
- DBUG_ENTER("reference_table_share");
- DBUG_ASSERT(share->ref_count);
- mysql_mutex_assert_owner(&LOCK_open);
- share->ref_count++;
- DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
- (ulong) share, share->ref_count));
- DBUG_VOID_RETURN;
-}
-#endif
-
-
/*
Create a list for all open tables matching SQL expression
@@ -1422,6 +1402,9 @@ void close_thread_tables(THD *thd)
DEBUG_SYNC(thd, "before_close_thread_tables");
#endif
+ DBUG_ASSERT(thd->transaction.stmt.is_empty() || thd->in_sub_stmt ||
+ (thd->state_flags & Open_tables_state::BACKUPS_AVAIL));
+
/* Detach MERGE children after every statement. Even under LOCK TABLES. */
for (table= thd->open_tables; table; table= table->next)
{
@@ -1466,28 +1449,6 @@ void close_thread_tables(THD *thd)
Mark all temporary tables used by this statement as free for reuse.
*/
mark_temp_tables_as_free_for_reuse(thd);
- /*
- Let us commit transaction for statement. Since in 5.0 we only have
- one statement transaction and don't allow several nested statement
- transactions this call will do nothing if we are inside of stored
- function or trigger (i.e. statement transaction is already active and
- does not belong to statement for which we do close_thread_tables()).
- TODO: This should be fixed in later releases.
- */
- if (!(thd->state_flags & Open_tables_state::BACKUPS_AVAIL))
- {
- thd->stmt_da->can_overwrite_status= TRUE;
- thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
-
- /*
- Reset transaction state, but only if we're not inside a
- sub-statement of a prelocked statement.
- */
- if (thd->locked_tables_mode <= LTM_LOCK_TABLES ||
- thd->lex->requires_prelocking())
- thd->transaction.stmt.reset();
- }
if (thd->locked_tables_mode)
{
@@ -1548,26 +1509,6 @@ void close_thread_tables(THD *thd)
if (thd->open_tables)
close_open_tables(thd);
- /*
- - If inside a multi-statement transaction,
- defer the release of metadata locks until the current
- transaction is either committed or rolled back. This prevents
- other statements from modifying the table for the entire
- duration of this transaction. This provides commit ordering
- and guarantees serializability across multiple transactions.
- - If closing a system table, defer the release of metadata locks
- to the caller. We have no sentinel in MDL subsystem to guard
- transactional locks from system tables locks, so don't know
- which locks are which here.
- - If in autocommit mode, or outside a transactional context,
- automatically release metadata locks of the current statement.
- */
- if (! thd->in_multi_stmt_transaction_mode() &&
- ! (thd->state_flags & Open_tables_state::BACKUPS_AVAIL))
- {
- thd->mdl_context.release_transactional_locks();
- }
-
DBUG_VOID_RETURN;
}
@@ -1582,7 +1523,14 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
DBUG_ASSERT(table->key_read == 0);
DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
mysql_mutex_assert_not_owner(&LOCK_open);
-
+ /*
+ The metadata lock must be released after giving back
+ the table to the table cache.
+ */
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE,
+ table->s->db.str,
+ table->s->table_name.str,
+ MDL_SHARED));
table->mdl_ticket= NULL;
mysql_mutex_lock(&thd->LOCK_thd_data);
@@ -1827,15 +1775,13 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
}
-/*
+/**
Test that table is unique (It's only exists once in the table list)
- SYNOPSIS
- unique_table()
- thd thread handle
- table table which should be checked
- table_list list of tables
- check_alias whether to check tables' aliases
+ @param thd thread handle
+ @param table table which should be checked
+ @param table_list list of tables
+ @param check_alias whether to check tables' aliases
NOTE: to exclude derived tables from check we use following mechanism:
a) during derived table processing set THD::derived_tables_processing
@@ -1846,7 +1792,7 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
processing loop, because multi-update call fix_fields() for some its
items (which mean JOIN::prepare for subqueries) before unique_table
call to detect which tables should be locked for write).
- c) unique_table skip all tables which belong to SELECT with
+ c) find_dup_table skip all tables which belong to SELECT with
SELECT::exclude_from_table_unique_test set.
Also SELECT::exclude_from_table_unique_test used to exclude from check
tables of main SELECT of multi-delete and multi-update
@@ -1858,17 +1804,17 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
TODO: when we will have table/view change detection we can do this check
only once for PS/SP
- RETURN
- found duplicate
- 0 if table is unique
+ @retval !=0 found duplicate
+ @retval 0 if table is unique
*/
-TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
- bool check_alias)
+static
+TABLE_LIST* find_dup_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
+ bool check_alias)
{
TABLE_LIST *res;
const char *d_name, *t_name, *t_alias;
- DBUG_ENTER("unique_table");
+ DBUG_ENTER("find_dup_table");
DBUG_PRINT("enter", ("table alias: %s", table->alias));
/*
@@ -1883,6 +1829,9 @@ TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
*/
if (table->table)
{
+ /* All MyISAMMRG children are plain MyISAM tables. */
+ DBUG_ASSERT(table->table->file->ht->db_type != DB_TYPE_MRG_MYISAM);
+
/* temporary table is always unique */
if (table->table && table->table->s->tmp_table != NO_TMP_TABLE)
DBUG_RETURN(0);
@@ -1904,8 +1853,7 @@ TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
Table is unique if it is present only once in the global list
of tables and once in the list of table locks.
*/
- if (! (res= find_table_in_global_list(table_list, d_name, t_name)) &&
- ! (res= mysql_lock_have_duplicate(thd, table, table_list)))
+ if (! (res= find_table_in_global_list(table_list, d_name, t_name)))
break;
/* Skip if same underlying table. */
@@ -1944,6 +1892,42 @@ next:
}
+/**
+ Test that the subject table of INSERT/UPDATE/DELETE/CREATE
+ or (in case of MyISAMMRG) one of its children are not used later
+ in the query.
+
+ For MyISAMMRG tables, it is assumed that all the underlying
+ tables of @c table (if any) are listed right after it and that
+ their @c parent_l field points at the main table.
+
+
+ @retval non-NULL The table list element for the table that
+ represents the duplicate.
+ @retval NULL No duplicates found.
+*/
+
+TABLE_LIST*
+unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
+ bool check_alias)
+{
+ TABLE_LIST *dup;
+ if (table->table && table->table->file->ht->db_type == DB_TYPE_MRG_MYISAM)
+ {
+ TABLE_LIST *child;
+ dup= NULL;
+ /* Check duplicates of all merge children. */
+ for (child= table->next_global; child && child->parent_l == table;
+ child= child->next_global)
+ {
+ if ((dup= find_dup_table(thd, child, child->next_global, check_alias)))
+ break;
+ }
+ }
+ else
+ dup= find_dup_table(thd, table, table_list, check_alias);
+ return dup;
+}
/*
Issue correct error message in case we found 2 duplicate tables which
prevent some update operation
@@ -2271,51 +2255,6 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
}
-/*
- Wait for condition but allow the user to send a kill to mysqld
-
- SYNOPSIS
- wait_for_condition()
- thd Thread handler
- mutex mutex that is currently hold that is associated with condition
- Will be unlocked on return
- cond Condition to wait for
-*/
-
-void wait_for_condition(THD *thd, mysql_mutex_t *mutex, mysql_cond_t *cond)
-{
- /* Wait until the current table is up to date */
- const char *proc_info;
- thd->mysys_var->current_mutex= mutex;
- thd->mysys_var->current_cond= cond;
- proc_info=thd->proc_info;
- thd_proc_info(thd, "Waiting for table");
- DBUG_ENTER("wait_for_condition");
- DEBUG_SYNC(thd, "waiting_for_table");
- if (!thd->killed)
- mysql_cond_wait(cond, mutex);
-
- /*
- We must unlock mutex first to avoid deadlock becasue conditions are
- sent to this thread by doing locks in the following order:
- lock(mysys_var->mutex)
- lock(mysys_var->current_mutex)
-
- One by effect of this that one can only use wait_for_condition with
- condition variables that are guranteed to not disapper (freed) even if this
- mutex is unlocked
- */
-
- mysql_mutex_unlock(mutex);
- mysql_mutex_lock(&thd->mysys_var->mutex);
- thd->mysys_var->current_mutex= 0;
- thd->mysys_var->current_cond= 0;
- thd_proc_info(thd, proc_info);
- mysql_mutex_unlock(&thd->mysys_var->mutex);
- DBUG_VOID_RETURN;
-}
-
-
/**
Check that table exists in table definition cache, on disk
or in some storage engine.
@@ -2381,20 +2320,6 @@ end:
/**
- @brief Helper function used by MDL subsystem for releasing TABLE_SHARE
- objects in cases when it no longer wants to cache reference to it.
-*/
-
-void table_share_release_hook(void *share)
-{
- mysql_mutex_lock(&LOCK_open);
- release_table_share((TABLE_SHARE*) share);
- broadcast_refresh();
- mysql_mutex_unlock(&LOCK_open);
-}
-
-
-/**
An error handler which converts, if possible, ER_LOCK_DEADLOCK error
that can occur when we are trying to acquire a metadata lock to
a request for back-off and re-start of open_tables() process.
@@ -2886,96 +2811,61 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
DBUG_RETURN(FALSE);
mysql_mutex_lock(&LOCK_open);
-#ifdef DISABLED_UNTIL_GRL_IS_MADE_PART_OF_MDL
- if (!(share= (TABLE_SHARE *) mdl_ticket->get_cached_object()))
-#endif
- {
- if (!(share= get_table_share_with_create(thd, table_list, key,
- key_length, OPEN_VIEW,
- &error,
- hash_value)))
- goto err_unlock2;
-
- if (share->is_view)
- {
- /*
- If parent_l of the table_list is non null then a merge table
- has this view as child table, which is not supported.
- */
- if (table_list->parent_l)
- {
- my_error(ER_WRONG_MRG_TABLE, MYF(0));
- goto err_unlock;
- }
- /*
- This table is a view. Validate its metadata version: in particular,
- that it was a view when the statement was prepared.
- */
- if (check_and_update_table_version(thd, table_list, share))
- goto err_unlock;
- if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
- goto err_unlock;
-
- /* Open view */
- if (open_new_frm(thd, share, alias,
- (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
- HA_GET_INDEX | HA_TRY_READ_ONLY),
- READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
- thd->open_options,
- 0, table_list, mem_root))
- goto err_unlock;
-
- /* TODO: Don't free this */
- release_table_share(share);
-
- DBUG_ASSERT(table_list->view);
+ if (!(share= get_table_share_with_create(thd, table_list, key,
+ key_length, OPEN_VIEW,
+ &error,
+ hash_value)))
+ goto err_unlock2;
- mysql_mutex_unlock(&LOCK_open);
- DBUG_RETURN(FALSE);
- }
+ if (share->is_view)
+ {
/*
- Note that situation when we are trying to open a table for what
- was a view during previous execution of PS will be handled in by
- the caller. Here we should simply open our table even if
- TABLE_LIST::view is true.
+ If parent_l of the table_list is non null then a merge table
+ has this view as child table, which is not supported.
*/
-
- if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
+ if (table_list->parent_l)
+ {
+ my_error(ER_WRONG_MRG_TABLE, MYF(0));
goto err_unlock;
+ }
-#ifdef DISABLED_UNTIL_GRL_IS_MADE_PART_OF_MDL
/*
- We are going to to store extra reference to the share in MDL-subsystem
- so we need to increase reference counter;
+ This table is a view. Validate its metadata version: in particular,
+ that it was a view when the statement was prepared.
*/
- reference_table_share(share);
- mdl_ticket->set_cached_object(share, table_share_release_hook);
-#endif
- }
-#ifdef DISABLED_UNTIL_GRL_IS_MADE_PART_OF_MDL
- else
- {
- if (table_list->view)
- {
- DBUG_ASSERT(thd->m_reprepare_observer);
- check_and_update_table_version(thd, table_list, share);
- /* Always an error. */
- DBUG_ASSERT(thd->is_error());
+ if (check_and_update_table_version(thd, table_list, share))
goto err_unlock;
- }
- /* When we have cached TABLE_SHARE we know that is not a view. */
- if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
+ if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
goto err_unlock;
- /*
- We are going to use this share for construction of new TABLE object
- so reference counter should be increased.
- */
- reference_table_share(share);
+ /* Open view */
+ if (open_new_frm(thd, share, alias,
+ (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
+ HA_GET_INDEX | HA_TRY_READ_ONLY),
+ READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
+ thd->open_options,
+ 0, table_list, mem_root))
+ goto err_unlock;
+
+ /* TODO: Don't free this */
+ release_table_share(share);
+
+ DBUG_ASSERT(table_list->view);
+
+ mysql_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(FALSE);
}
-#endif
+ /*
+ Note that situation when we are trying to open a table for what
+ was a view during previous execution of PS will be handled in by
+ the caller. Here we should simply open our table even if
+ TABLE_LIST::view is true.
+ */
+
+ if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
+ goto err_unlock;
/*
If the version changes while we're opening the tables,
@@ -3113,8 +3003,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table_list->table= table;
DBUG_ASSERT(table->key_read == 0);
/* Tables may be reused in a sub statement. */
- if (table->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN))
- table->file->extra(HA_EXTRA_DETACH_CHILDREN);
+ DBUG_ASSERT(! table->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN));
DBUG_RETURN(FALSE);
err_lock:
@@ -3285,6 +3174,7 @@ Locked_tables_list::init_locked_tables(THD *thd)
return FALSE;
}
+
/**
Leave LTM_LOCK_TABLES mode if it's been entered.
@@ -3321,7 +3211,12 @@ Locked_tables_list::unlock_locked_tables(THD *thd)
}
thd->leave_locked_tables_mode();
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
close_thread_tables(thd);
+ /*
+ We rely on the caller to implicitly commit the
+ transaction and release transactional locks.
+ */
}
/*
After closing tables we can free memory used for storing lock
@@ -3903,38 +3798,15 @@ end_unlock:
Open_table_context::Open_table_context(THD *thd, uint flags)
:m_failed_table(NULL),
m_start_of_statement_svp(thd->mdl_context.mdl_savepoint()),
- m_global_mdl_request(NULL),
m_timeout(flags & MYSQL_LOCK_IGNORE_TIMEOUT ?
LONG_TIMEOUT : thd->variables.lock_wait_timeout),
m_flags(flags),
m_action(OT_NO_ACTION),
- m_has_locks((thd->in_multi_stmt_transaction_mode() &&
- thd->mdl_context.has_locks()) ||
- thd->mdl_context.trans_sentinel())
+ m_has_locks(thd->mdl_context.has_locks())
{}
/**
- Get MDL_request object for global intention exclusive lock which
- is acquired during opening tables for statements which take
- upgradable shared metadata locks.
-*/
-
-MDL_request *Open_table_context::get_global_mdl_request(THD *thd)
-{
- if (! m_global_mdl_request)
- {
- if ((m_global_mdl_request= new (thd->mem_root) MDL_request()))
- {
- m_global_mdl_request->init(MDL_key::GLOBAL, "", "",
- MDL_INTENTION_EXCLUSIVE);
- }
- }
- return m_global_mdl_request;
-}
-
-
-/**
Check if we can back-off and set back off action if we can.
Otherwise report and return error.
@@ -3982,13 +3854,23 @@ request_backoff_action(enum_open_table_action action_arg,
my_error(ER_LOCK_DEADLOCK, MYF(0));
return TRUE;
}
- m_action= action_arg;
/*
If auto-repair or discovery are requested, a pointer to table
list element must be provided.
*/
- DBUG_ASSERT((m_action != OT_DISCOVER && m_action != OT_REPAIR) || table);
- m_failed_table= table;
+ if (table)
+ {
+ DBUG_ASSERT(action_arg == OT_DISCOVER || action_arg == OT_REPAIR);
+ m_failed_table= (TABLE_LIST*) current_thd->alloc(sizeof(TABLE_LIST));
+ if (m_failed_table == NULL)
+ return TRUE;
+ m_failed_table->init_one_table(table->db, table->db_length,
+ table->table_name,
+ table->table_name_length,
+ table->alias, TL_WRITE);
+ m_failed_table->mdl_request.set_type(MDL_EXCLUSIVE);
+ }
+ m_action= action_arg;
return FALSE;
}
@@ -4010,11 +3892,6 @@ Open_table_context::
recover_from_failed_open(THD *thd)
{
bool result= FALSE;
- /*
- Remove reference to released ticket from MDL_request.
- */
- if (m_global_mdl_request)
- m_global_mdl_request->ticket= NULL;
/* Execute the action. */
switch (m_action)
{
@@ -4026,19 +3903,9 @@ recover_from_failed_open(THD *thd)
break;
case OT_DISCOVER:
{
- MDL_request mdl_global_request;
- MDL_request mdl_xlock_request(&m_failed_table->mdl_request);
- MDL_request_list mdl_requests;
-
- mdl_global_request.init(MDL_key::GLOBAL, "", "",
- MDL_INTENTION_EXCLUSIVE);
- mdl_xlock_request.set_type(MDL_EXCLUSIVE);
-
- mdl_requests.push_front(&mdl_xlock_request);
- mdl_requests.push_front(&mdl_global_request);
-
- if ((result=
- thd->mdl_context.acquire_locks(&mdl_requests, get_timeout())))
+ if ((result= lock_table_names(thd, m_failed_table, NULL,
+ get_timeout(),
+ MYSQL_OPEN_SKIP_TEMPORARY)))
break;
mysql_mutex_lock(&LOCK_open);
@@ -4055,19 +3922,9 @@ recover_from_failed_open(THD *thd)
}
case OT_REPAIR:
{
- MDL_request mdl_global_request;
- MDL_request mdl_xlock_request(&m_failed_table->mdl_request);
- MDL_request_list mdl_requests;
-
- mdl_global_request.init(MDL_key::GLOBAL, "", "",
- MDL_INTENTION_EXCLUSIVE);
- mdl_xlock_request.set_type(MDL_EXCLUSIVE);
-
- mdl_requests.push_front(&mdl_xlock_request);
- mdl_requests.push_front(&mdl_global_request);
-
- if ((result=
- thd->mdl_context.acquire_locks(&mdl_requests, get_timeout())))
+ if ((result= lock_table_names(thd, m_failed_table, NULL,
+ get_timeout(),
+ MYSQL_OPEN_SKIP_TEMPORARY)))
break;
mysql_mutex_lock(&LOCK_open);
@@ -4338,6 +4195,7 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
bool error= FALSE;
bool safe_to_ignore_table= FALSE;
DBUG_ENTER("open_and_process_table");
+ DEBUG_SYNC(thd, "open_and_process_table");
/*
Ignore placeholders for derived tables. After derived tables
@@ -4561,32 +4419,40 @@ end:
DBUG_RETURN(error);
}
+extern "C" uchar *schema_set_get_key(const uchar *record, size_t *length,
+ my_bool not_used __attribute__((unused)))
+{
+ TABLE_LIST *table=(TABLE_LIST*) record;
+ *length= table->db_length;
+ return (uchar*) table->db;
+}
/**
- Acquire upgradable (SNW, SNRW) metadata locks on tables to be opened
- for LOCK TABLES or a DDL statement. Under LOCK TABLES, we can't take
+ Acquire upgradable (SNW, SNRW) metadata locks on tables used by
+ LOCK TABLES or by a DDL statement. Under LOCK TABLES, we can't take
new locks, so use open_tables_check_upgradable_mdl() instead.
- @param thd Thread context.
- @param tables_start Start of list of tables on which upgradable locks
- should be acquired.
- @param tables_end End of list of tables.
- @param ot_ctx Context of open_tables() operation.
- @param flags Bitmap of flags to modify how the tables will be
- open, see open_table() description for details.
+ @param thd Thread context.
+ @param tables_start Start of list of tables on which upgradable locks
+ should be acquired.
+ @param tables_end End of list of tables.
+ @param lock_wait_timeout Seconds to wait before timeout.
+ @param flags Bitmap of flags to modify how the tables will be
+ open, see open_table() description for details.
@retval FALSE Success.
@retval TRUE Failure (e.g. connection was killed)
*/
-static bool
-open_tables_acquire_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
- TABLE_LIST *tables_end,
- Open_table_context *ot_ctx,
- uint flags)
+bool
+lock_table_names(THD *thd,
+ TABLE_LIST *tables_start, TABLE_LIST *tables_end,
+ ulong lock_wait_timeout, uint flags)
{
MDL_request_list mdl_requests;
TABLE_LIST *table;
+ MDL_request global_request;
+ Hash_set<TABLE_LIST, schema_set_get_key> schema_set;
DBUG_ASSERT(!thd->locked_tables_mode);
@@ -4599,30 +4465,37 @@ open_tables_acquire_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
(table->open_type != OT_BASE_ONLY &&
! (flags & MYSQL_OPEN_SKIP_TEMPORARY) &&
find_temporary_table(thd, table))))
+ {
+ if (schema_set.insert(table))
+ return TRUE;
mdl_requests.push_front(&table->mdl_request);
+ }
}
if (! mdl_requests.is_empty())
{
- DEBUG_SYNC(thd, "open_tables_acquire_upgradable_mdl");
-
- MDL_request *global_request= ot_ctx->get_global_mdl_request(thd);
-
- if (global_request == NULL)
- return TRUE;
- mdl_requests.push_front(global_request);
+ /*
+ Scoped locks: Take intention exclusive locks on all involved
+ schemas.
+ */
+ Hash_set<TABLE_LIST, schema_set_get_key>::Iterator it(schema_set);
+ while ((table= it++))
+ {
+ MDL_request *schema_request= new (thd->mem_root) MDL_request;
+ if (schema_request == NULL)
+ return TRUE;
+ schema_request->init(MDL_key::SCHEMA, table->db, "",
+ MDL_INTENTION_EXCLUSIVE);
+ mdl_requests.push_front(schema_request);
+ }
+ /* Take the global intention exclusive lock. */
+ global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
+ mdl_requests.push_front(&global_request);
}
- if (thd->mdl_context.acquire_locks(&mdl_requests, ot_ctx->get_timeout()))
+ if (thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout))
return TRUE;
- for (table= tables_start; table && table != tables_end;
- table= table->next_global)
- {
- if (table->mdl_request.type >= MDL_SHARED_NO_WRITE)
- table->mdl_request.ticket= NULL;
- }
-
return FALSE;
}
@@ -4794,12 +4667,21 @@ restart:
goto err;
}
}
- else if (open_tables_acquire_upgradable_mdl(thd, *start,
- thd->lex->first_not_own_table(),
- &ot_ctx, flags))
+ else
{
- error= TRUE;
- goto err;
+ TABLE_LIST *table;
+ if (lock_table_names(thd, *start, thd->lex->first_not_own_table(),
+ ot_ctx.get_timeout(), flags))
+ {
+ error= TRUE;
+ goto err;
+ }
+ for (table= *start; table && table != thd->lex->first_not_own_table();
+ table= table->next_global)
+ {
+ if (table->mdl_request.type >= MDL_SHARED_NO_WRITE)
+ table->mdl_request.ticket= NULL;
+ }
}
}
@@ -5372,6 +5254,8 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
table= 0;
end:
+ if (table == NULL)
+ close_thread_tables(thd);
thd_proc_info(thd, 0);
DBUG_RETURN(table);
}
@@ -5390,7 +5274,8 @@ end:
should work for this statement.
@note
- The lock will automaticaly be freed by close_thread_tables()
+ The thr_lock locks will automatically be freed by
+ close_thread_tables().
@retval FALSE OK.
@retval TRUE Error
@@ -5401,11 +5286,12 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
Prelocking_strategy *prelocking_strategy)
{
uint counter;
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("open_and_lock_tables");
DBUG_PRINT("enter", ("derived handling: %d", derived));
if (open_tables(thd, &tables, &counter, flags, prelocking_strategy))
- DBUG_RETURN(TRUE);
+ goto err;
DBUG_EXECUTE_IF("sleep_open_and_lock_after_open", {
const char *old_proc_info= thd->proc_info;
@@ -5414,15 +5300,22 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
thd->proc_info= old_proc_info;});
if (lock_tables(thd, tables, counter, flags))
- DBUG_RETURN(TRUE);
+ goto err;
if (derived &&
(mysql_handle_derived(thd->lex, &mysql_derived_prepare) ||
(thd->fill_derived_tables() &&
mysql_handle_derived(thd->lex, &mysql_derived_filling))))
- DBUG_RETURN(TRUE); /* purecov: inspected */
+ goto err;
DBUG_RETURN(FALSE);
+err:
+ if (! thd->in_sub_stmt)
+ trans_rollback_stmt(thd); /* Necessary if derived handling failed. */
+ close_thread_tables(thd);
+ /* Don't keep locks for a failed statement. */
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+ DBUG_RETURN(TRUE);
}
@@ -5448,13 +5341,24 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags)
{
+ DML_prelocking_strategy prelocking_strategy;
uint counter;
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
DBUG_ENTER("open_normal_and_derived_tables");
DBUG_ASSERT(!thd->fill_derived_tables());
- if (open_tables(thd, &tables, &counter, flags) ||
+ if (open_tables(thd, &tables, &counter, flags, &prelocking_strategy) ||
mysql_handle_derived(thd->lex, &mysql_derived_prepare))
- DBUG_RETURN(TRUE); /* purecov: inspected */
+ goto end;
+
DBUG_RETURN(0);
+end:
+ /* No need to rollback statement transaction, it's not started. */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+ close_thread_tables(thd);
+ /* Don't keep locks for a failed statement. */
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+
+ DBUG_RETURN(TRUE); /* purecov: inspected */
}
@@ -5471,11 +5375,25 @@ bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags)
or schema tables) as free for reuse.
*/
-static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table)
+static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table_list)
{
- for (; table; table= table->next_global)
+ TABLE_LIST *table;
+ for (table= table_list; table; table= table->next_global)
if (!table->placeholder())
+ {
table->table->query_id= 0;
+ }
+ for (table= table_list; table; table= table->next_global)
+ if (!table->placeholder())
+ {
+ /*
+ Detach children of MyISAMMRG tables used in
+ sub-statements, they will be reattached at open.
+ This has to be done in a separate loop to make sure
+ that children have had their query_id cleared.
+ */
+ table->table->file->extra(HA_EXTRA_DETACH_CHILDREN);
+ }
}
@@ -5701,6 +5619,14 @@ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
/* We have to cleanup translation tables of views. */
tmp->cleanup_items();
}
+ /*
+ 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);
thd->mdl_context.rollback_to_savepoint(start_of_statement_svp);
}
@@ -5838,7 +5764,7 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
DBUG_ENTER("update_field_dependencies");
if (thd->mark_used_columns != MARK_COLUMNS_NONE)
{
- MY_BITMAP *current_bitmap, *other_bitmap;
+ MY_BITMAP *bitmap;
/*
We always want to register the used keys, as the column bitmap may have
@@ -5849,15 +5775,9 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
table->merge_keys.merge(field->part_of_key);
if (thd->mark_used_columns == MARK_COLUMNS_READ)
- {
- current_bitmap= table->read_set;
- other_bitmap= table->write_set;
- }
+ bitmap= table->read_set;
else
- {
- current_bitmap= table->write_set;
- other_bitmap= table->read_set;
- }
+ bitmap= table->write_set;
/*
The test-and-set mechanism in the bitmap is not reliable during
@@ -5866,7 +5786,7 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
only those columns that are used in the SET clause. I.e they are being
set here. See multi_update::prepare()
*/
- if (bitmap_fast_test_and_set(current_bitmap, field->field_index))
+ if (bitmap_fast_test_and_set(bitmap, field->field_index))
{
if (thd->mark_used_columns == MARK_COLUMNS_WRITE)
{
@@ -8774,6 +8694,7 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
automatically deleted once it is no longer referenced.
*/
share->version= 0;
+
while ((table= it++))
free_cache_entry(table);
}
@@ -8969,87 +8890,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.
@@ -9127,7 +8967,8 @@ open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
MYSQL_LOCK_IGNORE_TIMEOUT))
{
lex->restore_backup_query_tables_list(&query_tables_list_backup);
- goto error;
+ thd->restore_backup_open_tables_state(backup);
+ DBUG_RETURN(TRUE);
}
for (TABLE_LIST *tables= table_list; tables; tables= tables->next_global)
@@ -9138,11 +8979,6 @@ open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(FALSE);
-
-error:
- close_system_tables(thd, backup);
-
- DBUG_RETURN(TRUE);
}
@@ -9165,6 +9001,38 @@ close_system_tables(THD *thd, Open_tables_backup *backup)
}
+/**
+ A helper function to close a mysql.* table opened
+ in an auxiliary THD during bootstrap or in the main
+ connection, when we know that there are no locks
+ held by the connection due to a preceding implicit
+ commit.
+
+ This function assumes that there is no
+ statement transaction started for the operation
+ itself, since mysql.* tables are not transactional
+ and when they are used the binlog is off (DDL
+ binlogging is always statement-based.
+
+ We need this function since we'd like to not
+ just close the system table, but also release
+ the metadata lock on it.
+
+ Note, that in LOCK TABLES mode this function
+ does not release the metadata lock. But in this
+ mode the table can be opened only if it is locked
+ explicitly with LOCK TABLES.
+*/
+
+void
+close_mysql_tables(THD *thd)
+{
+ /* No need to commit/rollback statement transaction, it's not started. */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+ close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+}
+
/*
Open and lock one system table for update.
@@ -9236,16 +9104,7 @@ open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_backup *backup)
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
}
else
- {
- /*
- If error in mysql_lock_tables(), open_ltable doesn't close the
- table. Thread kill during mysql_lock_tables() is such error. But
- open tables cannot be accepted when restoring the open tables
- state.
- */
- close_thread_tables(thd);
thd->restore_backup_open_tables_state(backup);
- }
thd->utime_after_lock= save_utime_after_lock;
DBUG_RETURN(table);
diff --git a/sql/sql_base.h b/sql/sql_base.h
index eed535f5cdc..2b08d8fa40e 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -103,15 +103,10 @@ 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);
@@ -203,8 +198,9 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
COND **conds);
int setup_ftfuncs(SELECT_LEX* select);
int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
-void wait_for_condition(THD *thd, mysql_mutex_t *mutex,
- mysql_cond_t *cond);
+bool lock_table_names(THD *thd, TABLE_LIST *table_list,
+ TABLE_LIST *table_list_end, ulong lock_wait_timeout,
+ uint flags);
bool open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags,
Prelocking_strategy *prelocking_strategy);
/* open_and_lock_tables with optional derived handling */
@@ -217,7 +213,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);
@@ -239,6 +234,7 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
bool open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
Open_tables_backup *backup);
void close_system_tables(THD *thd, Open_tables_backup *backup);
+void close_mysql_tables(THD *thd);
TABLE *open_system_table_for_update(THD *thd, TABLE_LIST *one_table);
TABLE *open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_backup *backup);
void close_log_table(THD *thd, Open_tables_backup *backup);
@@ -252,8 +248,6 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
bool close_cached_connection_tables(THD *thd, bool wait_for_refresh,
LEX_STRING *connect_string,
bool have_lock = FALSE);
-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);
@@ -480,8 +474,6 @@ public:
return m_start_of_statement_svp;
}
- MDL_request *get_global_mdl_request(THD *thd);
-
inline ulong get_timeout() const
{
return m_timeout;
@@ -499,11 +491,6 @@ private:
TABLE_LIST *m_failed_table;
MDL_ticket *m_start_of_statement_svp;
/**
- Request object for global intention exclusive lock which is acquired during
- opening tables for statements which take upgradable shared metadata locks.
- */
- MDL_request *m_global_mdl_request;
- /**
Lock timeout in seconds. Initialized to LONG_TIMEOUT when opening system
tables or to the "lock_wait_timeout" system variable for regular tables.
*/
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index b73de320ef5..d6dc9edc502 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1673,7 +1673,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
thd->limit_found_rows = query->found_rows();
thd->status_var.last_query_cost= 0.0;
- thd->stmt_da->disable_status();
+ if (!thd->stmt_da->is_set())
+ thd->stmt_da->disable_status();
BLOCK_UNLOCK_RD(query_block);
MYSQL_QUERY_CACHE_HIT(thd->query(), (ulong) thd->limit_found_rows);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 28e86ecc67f..08d06b07578 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -29,7 +29,6 @@
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_class.h"
-#include "lock.h" // unlock_global_read_lock, mysql_unlock_tables
#include "sql_cache.h" // query_cache_abort
#include "sql_base.h" // close_thread_tables
#include "sql_time.h" // date_time_format_copy
@@ -496,10 +495,8 @@ THD::THD()
:Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
/* statement id */ 0),
rli_fake(0),
- lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0),
binlog_unsafe_warning_flags(0),
- stmt_accessed_table_flag(0),
binlog_table_maps(0),
table_map_for_update(0),
arg_of_last_insert_id_function(FALSE),
@@ -630,7 +627,6 @@ THD::THD()
randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::global_query_id);
substitute_null_with_insert_id = FALSE;
thr_lock_info_init(&lock_info); /* safety: will be reset after start */
- thr_lock_owner_init(&main_lock_id, &lock_info);
m_internal_handler= NULL;
current_user_used= FALSE;
@@ -853,35 +849,6 @@ MYSQL_ERROR* THD::raise_condition(uint sql_errno,
}
}
- /*
- If a continue handler is found, the error message will be cleared
- by the stored procedures code.
- */
- if (!is_fatal_error && spcont &&
- spcont->handle_condition(this, sql_errno, sqlstate, level, msg, &cond))
- {
- /*
- Do not push any warnings, a handled error must be completely
- silenced.
- */
- DBUG_RETURN(cond);
- }
-
- /* Un-handled conditions */
-
- cond= raise_condition_no_handler(sql_errno, sqlstate, level, msg);
- DBUG_RETURN(cond);
-}
-
-MYSQL_ERROR*
-THD::raise_condition_no_handler(uint sql_errno,
- const char* sqlstate,
- MYSQL_ERROR::enum_warning_level level,
- const char* msg)
-{
- MYSQL_ERROR *cond= NULL;
- DBUG_ENTER("THD::raise_condition_no_handler");
-
query_cache_abort(&query_cache_tls);
/* FIXME: broken special case */
@@ -894,6 +861,7 @@ THD::raise_condition_no_handler(uint sql_errno,
cond= warning_info->push_warning(this, sql_errno, sqlstate, level, msg);
DBUG_RETURN(cond);
}
+
extern "C"
void *thd_alloc(MYSQL_THD thd, unsigned int size)
{
@@ -1119,7 +1087,6 @@ THD::~THD()
}
#endif
stmt_map.reset(); /* close all prepared statements */
- DBUG_ASSERT(lock_info.n_cursors == 0);
if (!cleanup_done)
cleanup();
@@ -1746,9 +1713,9 @@ bool select_send::send_result_set_metadata(List<Item> &list, uint flags)
return res;
}
-void select_send::abort()
+void select_send::abort_result_set()
{
- DBUG_ENTER("select_send::abort");
+ DBUG_ENTER("select_send::abort_result_set");
if (is_result_set_started && thd->spcont)
{
@@ -1822,12 +1789,6 @@ bool select_send::send_eof()
*/
ha_release_temporary_latches(thd);
- /* Unlock tables before sending packet to gain some speed */
- if (thd->lock && ! thd->locked_tables_mode)
- {
- mysql_unlock_tables(thd, thd->lock);
- thd->lock=0;
- }
/*
Don't send EOF if we're in error condition (which implies we've already
sent or are sending an error)
@@ -2601,7 +2562,6 @@ Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,
id(id_arg),
mark_used_columns(MARK_COLUMNS_READ),
lex(lex_arg),
- cursor(0),
db(NULL),
db_length(0)
{
@@ -2623,7 +2583,6 @@ void Statement::set_statement(Statement *stmt)
mark_used_columns= stmt->mark_used_columns;
lex= stmt->lex;
query_string= stmt->query_string;
- cursor= stmt->cursor;
}
@@ -3720,8 +3679,17 @@ int THD::decide_logging_format(TABLE_LIST *tables)
Innodb and Falcon; Innodb and MyIsam.
*/
my_bool multi_access_engine= FALSE;
-
+ /*
+ Identifies if a table is changed.
+ */
+ my_bool is_write= FALSE;
+ /*
+ A pointer to a previous table that was changed.
+ */
TABLE* prev_write_table= NULL;
+ /*
+ A pointer to a previous table that was accessed.
+ */
TABLE* prev_access_table= NULL;
#ifndef DBUG_OFF
@@ -3745,7 +3713,8 @@ int THD::decide_logging_format(TABLE_LIST *tables)
if (table->placeholder())
continue;
- if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE)
+ if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE ||
+ table->table->s->table_category == TABLE_CATEGORY_LOG)
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_TABLE);
handler::Table_flags const flags= table->table->file->ha_table_flags();
@@ -3761,16 +3730,18 @@ int THD::decide_logging_format(TABLE_LIST *tables)
my_bool trans= table->table->file->has_transactions();
if (table->table->s->tmp_table)
- set_stmt_accessed_table(trans ? STMT_WRITES_TEMP_TRANS_TABLE :
- STMT_WRITES_TEMP_NON_TRANS_TABLE);
+ lex->set_stmt_accessed_table(trans ? LEX::STMT_WRITES_TEMP_TRANS_TABLE :
+ LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE);
else
- set_stmt_accessed_table(trans ? STMT_WRITES_TRANS_TABLE :
- STMT_WRITES_NON_TRANS_TABLE);
+ lex->set_stmt_accessed_table(trans ? LEX::STMT_WRITES_TRANS_TABLE :
+ LEX::STMT_WRITES_NON_TRANS_TABLE);
flags_write_all_set &= flags;
flags_write_some_set |= flags;
+ is_write= TRUE;
prev_write_table= table->table;
+
}
flags_access_some_set |= flags;
@@ -3781,11 +3752,11 @@ int THD::decide_logging_format(TABLE_LIST *tables)
my_bool trans= table->table->file->has_transactions();
if (table->table->s->tmp_table)
- set_stmt_accessed_table(trans ? STMT_READS_TEMP_TRANS_TABLE :
- STMT_READS_TEMP_NON_TRANS_TABLE);
+ lex->set_stmt_accessed_table(trans ? LEX::STMT_READS_TEMP_TRANS_TABLE :
+ LEX::STMT_READS_TEMP_NON_TRANS_TABLE);
else
- set_stmt_accessed_table(trans ? STMT_READS_TRANS_TABLE :
- STMT_READS_NON_TRANS_TABLE);
+ lex->set_stmt_accessed_table(trans ? LEX::STMT_READS_TRANS_TABLE :
+ LEX::STMT_READS_NON_TRANS_TABLE);
}
if (prev_access_table && prev_access_table->file->ht !=
@@ -3857,24 +3828,24 @@ int THD::decide_logging_format(TABLE_LIST *tables)
my_bool non_trans_unsafe= FALSE;
/* Case 1. */
- if (stmt_accessed_table(STMT_WRITES_TRANS_TABLE) &&
- stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+ 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 (stmt_accessed_table(STMT_WRITES_TEMP_TRANS_TABLE) &&
- stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+ 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 (stmt_accessed_table(STMT_WRITES_TRANS_TABLE) &&
- stmt_accessed_table(STMT_READS_NON_TRANS_TABLE))
+ 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 (stmt_accessed_table(STMT_WRITES_TEMP_TRANS_TABLE) &&
- stmt_accessed_table(STMT_READS_NON_TRANS_TABLE))
+ 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 (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
- stmt_accessed_table(STMT_READS_TRANS_TABLE) &&
+ 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
@@ -3892,28 +3863,28 @@ int THD::decide_logging_format(TABLE_LIST *tables)
if (trans_has_updated_trans_table(this))
{
/* Case 6. */
- if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
- stmt_accessed_table(STMT_READS_TRANS_TABLE))
+ 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 (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
- stmt_accessed_table(STMT_READS_TEMP_TRANS_TABLE))
+ 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 (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
- stmt_accessed_table(STMT_READS_TEMP_NON_TRANS_TABLE))
+ 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 (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
- stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+ 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 (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
- stmt_accessed_table(STMT_READS_NON_TRANS_TABLE))
+ 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 &&
- stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+ lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
non_trans_unsafe= TRUE;
}
@@ -4004,13 +3975,14 @@ int THD::decide_logging_format(TABLE_LIST *tables)
*/
my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), "");
}
- else if ((unsafe_flags= lex->get_stmt_unsafe_flags()) != 0)
+ else if (is_write && (unsafe_flags= lex->get_stmt_unsafe_flags()) != 0)
{
/*
7. Warning: Unsafe statement logged as statement due to
binlog_format = STATEMENT
*/
binlog_unsafe_warning_flags|= unsafe_flags;
+
DBUG_PRINT("info", ("Scheduling warning to be issued by "
"binlog_query: '%s'",
ER(ER_BINLOG_UNSAFE_STATEMENT)));
@@ -4486,23 +4458,10 @@ void THD::issue_unsafe_warnings()
Ensure that binlog_unsafe_warning_flags is big enough to hold all
bits. This is actually a constant expression.
*/
- DBUG_ASSERT(2 * LEX::BINLOG_STMT_UNSAFE_COUNT <=
+ DBUG_ASSERT(LEX::BINLOG_STMT_UNSAFE_COUNT <=
sizeof(binlog_unsafe_warning_flags) * CHAR_BIT);
uint32 unsafe_type_flags= binlog_unsafe_warning_flags;
-
- /*
- Clear: (1) bits above BINLOG_STMT_UNSAFE_COUNT; (2) bits for
- warnings that have been printed already.
- */
- unsafe_type_flags &= (LEX::BINLOG_STMT_UNSAFE_ALL_FLAGS ^
- (unsafe_type_flags >> LEX::BINLOG_STMT_UNSAFE_COUNT));
- /* If all warnings have been printed already, return. */
- if (unsafe_type_flags == 0)
- DBUG_VOID_RETURN;
-
- DBUG_PRINT("info", ("unsafe_type_flags: 0x%x", unsafe_type_flags));
-
/*
For each unsafe_type, check if the statement is unsafe in this way
and issue a warning.
@@ -4526,12 +4485,6 @@ void THD::issue_unsafe_warnings()
}
}
}
- /*
- Mark these unsafe types as already printed, to avoid printing
- warnings for them again.
- */
- binlog_unsafe_warning_flags|=
- unsafe_type_flags << LEX::BINLOG_STMT_UNSAFE_COUNT;
DBUG_VOID_RETURN;
}
@@ -4585,19 +4538,32 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
/*
Warnings for unsafe statements logged in statement format are
- printed here instead of in decide_logging_format(). This is
- because the warnings should be printed only if the statement is
- actually logged. When executing decide_logging_format(), we cannot
- know for sure if the statement will be logged.
+ printed in three places instead of in decide_logging_format().
+ This is because the warnings should be printed only if the statement
+ is actually logged. When executing decide_logging_format(), we cannot
+ know for sure if the statement will be logged:
+
+ 1 - sp_head::execute_procedure which prints out warnings for calls to
+ stored procedures.
+
+ 2 - sp_head::execute_function which prints out warnings for calls
+ involving functions.
+
+ 3 - THD::binlog_query (here) which prints warning for top level
+ statements not covered by the two cases above: i.e., if not insided a
+ procedure and a function.
Besides, we should not try to print these warnings if it is not
possible to write statements to the binary log as it happens when
the execution is inside a function, or generaly speaking, when
the variables.option_bits & OPTION_BIN_LOG is false.
+
*/
- if (variables.option_bits & OPTION_BIN_LOG)
+ if ((variables.option_bits & OPTION_BIN_LOG) &&
+ spcont == NULL && !binlog_evt_union.do_union)
issue_unsafe_warnings();
+
switch (qtype) {
/*
ROW_QUERY_TYPE means that the statement may be logged either in
diff --git a/sql/sql_class.h b/sql/sql_class.h
index b135af41af0..052537e521f 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -38,7 +38,7 @@
#include "protocol.h" /* Protocol_text, Protocol_binary */
#include "violite.h" /* vio_is_connected */
#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA,
- THR_LOCK_INFO, THR_LOCK_OWNER */
+ THR_LOCK_INFO */
class Reprepare_observer;
@@ -723,7 +723,6 @@ public:
ENGINE INNODB STATUS.
*/
LEX_STRING query_string;
- Server_side_cursor *cursor;
inline char *query() { return query_string.str; }
inline uint32 query_length() { return query_string.length; }
@@ -1416,9 +1415,6 @@ public:
struct system_status_var status_var; // Per thread statistic vars
struct system_status_var *initial_status_var; /* used by show status */
THR_LOCK_INFO lock_info; // Locking info of this thread
- THR_LOCK_OWNER main_lock_id; // To use for conventional queries
- THR_LOCK_OWNER *lock_id; // If not main_lock_id, points to
- // the lock_id of a cursor.
/**
Protects THD data accessed from other threads:
- thd->query and thd->query_length (used by SHOW ENGINE
@@ -1570,125 +1566,6 @@ public:
return current_stmt_binlog_format == BINLOG_FORMAT_ROW;
}
- enum enum_stmt_accessed_table
- {
- /*
- If a transactional table is about to be read. Note that
- a write implies a read.
- */
- 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 temporary non-transactional table is about to be updated.
- */
- STMT_WRITES_TEMP_NON_TRANS_TABLE,
- /*
- The last element of the enumeration. Please, if necessary add
- anything before this.
- */
- STMT_ACCESS_TABLE_COUNT
- };
-
- /**
- Sets the type of table that is about to be accessed while executing a
- statement.
-
- @param accessed_table Enumeration type that defines the type of table,
- e.g. temporary, transactional, non-transactional.
- */
- inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table)
- {
- DBUG_ENTER("THD::set_stmt_accessed_table");
-
- DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
- stmt_accessed_table_flag |= (1U << accessed_table);
-
- DBUG_VOID_RETURN;
- }
-
- /**
- Checks if a type of table is about to be accessed while executing a
- statement.
-
- @param accessed_table Enumeration type that defines the type of table,
- e.g. temporary, transactional, non-transactional.
-
- @return
- @retval TRUE if the type of the table is about to be accessed
- @retval FALSE otherwise
- */
- inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table)
- {
- DBUG_ENTER("THD::stmt_accessed_table");
-
- DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
-
- DBUG_RETURN((stmt_accessed_table_flag & (1U << accessed_table)) != 0);
- }
-
- /**
- Checks if a temporary table is about to be accessed while executing a
- statement.
-
- @return
- @retval TRUE if a temporary table is about to be accessed
- @retval FALSE otherwise
- */
- inline bool stmt_accessed_temp_table()
- {
- DBUG_ENTER("THD::stmt_accessed_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_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
- }
-
- /**
- Checks if a temporary non-transactional table is about to be accessed
- while executing a statement.
-
- @return
- @retval TRUE if a temporary non-transactional table is about to be
- accessed
- @retval FALSE otherwise
- */
- inline bool stmt_accessed_non_trans_temp_table()
- {
- DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
-
- DBUG_RETURN((stmt_accessed_table_flag &
- ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
- (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
- }
-
private:
/**
Indicates the format in which the current statement will be
@@ -1699,24 +1576,8 @@ private:
/**
Bit field for the state of binlog warnings.
- There are two groups of bits:
-
- - The first Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types of
- unsafeness that the current statement has.
-
- - The following Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types
- of unsafeness that the current statement has issued warnings
- for.
-
- Hence, this variable must be big enough to hold
- 2*Lex::BINLOG_STMT_UNSAFE_COUNT bits. This is asserted in @c
- issue_unsafe_warnings().
-
- The first and second groups of bits are set by @c
- decide_logging_format() when it detects that a warning should be
- issued. The third group of bits is set from @c binlog_query()
- when a warning is issued. All bits are cleared at the end of the
- top-level statement.
+ The first Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types of
+ unsafeness that the current statement has.
This must be a member of THD and not of LEX, because warnings are
detected and issued in different places (@c
@@ -1726,20 +1587,14 @@ private:
*/
uint32 binlog_unsafe_warning_flags;
- /**
- Bit field that determines the type of tables that are about to be
- be accessed while executing a statement.
- */
- uint32 stmt_accessed_table_flag;
-
- void issue_unsafe_warnings();
-
/*
Number of outstanding table maps, i.e., table maps in the
transaction cache.
*/
uint binlog_table_maps;
public:
+ void issue_unsafe_warnings();
+
uint get_binlog_table_maps() const {
return binlog_table_maps;
}
@@ -2804,23 +2659,6 @@ private:
MYSQL_ERROR::enum_warning_level level,
const char* msg);
- /**
- Raise a generic SQL condition, without activation any SQL condition
- handlers.
- This method is necessary to support the RESIGNAL statement,
- which is allowed to bypass SQL exception handlers.
- @param sql_errno the condition error number
- @param sqlstate the condition SQLSTATE
- @param level the condition level
- @param msg the condition message text
- @return The condition raised, or NULL
- */
- MYSQL_ERROR*
- raise_condition_no_handler(uint sql_errno,
- const char* sqlstate,
- MYSQL_ERROR::enum_warning_level level,
- const char* msg);
-
public:
/** Overloaded to guard query/query_length fields */
virtual void set_statement(Statement *stmt);
@@ -2991,7 +2829,7 @@ public:
@retval TRUE error, an error message is set
*/
virtual bool check_simple_select() const;
- virtual void abort() {}
+ virtual void abort_result_set() {}
/*
Cleanup instance of this class for next execution of a prepared
statement/stored procedure.
@@ -3034,7 +2872,7 @@ public:
bool send_data(List<Item> &items);
bool send_eof();
virtual bool check_simple_select() const { return FALSE; }
- void abort();
+ void abort_result_set();
virtual void cleanup();
};
@@ -3126,7 +2964,7 @@ class select_insert :public select_result_interceptor {
virtual bool can_rollback_data() { return 0; }
void send_error(uint errcode,const char *err);
bool send_eof();
- void abort();
+ virtual void abort_result_set();
/* not implemented: select_insert is never re-used in prepared statements */
void cleanup();
};
@@ -3162,7 +3000,7 @@ public:
void store_values(List<Item> &values);
void send_error(uint errcode,const char *err);
bool send_eof();
- void abort();
+ virtual void abort_result_set();
virtual bool can_rollback_data() { return 1; }
// Needed for access from local class MY_HOOKS in prepare(), since thd is proteted.
@@ -3496,7 +3334,7 @@ public:
{
return deleted;
}
- virtual void abort();
+ virtual void abort_result_set();
};
@@ -3547,7 +3385,7 @@ public:
{
return updated;
}
- virtual void abort();
+ virtual void abort_result_set();
};
class my_var : public Sql_alloc {
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index ca724ec262f..7a9834b4cde 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -19,7 +19,6 @@
#include "sql_priv.h"
#include "unireg.h"
#include "sql_cursor.h"
-#include "sql_select.h"
#include "probes_mysql.h"
#include "sql_parse.h" // mysql_execute_command
@@ -28,51 +27,6 @@
****************************************************************************/
/**
- Sensitive_cursor -- a sensitive non-materialized server side
- cursor. An instance of this class cursor has its own runtime
- state -- list of used items and memory root for runtime memory,
- open and locked tables, change list for the changes of the
- parsed tree. This state is freed when the cursor is closed.
-*/
-
-class Sensitive_cursor: public Server_side_cursor
-{
- MEM_ROOT main_mem_root;
- Query_arena *stmt_arena;
- JOIN *join;
- TABLE *open_tables;
- MYSQL_LOCK *lock;
- TABLE *derived_tables;
- /* List of items created during execution */
- query_id_t query_id;
- struct Engine_info
- {
- handlerton *ht;
- void *read_view;
- };
- Engine_info ht_info[MAX_HA];
- Item_change_list change_list;
- my_bool close_at_commit;
- THR_LOCK_OWNER lock_id;
-private:
- /* bzero cursor state in THD */
- void reset_thd(THD *thd);
-public:
- Sensitive_cursor(THD *thd, select_result *result_arg);
-
- THR_LOCK_OWNER *get_lock_id() { return &lock_id; }
- /* Save THD state into cursor */
- void post_open(THD *thd);
-
- virtual bool is_open() const { return join != 0; }
- virtual int open(JOIN *join);
- virtual void fetch(ulong num_rows);
- virtual void close();
- virtual ~Sensitive_cursor();
-};
-
-
-/**
Materialized_cursor -- an insensitive materialized server-side
cursor. The result set of this cursor is saved in a temporary
table at open. The cursor itself is simply an interface for the
@@ -124,10 +78,9 @@ public:
/**************************************************************************/
/**
- Attempt to open a materialized or non-materialized cursor.
+ Attempt to open a materialized cursor.
@param thd thread handle
- @param[in] flags create a materialized cursor or not
@param[in] result result class of the caller used as a destination
for the rows fetched from the cursor
@param[out] pcursor a pointer to store a pointer to cursor in
@@ -140,37 +93,21 @@ public:
non-zero an error, 'pcursor' has been left intact.
*/
-int mysql_open_cursor(THD *thd, uint flags, select_result *result,
+int mysql_open_cursor(THD *thd, select_result *result,
Server_side_cursor **pcursor)
{
- Sensitive_cursor *sensitive_cursor;
select_result *save_result;
Select_materialize *result_materialize;
LEX *lex= thd->lex;
int rc;
- /*
- The lifetime of the sensitive cursor is the same or less as the
- lifetime of the runtime memory of the statement it's opened for.
- */
if (! (result_materialize= new (thd->mem_root) Select_materialize(result)))
return 1;
- if (! (sensitive_cursor= new (thd->mem_root) Sensitive_cursor(thd, result)))
- {
- delete result_materialize;
- result_materialize= NULL;
- return 1;
- }
-
save_result= lex->result;
lex->result= result_materialize;
- if (! (flags & (uint) ALWAYS_MATERIALIZED_CURSOR))
- {
- thd->lock_id= sensitive_cursor->get_lock_id();
- thd->cursor= sensitive_cursor;
- }
+
MYSQL_QUERY_EXEC_START(thd->query(),
thd->thread_id,
(char *) (thd->db ? thd->db : ""),
@@ -181,20 +118,14 @@ int mysql_open_cursor(THD *thd, uint flags, select_result *result,
MYSQL_QUERY_EXEC_DONE(rc);
lex->result= save_result;
- thd->lock_id= &thd->main_lock_id;
- thd->cursor= 0;
-
/*
Possible options here:
- - a sensitive cursor is open. In this case rc is 0 and
- result_materialize->materialized_cursor is NULL, or
- a materialized cursor is open. In this case rc is 0 and
result_materialize->materialized is not NULL
- an error occurred during materialization.
result_materialize->materialized_cursor is not NULL, but rc != 0
- successful completion of mysql_execute_command without
- a cursor: rc is 0, result_materialize->materialized_cursor is NULL,
- sensitive_cursor is not open.
+ a cursor: rc is 0, result_materialize->materialized_cursor is NULL.
This is possible if some command writes directly to the
network, bypassing select_result mechanism. An example of
such command is SHOW VARIABLES or SHOW STATUS.
@@ -203,23 +134,10 @@ int mysql_open_cursor(THD *thd, uint flags, select_result *result,
{
if (result_materialize->materialized_cursor)
delete result_materialize->materialized_cursor;
- goto err_open;
- }
-
- if (sensitive_cursor->is_open())
- {
- DBUG_ASSERT(!result_materialize->materialized_cursor);
- /*
- It's safer if we grab THD state after mysql_execute_command
- is finished and not in Sensitive_cursor::open(), because
- currently the call to Sensitive_cursor::open is buried deep
- in JOIN::exec of the top level join.
- */
- sensitive_cursor->post_open(thd);
- *pcursor= sensitive_cursor;
goto end;
}
- else if (result_materialize->materialized_cursor)
+
+ if (result_materialize->materialized_cursor)
{
Materialized_cursor *materialized_cursor=
result_materialize->materialized_cursor;
@@ -227,18 +145,13 @@ int mysql_open_cursor(THD *thd, uint flags, select_result *result,
if ((rc= materialized_cursor->open(0)))
{
delete materialized_cursor;
- materialized_cursor= NULL;
- goto err_open;
+ goto end;
}
*pcursor= materialized_cursor;
thd->stmt_arena->cleanup_stmt();
- goto end;
}
-err_open:
- DBUG_ASSERT(! (sensitive_cursor && sensitive_cursor->is_open()));
- delete sensitive_cursor;
end:
delete result_materialize;
return rc;
@@ -270,279 +183,6 @@ void Server_side_cursor::operator delete(void *ptr, size_t size)
DBUG_VOID_RETURN;
}
-/****************************************************************************
- Sensitive_cursor
-****************************************************************************/
-
-Sensitive_cursor::Sensitive_cursor(THD *thd, select_result *result_arg)
- :Server_side_cursor(&main_mem_root, result_arg),
- stmt_arena(0),
- join(0),
- close_at_commit(FALSE)
-{
- /* We will overwrite it at open anyway. */
- init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
- thr_lock_owner_init(&lock_id, &thd->lock_info);
- bzero((void*) ht_info, sizeof(ht_info));
-}
-
-
-/**
- Save THD state into cursor.
-
- @todo
- - What problems can we have with it if cursor is open?
- - TODO: must be fixed because of the prelocked mode.
-*/
-void
-Sensitive_cursor::post_open(THD *thd)
-{
- Engine_info *info;
- /*
- We need to save and reset thd->mem_root, otherwise it'll be
- freed later in mysql_parse.
-
- We can't just change thd->mem_root here as we want to keep the
- things that are already allocated in thd->mem_root for
- Sensitive_cursor::fetch()
- */
- *mem_root= *thd->mem_root;
- stmt_arena= thd->stmt_arena;
- state= stmt_arena->state;
- /* Allocate a new memory root for thd */
- init_sql_alloc(thd->mem_root,
- thd->variables.query_alloc_block_size,
- thd->variables.query_prealloc_size);
-
- /*
- Save tables and zero THD pointers to prevent table close in
- close_thread_tables.
- */
- derived_tables= thd->derived_tables;
- open_tables= thd->open_tables;
- lock= thd->lock;
- query_id= thd->query_id;
- free_list= thd->free_list;
- thd->change_list.move_elements_to(&change_list);
- reset_thd(thd);
- /* Now we have an active cursor and can cause a deadlock */
- thd->lock_info.n_cursors++;
-
- close_at_commit= FALSE; /* reset in case we're reusing the cursor */
- info= &ht_info[0];
- for (Ha_trx_info *ha_trx_info= thd->transaction.stmt.ha_list;
- ha_trx_info; ha_trx_info= ha_trx_info->next())
- {
- handlerton *ht= ha_trx_info->ht();
- close_at_commit|= test(ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT);
- if (ht->create_cursor_read_view)
- {
- info->ht= ht;
- info->read_view= (ht->create_cursor_read_view)(ht, thd);
- ++info;
- }
- }
- /*
- What problems can we have with it if cursor is open?
- TODO: must be fixed because of the prelocked mode.
- */
-}
-
-
-/**
- bzero cursor state in THD.
-*/
-
-void
-Sensitive_cursor::reset_thd(THD *thd)
-{
- thd->derived_tables= 0;
- thd->set_open_tables(NULL);
- thd->lock= 0;
- thd->free_list= 0;
- thd->change_list.empty();
-}
-
-
-int
-Sensitive_cursor::open(JOIN *join_arg)
-{
- join= join_arg;
- THD *thd= join->thd;
- /* First non-constant table */
- JOIN_TAB *join_tab= join->join_tab + join->const_tables;
- DBUG_ENTER("Sensitive_cursor::open");
-
- join->change_result(result);
- /*
- Send fields description to the client; server_status is sent
- in 'EOF' packet, which follows send_result_set_metadata().
- We don't simply use SEND_EOF flag of send_result_set_metadata because we also
- want to flush the network buffer, which is done only in a standalone
- send_eof().
- */
- result->send_result_set_metadata(*join->fields, Protocol::SEND_NUM_ROWS);
- thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
- result->send_eof();
- thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
-
- /* Prepare JOIN for reading rows. */
- join->tmp_table= 0;
- join->join_tab[join->tables-1].next_select= setup_end_select_func(join);
- join->send_records= 0;
- join->fetch_limit= join->unit->offset_limit_cnt;
-
- /* Disable JOIN CACHE as it is not working with cursors yet */
- for (JOIN_TAB *tab= join_tab;
- tab != join->join_tab + join->tables - 1;
- tab++)
- {
- if (tab->next_select == sub_select_cache)
- tab->next_select= sub_select;
- }
-
- DBUG_ASSERT(join_tab->table->reginfo.not_exists_optimize == 0);
- DBUG_ASSERT(join_tab->not_used_in_distinct == 0);
- /*
- null_row is set only if row not found and it's outer join: should never
- happen for the first table in join_tab list
- */
- DBUG_ASSERT(join_tab->table->null_row == 0);
- DBUG_RETURN(0);
-}
-
-
-/**
- Fetch next num_rows rows from the cursor and send them to the client.
-
- Precondition:
- - Sensitive_cursor is open
-
- @param num_rows fetch up to this number of rows (maybe less)
-*/
-
-void
-Sensitive_cursor::fetch(ulong num_rows)
-{
- THD *thd= join->thd;
- JOIN_TAB *join_tab= join->join_tab + join->const_tables;
- enum_nested_loop_state error= NESTED_LOOP_OK;
- Query_arena backup_arena;
- Engine_info *info;
- DBUG_ENTER("Sensitive_cursor::fetch");
- DBUG_PRINT("enter",("rows: %lu", num_rows));
-
- DBUG_ASSERT(thd->derived_tables == 0 && thd->open_tables == 0 &&
- thd->lock == 0);
-
- thd->derived_tables= derived_tables;
- thd->set_open_tables(open_tables);
- thd->lock= lock;
- thd->set_query_id(query_id);
- change_list.move_elements_to(&thd->change_list);
- /* save references to memory allocated during fetch */
- thd->set_n_backup_active_arena(this, &backup_arena);
-
- for (info= ht_info; info->read_view ; info++)
- (info->ht->set_cursor_read_view)(info->ht, thd, info->read_view);
-
- join->fetch_limit+= num_rows;
-
- error= sub_select(join, join_tab, 0);
- if (error == NESTED_LOOP_OK || error == NESTED_LOOP_NO_MORE_ROWS)
- error= sub_select(join,join_tab,1);
- if (error == NESTED_LOOP_QUERY_LIMIT)
- error= NESTED_LOOP_OK; /* select_limit used */
- if (error == NESTED_LOOP_CURSOR_LIMIT)
- join->resume_nested_loop= TRUE;
-
- ha_release_temporary_latches(thd);
-
- /* Grab free_list here to correctly free it in close */
- thd->restore_active_arena(this, &backup_arena);
-
- thd->change_list.move_elements_to(&change_list);
- reset_thd(thd);
-
- for (info= ht_info; info->read_view; info++)
- (info->ht->set_cursor_read_view)(info->ht, thd, 0);
-
- if (error == NESTED_LOOP_CURSOR_LIMIT)
- {
- /* Fetch limit worked, possibly more rows are there */
- thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
- result->send_eof();
- thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
- }
- else
- {
- close();
- if (error == NESTED_LOOP_OK)
- {
- thd->server_status|= SERVER_STATUS_LAST_ROW_SENT;
- result->send_eof();
- thd->server_status&= ~SERVER_STATUS_LAST_ROW_SENT;
- }
- else if (error != NESTED_LOOP_KILLED)
- my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
- }
- DBUG_VOID_RETURN;
-}
-
-
-/**
- @todo
- Another hack: we need to set THD state as if in a fetch to be
- able to call stmt close.
-*/
-void
-Sensitive_cursor::close()
-{
- THD *thd= join->thd;
- DBUG_ENTER("Sensitive_cursor::close");
-
- for (Engine_info *info= ht_info; info->read_view; info++)
- {
- (info->ht->close_cursor_read_view)(info->ht, thd, info->read_view);
- info->read_view= 0;
- info->ht= 0;
- }
-
- change_list.move_elements_to(&thd->change_list);
- {
- /*
- XXX: Another hack: we need to set THD state as if in a fetch to be
- able to call stmt close.
- */
- DBUG_ASSERT(lock || open_tables || derived_tables);
-
- TABLE *tmp_derived_tables= thd->derived_tables;
- MYSQL_LOCK *tmp_lock= thd->lock;
-
- thd->set_open_tables(open_tables);
- thd->derived_tables= derived_tables;
- thd->lock= lock;
-
- /* Is expected to at least close tables and empty thd->change_list */
- stmt_arena->cleanup_stmt();
-
- thd->set_open_tables(tmp_derived_tables);
- thd->derived_tables= tmp_derived_tables;
- thd->lock= tmp_lock;
- }
- thd->lock_info.n_cursors--; /* Decrease the number of active cursors */
- join= 0;
- stmt_arena= 0;
- free_items();
- DBUG_VOID_RETURN;
-}
-
-
-Sensitive_cursor::~Sensitive_cursor()
-{
- if (is_open())
- close();
-}
/***************************************************************************
Materialized_cursor
@@ -568,7 +208,8 @@ Materialized_cursor::Materialized_cursor(select_result *result_arg,
@param send_result_set_metadata List of fields that would be sent.
*/
-int Materialized_cursor::fill_item_list(THD *thd, List<Item> &send_result_set_metadata)
+int Materialized_cursor::fill_item_list(THD *thd,
+ List<Item> &send_result_set_metadata)
{
Query_arena backup_arena;
int rc;
@@ -606,6 +247,7 @@ end:
return rc || thd->is_error();
}
+
int Materialized_cursor::open(JOIN *join __attribute__((unused)))
{
THD *thd= fake_unit.thd;
@@ -664,7 +306,12 @@ void Materialized_cursor::fetch(ulong num_rows)
if ((res= table->file->rnd_next(table->record[0])))
break;
/* Send data only if the read was successful. */
- result->send_data(item_list);
+ /*
+ If network write failed (i.e. due to a closed socked),
+ the error has already been set. Just return.
+ */
+ if (result->send_data(item_list))
+ return;
}
switch (res) {
diff --git a/sql/sql_cursor.h b/sql/sql_cursor.h
index 2a394e281b4..ed7bfac821a 100644
--- a/sql/sql_cursor.h
+++ b/sql/sql_cursor.h
@@ -32,11 +32,11 @@ class JOIN;
*/
/**
- Server_side_cursor -- an interface for materialized and
- sensitive (non-materialized) implementation of cursors. All
- cursors are self-contained (created in their own memory root).
- For that reason they must be deleted only using a pointer to
- Server_side_cursor, not to its base class.
+ Server_side_cursor -- an interface for materialized
+ implementation of cursors. All cursors are self-contained
+ (created in their own memory root). For that reason they must
+ be deleted only using a pointer to Server_side_cursor, not to
+ its base class.
*/
class Server_side_cursor: protected Query_arena, public Sql_alloc
@@ -60,11 +60,7 @@ public:
};
-int mysql_open_cursor(THD *thd, uint flags,
- select_result *result,
+int mysql_open_cursor(THD *thd, select_result *result,
Server_side_cursor **res);
-/** Possible values for flags */
-enum { ANY_CURSOR= 1, ALWAYS_MATERIALIZED_CURSOR= 2 };
-
#endif /* _sql_cusor_h_ */
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 1040fc92851..517cb9139e9 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -21,14 +21,12 @@
#include "unireg.h"
#include "sql_db.h"
#include "sql_cache.h" // query_cache_*
-#include "lock.h" // wait_if_global_read_lock,
- // start_waiting_global_read_lock
+#include "lock.h" // lock_schema_name
#include "sql_table.h" // build_table_filename,
// filename_to_tablename
#include "sql_rename.h" // mysql_rename_tables
#include "sql_acl.h" // SELECT_ACL, DB_ACLS,
// acl_get, check_grant_db
-#include "sql_base.h" // wait_for_condition
#include "log_event.h" // Query_log_event
#include <mysys_err.h>
#include "sp.h"
@@ -58,106 +56,6 @@ static void mysql_change_db_impl(THD *thd,
CHARSET_INFO *new_db_charset);
-/* Database lock hash */
-HASH lock_db_cache;
-mysql_mutex_t LOCK_lock_db;
-int creating_database= 0; // how many database locks are made
-
-
-/* Structure for database lock */
-typedef struct my_dblock_st
-{
- char *name; /* Database name */
- uint name_length; /* Database length name */
-} my_dblock_t;
-
-
-/*
- lock_db key.
-*/
-
-extern "C" uchar* lock_db_get_key(my_dblock_t *, size_t *, my_bool not_used);
-
-uchar* lock_db_get_key(my_dblock_t *ptr, size_t *length,
- my_bool not_used __attribute__((unused)))
-{
- *length= ptr->name_length;
- return (uchar*) ptr->name;
-}
-
-
-/*
- Free lock_db hash element.
-*/
-
-extern "C" void lock_db_free_element(void *ptr);
-
-void lock_db_free_element(void *ptr)
-{
- my_free(ptr);
-}
-
-
-/*
- Put a database lock entry into the hash.
-
- DESCRIPTION
- Insert a database lock entry into hash.
- LOCK_db_lock must be previously locked.
-
- RETURN VALUES
- 0 on success.
- 1 on error.
-*/
-
-static my_bool lock_db_insert(const char *dbname, uint length)
-{
- my_dblock_t *opt;
- my_bool error= 0;
- DBUG_ENTER("lock_db_insert");
-
- mysql_mutex_assert_owner(&LOCK_lock_db);
-
- if (!(opt= (my_dblock_t*) my_hash_search(&lock_db_cache,
- (uchar*) dbname, length)))
- {
- /* Db is not in the hash, insert it */
- char *tmp_name;
- if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &opt, (uint) sizeof(*opt), &tmp_name, (uint) length+1,
- NullS))
- {
- error= 1;
- goto end;
- }
-
- opt->name= tmp_name;
- strmov(opt->name, dbname);
- opt->name_length= length;
-
- if ((error= my_hash_insert(&lock_db_cache, (uchar*) opt)))
- my_free(opt);
- }
-
-end:
- DBUG_RETURN(error);
-}
-
-
-/*
- Delete a database lock entry from hash.
-*/
-
-void lock_db_delete(const char *name, uint length)
-{
- my_dblock_t *opt;
- mysql_mutex_assert_owner(&LOCK_lock_db);
- if ((opt= (my_dblock_t *)my_hash_search(&lock_db_cache,
- (const uchar*) name, length)))
- my_hash_delete(&lock_db_cache, (uchar*) opt);
-}
-
-
/* Database options hash */
static HASH dboptions;
static my_bool dboptions_init= 0;
@@ -233,21 +131,16 @@ static void init_database_names_psi_keys(void)
}
#endif
-/*
- Initialize database option hash and locked database hash.
-
- SYNOPSIS
- my_database_names()
+/**
+ Initialize database option cache.
- NOTES
- Must be called before any other database function is called.
+ @note Must be called before any other database function is called.
- RETURN
- 0 ok
- 1 Fatal error
+ @retval 0 ok
+ @retval 1 Fatal error
*/
-bool my_database_names_init(void)
+bool my_dboptions_cache_init(void)
{
#ifdef HAVE_PSI_INTERFACE
init_database_names_psi_keys();
@@ -261,36 +154,30 @@ bool my_database_names_init(void)
error= my_hash_init(&dboptions, lower_case_table_names ?
&my_charset_bin : system_charset_info,
32, 0, 0, (my_hash_get_key) dboptions_get_key,
- free_dbopt,0) ||
- my_hash_init(&lock_db_cache, lower_case_table_names ?
- &my_charset_bin : system_charset_info,
- 32, 0, 0, (my_hash_get_key) lock_db_get_key,
- lock_db_free_element,0);
-
+ free_dbopt,0);
}
return error;
}
-/*
+/**
Free database option hash and locked databases hash.
*/
-void my_database_names_free(void)
+void my_dboptions_cache_free(void)
{
if (dboptions_init)
{
dboptions_init= 0;
my_hash_free(&dboptions);
mysql_rwlock_destroy(&LOCK_dboptions);
- my_hash_free(&lock_db_cache);
}
}
-/*
- Cleanup cached options
+/**
+ Cleanup cached options.
*/
void my_dbopt_cleanup(void)
@@ -395,7 +282,7 @@ end:
Deletes database options from the hash.
*/
-void del_dbopt(const char *path)
+static void del_dbopt(const char *path)
{
my_dbopt_t *opt;
mysql_rwlock_wrlock(&LOCK_dboptions);
@@ -664,25 +551,8 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1);
}
- /*
- Do not create database if another thread is holding read lock.
- Wait for global read lock before acquiring LOCK_mysql_create_db.
- After wait_if_global_read_lock() we have protection against another
- global read lock. If we would acquire LOCK_mysql_create_db first,
- another thread could step in and get the global read lock before we
- reach wait_if_global_read_lock(). If this thread tries the same as we
- (admin a db), it would then go and wait on LOCK_mysql_create_db...
- Furthermore wait_if_global_read_lock() checks if the current thread
- has the global read lock and refuses the operation with
- ER_CANT_UPDATE_WITH_READLOCK if applicable.
- */
- if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- {
- error= -1;
- goto exit2;
- }
-
- mysql_mutex_lock(&LOCK_mysql_create_db);
+ if (lock_schema_name(thd, db))
+ DBUG_RETURN(-1);
/* Check directory */
path_len= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);
@@ -786,7 +656,10 @@ not_silent:
qinfo.db = db;
qinfo.db_len = strlen(db);
- /* These DDL methods and logging protected with LOCK_mysql_create_db */
+ /*
+ These DDL methods and logging are protected with the exclusive
+ metadata lock on the schema
+ */
if (mysql_bin_log.write(&qinfo))
{
error= -1;
@@ -797,9 +670,6 @@ not_silent:
}
exit:
- mysql_mutex_unlock(&LOCK_mysql_create_db);
- thd->global_read_lock.start_waiting_global_read_lock(thd);
-exit2:
DBUG_RETURN(error);
}
@@ -813,22 +683,8 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
int error= 0;
DBUG_ENTER("mysql_alter_db");
- /*
- Do not alter database if another thread is holding read lock.
- Wait for global read lock before acquiring LOCK_mysql_create_db.
- After wait_if_global_read_lock() we have protection against another
- global read lock. If we would acquire LOCK_mysql_create_db first,
- another thread could step in and get the global read lock before we
- reach wait_if_global_read_lock(). If this thread tries the same as we
- (admin a db), it would then go and wait on LOCK_mysql_create_db...
- Furthermore wait_if_global_read_lock() checks if the current thread
- has the global read lock and refuses the operation with
- ER_CANT_UPDATE_WITH_READLOCK if applicable.
- */
- if ((error= thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE)))
- goto exit2;
-
- mysql_mutex_lock(&LOCK_mysql_create_db);
+ if (lock_schema_name(thd, db))
+ DBUG_RETURN(TRUE);
/*
Recreate db options file: /dbpath/.db.opt
@@ -866,16 +722,16 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
qinfo.db = db;
qinfo.db_len = strlen(db);
- /* These DDL methods and logging protected with LOCK_mysql_create_db */
+ /*
+ These DDL methods and logging are protected with the exclusive
+ metadata lock on the schema.
+ */
if ((error= mysql_bin_log.write(&qinfo)))
goto exit;
}
my_ok(thd, result);
exit:
- mysql_mutex_unlock(&LOCK_mysql_create_db);
- thd->global_read_lock.start_waiting_global_read_lock(thd);
-exit2:
DBUG_RETURN(error);
}
@@ -907,25 +763,9 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
TABLE_LIST* dropped_tables= 0;
DBUG_ENTER("mysql_rm_db");
- /*
- Do not drop database if another thread is holding read lock.
- Wait for global read lock before acquiring LOCK_mysql_create_db.
- After wait_if_global_read_lock() we have protection against another
- global read lock. If we would acquire LOCK_mysql_create_db first,
- another thread could step in and get the global read lock before we
- reach wait_if_global_read_lock(). If this thread tries the same as we
- (admin a db), it would then go and wait on LOCK_mysql_create_db...
- Furthermore wait_if_global_read_lock() checks if the current thread
- has the global read lock and refuses the operation with
- ER_CANT_UPDATE_WITH_READLOCK if applicable.
- */
- if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- {
- error= -1;
- goto exit2;
- }
- mysql_mutex_lock(&LOCK_mysql_create_db);
+ if (lock_schema_name(thd, db))
+ DBUG_RETURN(TRUE);
length= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);
strmov(path+length, MY_DB_OPT_FILE); // Append db option file name
@@ -1013,7 +853,10 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
qinfo.db = db;
qinfo.db_len = strlen(db);
- /* These DDL methods and logging protected with LOCK_mysql_create_db */
+ /*
+ These DDL methods and logging are protected with the exclusive
+ metadata lock on the schema.
+ */
if (mysql_bin_log.write(&qinfo))
{
error= -1;
@@ -1045,7 +888,10 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
tbl_name_len= strlen(tbl->table_name) + 3;
if (query_pos + tbl_name_len + 1 >= query_end)
{
- /* These DDL methods and logging protected with LOCK_mysql_create_db */
+ /*
+ These DDL methods and logging are protected with the exclusive
+ metadata lock on the schema.
+ */
if (write_to_binlog(thd, query, query_pos -1 - query, db, db_len))
{
error= -1;
@@ -1062,7 +908,10 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
if (query_pos != query_data_start)
{
- /* These DDL methods and logging protected with LOCK_mysql_create_db */
+ /*
+ These DDL methods and logging are protected with the exclusive
+ metadata lock on the schema.
+ */
if (write_to_binlog(thd, query, query_pos -1 - query, db, db_len))
{
error= -1;
@@ -1080,9 +929,6 @@ exit:
*/
if (thd->db && !strcmp(thd->db, db) && error == 0)
mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
- mysql_mutex_unlock(&LOCK_mysql_create_db);
- thd->global_read_lock.start_waiting_global_read_lock(thd);
-exit2:
DBUG_RETURN(error);
}
@@ -1099,12 +945,12 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
long deleted=0;
ulong found_other_files=0;
char filePath[FN_REFLEN];
- TABLE_LIST *tot_list=0, **tot_list_next;
+ TABLE_LIST *tot_list=0, **tot_list_next_local, **tot_list_next_global;
List<String> raid_dirs;
DBUG_ENTER("mysql_rm_known_files");
DBUG_PRINT("enter",("path: %s", org_path));
- tot_list_next= &tot_list;
+ tot_list_next_local= tot_list_next_global= &tot_list;
for (uint idx=0 ;
idx < (uint) dirp->number_off_files && !thd->killed ;
@@ -1192,22 +1038,28 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
if (!table_list)
goto err;
table_list->db= (char*) (table_list+1);
- table_list->table_name= strmov(table_list->db, db) + 1;
- (void) filename_to_tablename(file->name, table_list->table_name,
- MYSQL50_TABLE_NAME_PREFIX_LENGTH +
- strlen(file->name) + 1);
+ table_list->db_length= strmov(table_list->db, db) - table_list->db;
+ table_list->table_name= table_list->db + table_list->db_length + 1;
+ table_list->table_name_length= filename_to_tablename(file->name,
+ table_list->table_name,
+ MYSQL50_TABLE_NAME_PREFIX_LENGTH +
+ strlen(file->name) + 1);
+ table_list->open_type= OT_BASE_ONLY;
/* To be able to correctly look up the table in the table cache. */
if (lower_case_table_names)
- my_casedn_str(files_charset_info, table_list->table_name);
+ table_list->table_name_length= my_casedn_str(files_charset_info,
+ table_list->table_name);
table_list->alias= table_list->table_name; // If lower_case_table_names=2
table_list->internal_tmp_table= is_prefix(file->name, tmp_file_prefix);
table_list->mdl_request.init(MDL_key::TABLE, table_list->db,
table_list->table_name, MDL_EXCLUSIVE);
/* Link into list */
- (*tot_list_next)= table_list;
- tot_list_next= &table_list->next_local;
+ (*tot_list_next_local)= table_list;
+ (*tot_list_next_global)= table_list;
+ tot_list_next_local= &table_list->next_local;
+ tot_list_next_global= &table_list->next_global;
deleted++;
}
else
@@ -1769,60 +1621,6 @@ bool mysql_opt_change_db(THD *thd,
}
-static int
-lock_databases(THD *thd, const char *db1, uint length1,
- const char *db2, uint length2)
-{
- mysql_mutex_lock(&LOCK_lock_db);
- while (!thd->killed &&
- (my_hash_search(&lock_db_cache,(uchar*) db1, length1) ||
- my_hash_search(&lock_db_cache,(uchar*) db2, length2)))
- {
- wait_for_condition(thd, &LOCK_lock_db, &COND_refresh);
- mysql_mutex_lock(&LOCK_lock_db);
- }
-
- if (thd->killed)
- {
- mysql_mutex_unlock(&LOCK_lock_db);
- return 1;
- }
-
- lock_db_insert(db1, length1);
- lock_db_insert(db2, length2);
- creating_database++;
-
- /*
- Wait if a concurent thread is creating a table at the same time.
- The assumption here is that it will not take too long until
- there is a point in time when a table is not created.
- */
-
- while (!thd->killed && creating_table)
- {
- wait_for_condition(thd, &LOCK_lock_db, &COND_refresh);
- mysql_mutex_lock(&LOCK_lock_db);
- }
-
- if (thd->killed)
- {
- lock_db_delete(db1, length1);
- lock_db_delete(db2, length2);
- creating_database--;
- mysql_mutex_unlock(&LOCK_lock_db);
- mysql_cond_signal(&COND_refresh);
- return(1);
- }
-
- /*
- We can unlock now as the hash will protect against anyone creating a table
- in the databases we are using
- */
- mysql_mutex_unlock(&LOCK_lock_db);
- return 0;
-}
-
-
/**
Upgrade a 5.0 database.
This function is invoked whenever an ALTER DATABASE UPGRADE query is executed:
@@ -1864,9 +1662,9 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
new_db.str= old_db->str + MYSQL50_TABLE_NAME_PREFIX_LENGTH;
new_db.length= old_db->length - MYSQL50_TABLE_NAME_PREFIX_LENGTH;
- if (lock_databases(thd, old_db->str, old_db->length,
- new_db.str, new_db.length))
- DBUG_RETURN(1);
+ /* Lock the old name, the new name will be locked by mysql_create_db().*/
+ if (lock_schema_name(thd, old_db->str))
+ DBUG_RETURN(-1);
/*
Let's remember if we should do "USE newdb" afterwards.
@@ -2033,15 +1831,6 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
error|= mysql_change_db(thd, & new_db, FALSE);
exit:
- mysql_mutex_lock(&LOCK_lock_db);
- /* Remove the databases from db lock cache */
- lock_db_delete(old_db->str, old_db->length);
- lock_db_delete(new_db.str, new_db.length);
- creating_database--;
- /* Signal waiting CREATE TABLE's to continue */
- mysql_cond_signal(&COND_refresh);
- mysql_mutex_unlock(&LOCK_lock_db);
-
DBUG_RETURN(error);
}
diff --git a/sql/sql_db.h b/sql/sql_db.h
index 96b3de80d3a..ecb8deaa397 100644
--- a/sql/sql_db.h
+++ b/sql/sql_db.h
@@ -35,8 +35,8 @@ bool mysql_opt_change_db(THD *thd,
LEX_STRING *saved_db_name,
bool force_switch,
bool *cur_db_changed);
-bool my_database_names_init(void);
-void my_database_names_free(void);
+bool my_dboptions_cache_init(void);
+void my_dboptions_cache_free(void);
bool check_db_dir_existence(const char *db_name);
bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
bool load_db_opt_by_name(THD *thd, const char *db_name,
@@ -45,9 +45,6 @@ CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name);
bool my_dbopt_init(void);
void my_dbopt_cleanup(void);
-extern int creating_database; // How many database locks are made
-extern HASH lock_db_cache;
-
#define MY_DB_OPT_FILE "db.opt"
#endif /* SQL_DB_INCLUDED */
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 00666bc85b4..2f69bac917e 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -770,9 +770,9 @@ void multi_delete::send_error(uint errcode,const char *err)
}
-void multi_delete::abort()
+void multi_delete::abort_result_set()
{
- DBUG_ENTER("multi_delete::abort");
+ DBUG_ENTER("multi_delete::abort_result_set");
/* the error was handled or nothing deleted and no side effects return */
if (error_handled ||
diff --git a/sql/sql_do.cc b/sql/sql_do.cc
index 79e488ac2a5..085473c24b8 100644
--- a/sql/sql_do.cc
+++ b/sql/sql_do.cc
@@ -39,9 +39,10 @@ bool mysql_do(THD *thd, List<Item> &values)
/*
Rollback the effect of the statement, since next instruction
will clear the error and the rollback in the end of
- dispatch_command() won't work.
+ mysql_execute_command() won't work.
*/
- trans_rollback_stmt(thd);
+ if (! thd->in_sub_stmt)
+ trans_rollback_stmt(thd);
thd->clear_error(); // DO always is OK
}
my_ok(thd);
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index e5d0f79b2d7..8c038e10a1f 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -494,14 +494,6 @@ void Warning_info::clear_warning_info(ulonglong warn_id_arg)
m_current_row_for_warning= 1; /* Start counting from the first row */
}
-void Warning_info::reserve_space(THD *thd, uint count)
-{
- /* Make room for count conditions */
- while ((m_warn_list.elements > 0) &&
- ((m_warn_list.elements + count) > thd->variables.max_error_count))
- m_warn_list.pop();
-}
-
/**
Append warnings only if the original contents of the routine
warning info was replaced.
diff --git a/sql/sql_error.h b/sql/sql_error.h
index 9e649a004df..87e98e27673 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -153,8 +153,8 @@ private:
Representation of a SQL condition.
A SQL condition can be a completion condition (note, warning),
or an exception condition (error, not found).
- @note This class is named MYSQL_ERROR instead of SQL_condition for historical reasons,
- to facilitate merging code with previous releases.
+ @note This class is named MYSQL_ERROR instead of SQL_condition for
+ historical reasons, to facilitate merging code with previous releases.
*/
class MYSQL_ERROR : public Sql_alloc
{
@@ -471,18 +471,6 @@ public:
ulong statement_warn_count() const { return m_statement_warn_count; }
- /**
- Reserve some space in the condition area.
- This is a privileged operation, reserved for the RESIGNAL implementation,
- as only the RESIGNAL statement is allowed to remove conditions from
- the condition area.
- For other statements, new conditions are not added to the condition
- area once the condition area is full.
- @param thd The current thread
- @param count The number of slots to reserve
- */
- void reserve_space(THD *thd, uint count);
-
/** Add a new condition to the current list. */
MYSQL_ERROR *push_warning(THD *thd,
uint sql_errno, const char* sqlstate,
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 06a453f7b12..f1dddbb2eb5 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -59,7 +59,7 @@
#include "key.h" // key_copy
#include "sql_base.h" // insert_fields
#include "sql_select.h"
-#include <assert.h>
+#include "transaction.h"
#define HANDLER_TABLES_HASH_SIZE 120
@@ -309,9 +309,15 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
}
if (error)
{
+ /*
+ No need to rollback statement transaction, it's not started.
+ If called with reopen flag, no need to rollback either,
+ it will be done at statement end.
+ */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
close_thread_tables(thd);
- thd->set_open_tables(backup_open_tables);
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+ thd->set_open_tables(backup_open_tables);
if (!reopen)
my_hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables);
else
@@ -578,6 +584,11 @@ retry:
if (sql_handler_lock_error.need_reopen())
{
DBUG_ASSERT(!lock && !thd->is_error());
+ /*
+ Always close statement transaction explicitly,
+ so that the engine doesn't have to count locks.
+ */
+ trans_rollback_stmt(thd);
mysql_ha_close_table(thd, hash_tables);
goto retry;
}
@@ -747,7 +758,11 @@ retry:
goto ok;
}
if (cond && !cond->val_int())
+ {
+ if (thd->is_error())
+ goto err;
continue;
+ }
if (num_rows >= offset_limit_cnt)
{
protocol->prepare_for_resend();
@@ -760,12 +775,18 @@ retry:
num_rows++;
}
ok:
+ /*
+ Always close statement transaction explicitly,
+ so that the engine doesn't have to count locks.
+ */
+ trans_commit_stmt(thd);
mysql_unlock_tables(thd,lock);
my_eof(thd);
DBUG_PRINT("exit",("OK"));
DBUG_RETURN(FALSE);
err:
+ trans_rollback_stmt(thd);
mysql_unlock_tables(thd,lock);
err0:
DBUG_PRINT("exit",("ERROR"));
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 7bea236269a..4e3df950134 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -643,23 +643,24 @@ bool mysqld_help(THD *thd, const char *mask)
MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_help");
- bzero((uchar*)tables,sizeof(tables));
- tables[0].alias= tables[0].table_name= (char*) "help_topic";
- tables[0].lock_type= TL_READ;
+ tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("help_topic"),
+ "help_topic", TL_READ);
+ tables[1].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("help_category"),
+ "help_category", TL_READ);
+ tables[2].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("help_relation"),
+ "help_relation", TL_READ);
+ tables[3].init_one_table(C_STRING_WITH_LEN("mysql"),
+ C_STRING_WITH_LEN("help_keyword"),
+ "help_keyword", TL_READ);
tables[0].next_global= tables[0].next_local=
tables[0].next_name_resolution_table= &tables[1];
- tables[1].alias= tables[1].table_name= (char*) "help_category";
- tables[1].lock_type= TL_READ;
tables[1].next_global= tables[1].next_local=
tables[1].next_name_resolution_table= &tables[2];
- tables[2].alias= tables[2].table_name= (char*) "help_relation";
- tables[2].lock_type= TL_READ;
tables[2].next_global= tables[2].next_local=
tables[2].next_name_resolution_table= &tables[3];
- tables[3].alias= tables[3].table_name= (char*) "help_keyword";
- tables[3].lock_type= TL_READ;
- tables[0].db= tables[1].db= tables[2].db= tables[3].db= (char*) "mysql";
- init_mdl_requests(tables);
/*
HELP must be available under LOCK TABLES.
diff --git a/sql/sql_hset.h b/sql/sql_hset.h
new file mode 100644
index 00000000000..2ea70b91da8
--- /dev/null
+++ b/sql/sql_hset.h
@@ -0,0 +1,97 @@
+#ifndef SQL_HSET_INCLUDED
+#define SQL_HSET_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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "my_global.h"
+#include "hash.h"
+
+
+/**
+ A type-safe wrapper around mysys HASH.
+*/
+
+template <typename T, my_hash_get_key K>
+class Hash_set
+{
+public:
+ typedef T Value_type;
+ enum { START_SIZE= 8 };
+ /**
+ Constructs an empty hash. Does not allocate memory, it is done upon
+ the first insert. Thus does not cause or return errors.
+ */
+ Hash_set()
+ {
+ my_hash_clear(&m_hash);
+ }
+ /**
+ Destroy the hash by freeing the buckets table. Does
+ not call destructors for the elements.
+ */
+ ~Hash_set()
+ {
+ my_hash_free(&m_hash);
+ }
+ /**
+ Insert a single value into a hash. Does not tell whether
+ the value was inserted -- if an identical value existed,
+ it is not replaced.
+
+ @retval TRUE Out of memory.
+ @retval FALSE OK. The value either was inserted or existed
+ in the hash.
+ */
+ bool insert(T *value)
+ {
+ my_hash_init_opt(&m_hash, &my_charset_bin, START_SIZE, 0, 0, K, 0, MYF(0));
+ size_t key_len;
+ const uchar *key= K(reinterpret_cast<uchar*>(value), &key_len, FALSE);
+ if (my_hash_search(&m_hash, key, key_len) == NULL)
+ return my_hash_insert(&m_hash, reinterpret_cast<uchar *>(value));
+ return FALSE;
+ }
+ /** Is this hash set empty? */
+ bool is_empty() const { return m_hash.records == 0; }
+ /** Returns the number of unique elements. */
+ size_t size() const { return static_cast<size_t>(m_hash.records); }
+ /** An iterator over hash elements. Is not insert-stable. */
+ class Iterator
+ {
+ public:
+ Iterator(Hash_set &hash_set)
+ : m_hash(&hash_set.m_hash),
+ m_idx(0)
+ {}
+ /**
+ Return the current element and reposition the iterator to the next
+ element.
+ */
+ inline T *operator++(int)
+ {
+ if (m_idx < m_hash->records)
+ return reinterpret_cast<T*>(my_hash_element(m_hash, m_idx++));
+ return NULL;
+ }
+ void rewind() { m_idx= 0; }
+ private:
+ HASH *m_hash;
+ uint m_idx;
+ };
+private:
+ HASH m_hash;
+};
+
+#endif // SQL_HSET_INCLUDED
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index c783d74b363..a0d347f48de 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1862,7 +1862,10 @@ public:
while ((row=rows.get()))
delete row;
if (table)
+ {
close_thread_tables(&thd);
+ thd.mdl_context.release_transactional_locks();
+ }
mysql_mutex_lock(&LOCK_thread_count);
mysql_mutex_destroy(&mutex);
mysql_cond_destroy(&cond);
@@ -2414,6 +2417,8 @@ bool Delayed_insert::open_and_lock_table()
}
if (!(table->file->ha_table_flags() & HA_CAN_INSERT_DELAYED))
{
+ /* To rollback InnoDB statement transaction. */
+ trans_rollback_stmt(&thd);
my_error(ER_DELAYED_NOT_SUPPORTED, MYF(ME_FATALERROR),
table_list.table_name);
return TRUE;
@@ -2480,12 +2485,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
goto err;
}
- /*
- Open table requires an initialized lex in case the table is
- partitioned. The .frm file contains a partial SQL string which is
- parsed using a lex, that depends on initialized thd->lex.
- */
- lex_start(thd);
thd->lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
/*
Statement-based replication of INSERT DELAYED has problems with RAND()
@@ -2619,28 +2618,11 @@ pthread_handler_t handle_delayed_insert(void *arg)
}
err:
- /*
- mysql_lock_tables() can potentially start a transaction and write
- a table map. In the event of an error, that transaction has to be
- rolled back. We only need to roll back a potential statement
- transaction, since real transactions are rolled back in
- close_thread_tables().
-
- TODO: This is not true any more, table maps are generated on the
- first call to ha_*_row() instead. Remove code that are used to
- cover for the case outlined above.
- */
- trans_rollback_stmt(thd);
-
DBUG_LEAVE;
}
- /*
- di should be unlinked from the thread handler list and have no active
- clients
- */
-
close_thread_tables(thd); // Free the table
+ thd->mdl_context.release_transactional_locks();
di->table=0;
thd->killed= THD::KILL_CONNECTION; // If error
mysql_cond_broadcast(&di->cond_client); // Safety
@@ -2648,6 +2630,10 @@ pthread_handler_t handle_delayed_insert(void *arg)
mysql_mutex_lock(&LOCK_delayed_create); // Because of delayed_get_table
mysql_mutex_lock(&LOCK_delayed_insert);
+ /*
+ di should be unlinked from the thread handler list and have no active
+ clients
+ */
delete di;
mysql_mutex_unlock(&LOCK_delayed_insert);
mysql_mutex_unlock(&LOCK_delayed_create);
@@ -3413,9 +3399,9 @@ bool select_insert::send_eof()
DBUG_RETURN(0);
}
-void select_insert::abort() {
+void select_insert::abort_result_set() {
- DBUG_ENTER("select_insert::abort");
+ DBUG_ENTER("select_insert::abort_result_set");
/*
If the creation of the table failed (due to a syntax error, for
example), no table will have been opened and therefore 'table'
@@ -3952,9 +3938,9 @@ bool select_create::send_eof()
}
-void select_create::abort()
+void select_create::abort_result_set()
{
- DBUG_ENTER("select_create::abort");
+ DBUG_ENTER("select_create::abort_result_set");
/*
In select_insert::abort() we roll back the statement, including
@@ -3972,7 +3958,7 @@ void select_create::abort()
log state.
*/
tmp_disable_binlog(thd);
- select_insert::abort();
+ select_insert::abort_result_set();
thd->transaction.stmt.modified_non_trans_table= FALSE;
reenable_binlog(thd);
/* possible error of writing binary log is ignored deliberately */
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 568640b574a..140cdb21eef 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -152,7 +152,7 @@ st_parsing_options::reset()
*/
bool Lex_input_stream::init(THD *thd,
- const char* buff,
+ char* buff,
unsigned int length)
{
DBUG_EXECUTE_IF("bug42064_simulate_oom",
@@ -182,7 +182,7 @@ bool Lex_input_stream::init(THD *thd,
*/
void
-Lex_input_stream::reset(const char *buffer, unsigned int length)
+Lex_input_stream::reset(char *buffer, unsigned int length)
{
yylineno= 1;
yytoklen= 0;
@@ -401,6 +401,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;
@@ -449,6 +450,9 @@ void lex_end(LEX *lex)
}
reset_dynamic(&lex->plugins);
+ delete lex->sphead;
+ lex->sphead= NULL;
+
DBUG_VOID_RETURN;
}
@@ -1424,11 +1428,10 @@ int lex_one_token(void *arg, void *yythd)
ulong version;
version=strtol(version_str, NULL, 10);
- /* Accept 'M' 'm' 'm' 'd' 'd' */
- lip->yySkipn(5);
-
if (version <= MYSQL_VERSION_ID)
{
+ /* Accept 'M' 'm' 'm' 'd' 'd' */
+ lip->yySkipn(5);
/* Expand the content of the special comment as real code */
lip->set_echo(TRUE);
state=MY_LEX_START;
@@ -1436,7 +1439,19 @@ 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).
+ */
+ char *pcom= lip->yyUnput(' ');
comment_closed= ! consume_comment(lip, 1);
+ if (! comment_closed)
+ {
+ DBUG_ASSERT(pcom == version_mark);
+ *pcom= '!';
+ }
/* version allowed to have one level of comment inside. */
}
}
@@ -2286,6 +2301,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;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 784a69cf9c1..0eb8e5de6d2 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -919,6 +919,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.
@@ -1276,6 +1294,125 @@ public:
DBUG_VOID_RETURN;
}
+ enum enum_stmt_accessed_table
+ {
+ /*
+ If a transactional table is about to be read. Note that
+ a write implies a read.
+ */
+ 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 temporary non-transactional table is about to be updated.
+ */
+ STMT_WRITES_TEMP_NON_TRANS_TABLE,
+ /*
+ The last element of the enumeration. Please, if necessary add
+ anything before this.
+ */
+ STMT_ACCESS_TABLE_COUNT
+ };
+
+ /**
+ Sets the type of table that is about to be accessed while executing a
+ statement.
+
+ @param accessed_table Enumeration type that defines the type of table,
+ e.g. temporary, transactional, non-transactional.
+ */
+ inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table)
+ {
+ DBUG_ENTER("THD::set_stmt_accessed_table");
+
+ DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
+ stmt_accessed_table_flag |= (1U << accessed_table);
+
+ DBUG_VOID_RETURN;
+ }
+
+ /**
+ Checks if a type of table is about to be accessed while executing a
+ statement.
+
+ @param accessed_table Enumeration type that defines the type of table,
+ e.g. temporary, transactional, non-transactional.
+
+ @return
+ @retval TRUE if the type of the table is about to be accessed
+ @retval FALSE otherwise
+ */
+ inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table)
+ {
+ DBUG_ENTER("THD::stmt_accessed_table");
+
+ DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
+
+ DBUG_RETURN((stmt_accessed_table_flag & (1U << accessed_table)) != 0);
+ }
+
+ /**
+ Checks if a temporary table is about to be accessed while executing a
+ statement.
+
+ @return
+ @retval TRUE if a temporary table is about to be accessed
+ @retval FALSE otherwise
+ */
+ inline bool stmt_accessed_temp_table()
+ {
+ DBUG_ENTER("THD::stmt_accessed_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_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
+ }
+
+ /**
+ Checks if a temporary non-transactional table is about to be accessed
+ while executing a statement.
+
+ @return
+ @retval TRUE if a temporary non-transactional table is about to be
+ accessed
+ @retval FALSE otherwise
+ */
+ inline bool stmt_accessed_non_trans_temp_table()
+ {
+ DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
+
+ DBUG_RETURN((stmt_accessed_table_flag &
+ ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
+ (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
+ }
+
/**
true if the parsed tree contains references to stored procedures
or functions, false otherwise
@@ -1317,6 +1454,12 @@ private:
stored procedure has its own LEX object (but no own THD object).
*/
uint32 binlog_stmt_flags;
+
+ /**
+ Bit field that determines the type of tables that are about to be
+ be accessed while executing a statement.
+ */
+ uint32 stmt_accessed_table_flag;
};
@@ -1392,9 +1535,9 @@ public:
@retval FALSE OK
@retval TRUE Error
*/
- bool init(THD *thd, const char *buff, unsigned int length);
+ bool init(THD *thd, char *buff, unsigned int length);
- void reset(const char *buff, unsigned int length);
+ void reset(char *buff, unsigned int length);
/**
Set the echo mode.
@@ -1510,6 +1653,20 @@ public:
}
/**
+ Puts a character back into the stream, canceling
+ the effect of the last yyGet() or yySkip().
+ Note that the echo mode should not change between calls
+ to unput, get, or skip from the stream.
+ */
+ char *yyUnput(char ch)
+ {
+ *--m_ptr= ch;
+ if (m_echo)
+ m_cpp_ptr--;
+ return m_ptr;
+ }
+
+ /**
End of file indicator for the query text to parse.
@return true if there are no more characters to parse
*/
@@ -1666,7 +1823,7 @@ public:
private:
/** Pointer to the current position in the raw input stream. */
- const char *m_ptr;
+ char *m_ptr;
/** Starting position of the last token parsed, in the raw buffer. */
const char *m_tok_start;
@@ -2348,7 +2505,7 @@ public:
@retval FALSE OK
@retval TRUE Error
*/
- bool init(THD *thd, const char *buff, unsigned int length)
+ bool init(THD *thd, char *buff, unsigned int length)
{
return m_lip.init(thd, buff, length);
}
@@ -2359,7 +2516,7 @@ public:
Lex_input_stream m_lip;
Yacc_state m_yacc;
- void reset(const char *found_semicolon, unsigned int length)
+ void reset(char *found_semicolon, unsigned int length)
{
m_lip.reset(found_semicolon, length);
m_yacc.reset();
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index b2a816a69dd..d367c1c4fde 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -175,6 +175,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
bool is_fifo=0;
#ifndef EMBEDDED_LIBRARY
LOAD_FILE_INFO lf_info;
+ THD::killed_state killed_status= THD::NOT_KILLED;
#endif
char *db = table_list->db; // This is never null
/*
@@ -186,7 +187,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
ulong skip_lines= ex->skip_lines;
bool transactional_table;
bool is_concurrent;
- THD::killed_state killed_status= THD::NOT_KILLED;
DBUG_ENTER("mysql_load");
#ifdef EMBEDDED_LIBRARY
@@ -510,7 +510,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
error=1;
thd->killed= THD::KILL_QUERY;
};);
- killed_status= (error == 0)? THD::NOT_KILLED : thd->killed;
+
+#ifndef EMBEDDED_LIBRARY
+ killed_status= (error == 0) ? THD::NOT_KILLED : thd->killed;
+#endif
+
/*
We must invalidate the table in query cache before binlog writing and
ha_autocommit_...
@@ -553,7 +557,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (lf_info.wrote_create_file)
{
int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
-
+
/* since there is already an error, the possible error of
writing binary log will be ignored */
if (thd->transaction.stmt.modified_non_trans_table)
@@ -767,12 +771,9 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List_iterator_fast<Item> it(fields_vars);
Item_field *sql_field;
TABLE *table= table_list->table;
- ulonglong id;
bool err;
DBUG_ENTER("read_fixed_length");
- id= 0;
-
while (!read_info.read_fixed_length())
{
if (thd->killed)
@@ -901,12 +902,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
Item *item;
TABLE *table= table_list->table;
uint enclosed_length;
- ulonglong id;
bool err;
DBUG_ENTER("read_sep_field");
enclosed_length=enclosed.length();
- id= 0;
for (;;it.rewind())
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ff7080e6c1b..806a2984905 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -50,6 +50,7 @@
// mysql_backup_table,
// mysql_restore_table
#include "sql_truncate.h" // mysql_truncate_table
+#include "sql_admin.h" // mysql_assign_to_keycache
#include "sql_connect.h" // check_user,
// decrease_user_connections,
// thd_init_client_charset, check_mqh,
@@ -115,6 +116,7 @@
"FUNCTION" : "PROCEDURE")
static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
+static void sql_kill(THD *thd, ulong id, bool only_kill_query);
const char *any_db="*any*"; // Special symbol for check_access
@@ -270,10 +272,10 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_LOAD]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_PROTECT_AGAINST_GRL |
CF_CAN_GENERATE_ROW_EVENTS;
- sql_command_flags[SQLCOM_CREATE_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_DROP_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_ALTER_DB_UPGRADE]= CF_AUTO_COMMIT_TRANS;
- sql_command_flags[SQLCOM_ALTER_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_CREATE_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
+ sql_command_flags[SQLCOM_DROP_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
+ sql_command_flags[SQLCOM_ALTER_DB_UPGRADE]= CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
+ sql_command_flags[SQLCOM_ALTER_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
sql_command_flags[SQLCOM_RENAME_TABLE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_DROP_INDEX]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_CREATE_VIEW]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
@@ -413,6 +415,9 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_FLUSH]= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_RESET]= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_CHECK]= CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_CREATE_SERVER]= CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_ALTER_SERVER]= CF_AUTO_COMMIT_TRANS;
+ sql_command_flags[SQLCOM_DROP_SERVER]= CF_AUTO_COMMIT_TRANS;
}
bool sqlcom_can_generate_row_events(const THD *thd)
@@ -568,7 +573,6 @@ static void handle_bootstrap_impl(THD *thd)
}
mysql_parse(thd, thd->query(), length, &parser_state);
- close_thread_tables(thd); // Free tables
bootstrap_error= thd->is_error();
thd->protocol->end_statement();
@@ -656,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;
@@ -1139,13 +1142,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
char *beginning_of_next_stmt= (char*)
parser_state.m_lip.found_semicolon;
-
- thd->protocol->end_statement();
- query_cache_end_of_result(thd);
/*
Multiple queries exits, execute them individually
*/
- close_thread_tables(thd);
+ thd->protocol->end_statement();
+ query_cache_end_of_result(thd);
ulong length= (ulong)(packet_end - beginning_of_next_stmt);
log_slow_statement(thd);
@@ -1197,38 +1198,54 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
char *fields, *packet_end= packet + packet_length, *arg_end;
/* Locked closure of all tables */
TABLE_LIST table_list;
- LEX_STRING conv_name;
-
- /* used as fields initializator */
- lex_start(thd);
+ LEX_STRING table_name;
+ LEX_STRING db;
+ /*
+ SHOW statements should not add the used tables to the list of tables
+ used in a transaction.
+ */
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
status_var_increment(thd->status_var.com_stat[SQLCOM_SHOW_FIELDS]);
- bzero((char*) &table_list,sizeof(table_list));
- if (thd->copy_db_to(&table_list.db, &table_list.db_length))
+ if (thd->copy_db_to(&db.str, &db.length))
break;
/*
We have name + wildcard in packet, separated by endzero
*/
arg_end= strend(packet);
uint arg_length= arg_end - packet;
-
+
/* Check given table name length. */
if (arg_length >= packet_length || arg_length > NAME_LEN)
{
my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
break;
}
- thd->convert_string(&conv_name, system_charset_info,
+ thd->convert_string(&table_name, system_charset_info,
packet, arg_length, thd->charset());
- if (check_table_name(conv_name.str, conv_name.length, FALSE))
+ if (check_table_name(table_name.str, table_name.length, FALSE))
{
/* this is OK due to convert_string() null-terminating the string */
- my_error(ER_WRONG_TABLE_NAME, MYF(0), conv_name.str);
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name.str);
break;
}
-
- table_list.alias= table_list.table_name= conv_name.str;
packet= arg_end + 1;
+ mysql_reset_thd_for_next_command(thd);
+ lex_start(thd);
+ /* Must be before we init the table list. */
+ if (lower_case_table_names)
+ table_name.length= my_casedn_str(files_charset_info, table_name.str);
+ table_list.init_one_table(db.str, db.length, table_name.str,
+ table_name.length, table_name.str, TL_READ);
+ /*
+ Init TABLE_LIST members necessary when the undelrying
+ table is view.
+ */
+ table_list.select_lex= &(thd->lex->select_lex);
+ thd->lex->
+ select_lex.table_list.link_in_list(&table_list,
+ &table_list.next_local);
+ thd->lex->add_to_query_tables(&table_list);
if (is_infoschema_db(table_list.db, table_list.db_length))
{
@@ -1242,32 +1259,23 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
thd->set_query(fields, query_length);
general_log_print(thd, command, "%s %s", table_list.table_name, fields);
- if (lower_case_table_names)
- my_casedn_str(files_charset_info, table_list.table_name);
- if (check_access(thd, SELECT_ACL, table_list.db,
- &table_list.grant.privilege,
- &table_list.grant.m_internal,
- 0, 0))
- break;
- if (check_grant(thd, SELECT_ACL, &table_list, TRUE, UINT_MAX, FALSE))
+ if (check_table_access(thd, SELECT_ACL, &table_list,
+ TRUE, UINT_MAX, FALSE))
break;
- /* init structures for VIEW processing */
- table_list.select_lex= &(thd->lex->select_lex);
-
- lex_start(thd);
- mysql_reset_thd_for_next_command(thd);
-
- thd->lex->
- select_lex.table_list.link_in_list(&table_list,
- &table_list.next_local);
- thd->lex->add_to_query_tables(&table_list);
- init_mdl_requests(&table_list);
-
- /* switch on VIEW optimisation: do not fill temporary tables */
+ /*
+ Turn on an optimization relevant if the underlying table
+ is a view: do not fill derived tables.
+ */
thd->lex->sql_command= SQLCOM_SHOW_FIELDS;
+
mysqld_list_fields(thd,&table_list,fields);
thd->lex->unit.cleanup();
+ /* No need to rollback statement transaction, it's not started. */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+ close_thread_tables(thd);
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+
thd->cleanup_after_query();
break;
}
@@ -1315,7 +1323,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
ulong options= (ulong) (uchar) packet[0];
if (trans_commit_implicit(thd))
break;
- close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();
if (check_global_access(thd,RELOAD_ACL))
break;
@@ -1377,7 +1384,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_PRINT("quit",("Got shutdown command for level %u", level));
general_log_print(thd, command, NullS);
my_eof(thd);
- close_thread_tables(thd); // Free before kill
kill_mysql();
error=TRUE;
break;
@@ -1387,7 +1393,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
STATUS_VAR current_global_status_var;
ulong uptime;
- uint length;
+ uint length __attribute__((unused));
ulonglong queries_per_second1000;
char buff[250];
uint buff_len= sizeof(buff);
@@ -1400,7 +1406,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
else
queries_per_second1000= thd->query_id * LL(1000) / uptime;
- length= my_snprintf((char*) buff, buff_len - 1,
+ length= my_snprintf(buff, buff_len - 1,
"Uptime: %lu Threads: %d Questions: %lu "
"Slow queries: %lu Opens: %lu Flush tables: %lu "
"Open tables: %u Queries per second avg: %u.%u",
@@ -1480,33 +1486,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
break;
}
-
- /* report error issued during command execution */
- if (thd->killed_errno())
- {
- if (! thd->stmt_da->is_set())
- thd->send_kill_message();
- }
- if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
- {
- thd->killed= THD::NOT_KILLED;
- thd->mysys_var->abort= 0;
- }
-
- /* If commit fails, we should be able to reset the OK status. */
- thd->stmt_da->can_overwrite_status= TRUE;
- thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
- thd->stmt_da->can_overwrite_status= FALSE;
-
- thd->transaction.stmt.reset();
+ DBUG_ASSERT(thd->derived_tables == NULL &&
+ (thd->open_tables == NULL ||
+ (thd->locked_tables_mode == LTM_LOCK_TABLES)));
thd->protocol->end_statement();
query_cache_end_of_result(thd);
- thd->proc_info= "closing tables";
- /* Free tables */
- close_thread_tables(thd);
-
if (!thd->is_error() && !thd->killed_errno())
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_RESULT, 0, 0);
@@ -1525,7 +1511,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#endif
if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
{
- int res;
+ int res __attribute__((unused));
res= (int) thd->is_error();
if (command == COM_QUERY)
{
@@ -1715,6 +1701,9 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
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
-------------------
@@ -1792,7 +1781,8 @@ static bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
current internal MDL asserts, fix after discussing with
Dmitry.
*/
- if (lock_table_names(thd, all_tables))
+ 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;
@@ -1815,9 +1805,9 @@ static bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
&lock_tables_prelocking_strategy) ||
thd->locked_tables_list.init_locked_tables(thd))
{
- close_thread_tables(thd);
goto error;
}
+ thd->variables.option_bits|= OPTION_TABLE_LOCK;
/*
Downgrade the exclusive locks.
@@ -2040,6 +2030,7 @@ mysql_execute_command(THD *thd)
thd->work_part_info= 0;
#endif
+ DBUG_ASSERT(thd->transaction.stmt.is_empty() || thd->in_sub_stmt);
/*
In many cases first table of main SELECT_LEX have special meaning =>
check that it is first table in global list and relink it first in
@@ -2221,8 +2212,7 @@ mysql_execute_command(THD *thd)
/* Commit the normal transaction if one is active. */
if (trans_commit_implicit(thd))
goto error;
- /* Close tables and release metadata locks. */
- close_thread_tables(thd);
+ /* Release metadata locks acquired in this transaction. */
thd->mdl_context.release_transactional_locks();
}
@@ -2841,77 +2831,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);
@@ -3031,81 +2950,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;
@@ -3326,23 +3170,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);
@@ -3401,7 +3228,7 @@ end_with_restore_list:
res|= thd->is_error();
MYSQL_MULTI_DELETE_DONE(res, del_result->num_deleted());
if (res)
- del_result->abort();
+ del_result->abort_result_set();
delete del_result;
}
else
@@ -3535,24 +3362,27 @@ end_with_restore_list:
done FLUSH TABLES WITH READ LOCK + BEGIN. If this assumption becomes
false, mysqldump will not work.
*/
- thd->locked_tables_list.unlock_locked_tables(thd);
if (thd->variables.option_bits & OPTION_TABLE_LOCK)
{
- trans_commit_implicit(thd);
+ res= trans_commit_implicit(thd);
+ thd->locked_tables_list.unlock_locked_tables(thd);
thd->mdl_context.release_transactional_locks();
thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
}
if (thd->global_read_lock.is_acquired())
thd->global_read_lock.unlock_global_read_lock(thd);
+ if (res)
+ goto error;
my_ok(thd);
break;
case SQLCOM_LOCK_TABLES:
+ /* We must end the transaction first, regardless of anything */
+ res= trans_commit_implicit(thd);
thd->locked_tables_list.unlock_locked_tables(thd);
- /* we must end the trasaction first, regardless of anything */
- if (trans_commit_implicit(thd))
- goto error;
- /* release transactional metadata locks. */
+ /* Release transactional metadata locks. */
thd->mdl_context.release_transactional_locks();
+ if (res)
+ goto error;
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
FALSE, UINT_MAX, FALSE))
goto error;
@@ -3575,17 +3405,14 @@ end_with_restore_list:
if (res)
{
+ trans_rollback_stmt(thd);
/*
Need to end the current transaction, so the storage engine (InnoDB)
can free its locks if LOCK TABLES locked some tables before finding
that it can't lock a table in its list
*/
- trans_rollback_stmt(thd);
trans_commit_implicit(thd);
- /*
- Close tables and release metadata locks otherwise a later call to
- close_thread_tables might not release the locks if autocommit is off.
- */
+ /* Close tables and release metadata locks. */
close_thread_tables(thd);
DBUG_ASSERT(!thd->locked_tables_mode);
thd->mdl_context.release_transactional_locks();
@@ -3633,12 +3460,6 @@ end_with_restore_list:
#endif
if (check_access(thd, CREATE_ACL, lex->name.str, NULL, NULL, 1, 0))
break;
- if (thd->locked_tables_mode)
- {
- my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
- goto error;
- }
res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias :
lex->name.str), &create_info, 0);
break;
@@ -3668,12 +3489,6 @@ end_with_restore_list:
#endif
if (check_access(thd, DROP_ACL, lex->name.str, NULL, NULL, 1, 0))
break;
- if (thd->locked_tables_mode)
- {
- my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
- goto error;
- }
res= mysql_rm_db(thd, lex->name.str, lex->drop_if_exists, 0);
break;
}
@@ -3702,14 +3517,6 @@ end_with_restore_list:
res= 1;
break;
}
- if (thd->locked_tables_mode)
- {
- res= 1;
- my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
- goto error;
- }
-
res= mysql_upgrade_db(thd, db);
if (!res)
my_ok(thd);
@@ -3742,12 +3549,6 @@ end_with_restore_list:
#endif
if (check_access(thd, ALTER_ACL, db->str, NULL, NULL, 1, 0))
break;
- if (thd->locked_tables_mode)
- {
- my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
- goto error;
- }
res= mysql_alter_db(thd, db->str, &create_info);
break;
}
@@ -4230,9 +4031,7 @@ end_with_restore_list:
locks in the MDL context, so there is no risk to
deadlock.
*/
- trans_commit_implicit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ close_mysql_tables(thd);
/*
Check if the definer exists on slave,
then use definer privilege to insert routine privileges to mysql.procs_priv.
@@ -4509,9 +4308,7 @@ create_sp_error:
locks in the MDL context, so there is no risk to
deadlock.
*/
- trans_commit_implicit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ close_mysql_tables(thd);
if (sp_automatic_privileges && !opt_noacl &&
sp_revoke_privileges(thd, db, name,
@@ -4758,6 +4555,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);
@@ -4803,17 +4608,60 @@ finish:
DBUG_ASSERT(!thd->in_active_multi_stmt_transaction() ||
thd->in_multi_stmt_transaction_mode());
+
+ if (! thd->in_sub_stmt)
+ {
+ /* report error issued during command execution */
+ if (thd->killed_errno())
+ {
+ if (! thd->stmt_da->is_set())
+ thd->send_kill_message();
+ }
+ if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
+ {
+ thd->killed= THD::NOT_KILLED;
+ thd->mysys_var->abort= 0;
+ }
+ if (thd->is_error() || (thd->variables.option_bits & OPTION_MASTER_SQL_ERROR))
+ trans_rollback_stmt(thd);
+ else
+ {
+ /* If commit fails, we should be able to reset the OK status. */
+ thd->stmt_da->can_overwrite_status= TRUE;
+ trans_commit_stmt(thd);
+ thd->stmt_da->can_overwrite_status= FALSE;
+ }
+ }
+
+ lex->unit.cleanup();
+ /* Free tables */
+ thd_proc_info(thd, "closing tables");
+ close_thread_tables(thd);
+ thd_proc_info(thd, 0);
+
if (stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_END))
{
+ /* No transaction control allowed in sub-statements. */
+ DBUG_ASSERT(! thd->in_sub_stmt);
/* If commit fails, we should be able to reset the OK status. */
thd->stmt_da->can_overwrite_status= TRUE;
- /* Commit or rollback the statement transaction. */
- thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
/* Commit the normal transaction if one is active. */
trans_commit_implicit(thd);
thd->stmt_da->can_overwrite_status= FALSE;
- /* Close tables and release metadata locks. */
- close_thread_tables(thd);
+ thd->mdl_context.release_transactional_locks();
+ }
+ else if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
+ {
+ /*
+ - If inside a multi-statement transaction,
+ defer the release of metadata locks until the current
+ transaction is either committed or rolled back. This prevents
+ other statements from modifying the table for the entire
+ duration of this transaction. This provides commit ordering
+ and guarantees serializability across multiple transactions.
+ - If in autocommit mode, or outside a transactional context,
+ automatically release metadata locks of the current statement.
+ */
thd->mdl_context.release_transactional_locks();
}
@@ -4858,7 +4706,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
ER_YES, str.ptr());
}
if (res)
- result->abort();
+ result->abort_result_set();
else
result->send_eof();
delete result;
@@ -5637,7 +5485,6 @@ void THD::reset_for_next_command()
thd->reset_current_stmt_binlog_format_row();
thd->binlog_unsafe_warning_flags= 0;
- thd->stmt_accessed_table_flag= 0;
DBUG_PRINT("debug",
("is_current_stmt_binlog_format_row(): %d",
@@ -5817,16 +5664,16 @@ void mysql_init_multi_delete(LEX *lex)
Parse a query.
@param thd Current thread
- @param inBuf Begining of the query text
+ @param rawbuf Begining of the query text
@param length Length of the query text
@param[out] found_semicolon For multi queries, position of the character of
the next query in the query text.
*/
-void mysql_parse(THD *thd, const char *inBuf, uint length,
+void mysql_parse(THD *thd, char *rawbuf, uint length,
Parser_state *parser_state)
{
- int error;
+ int error __attribute__((unused));
DBUG_ENTER("mysql_parse");
DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on(););
@@ -5850,7 +5697,7 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
lex_start(thd);
mysql_reset_thd_for_next_command(thd);
- if (query_cache_send_result_to_client(thd, (char*) inBuf, length) <= 0)
+ if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
{
LEX *lex= thd->lex;
@@ -5911,12 +5758,6 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
query_cache_abort(&thd->query_cache_tls);
}
- if (thd->lex->sphead)
- {
- delete thd->lex->sphead;
- thd->lex->sphead= 0;
- }
- lex->unit.cleanup();
thd_proc_info(thd, "freeing items");
thd->end_statement();
thd->cleanup_after_query();
@@ -5938,14 +5779,14 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
1 can be ignored
*/
-bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
+bool mysql_test_parse_for_slave(THD *thd, char *rawbuf, uint length)
{
LEX *lex= thd->lex;
bool error= 0;
DBUG_ENTER("mysql_test_parse_for_slave");
Parser_state parser_state;
- if (!(error= parser_state.init(thd, inBuf, length)))
+ if (!(error= parser_state.init(thd, rawbuf, length)))
{
lex_start(thd);
mysql_reset_thd_for_next_command(thd);
@@ -7022,11 +6863,15 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
only_kill_query Should it kill the query or the connection
*/
+static
void sql_kill(THD *thd, ulong id, bool only_kill_query)
{
uint error;
if (!(error= kill_one_thread(thd, id, only_kill_query)))
- my_ok(thd);
+ {
+ if (! thd->killed)
+ my_ok(thd);
+ }
else
my_error(error, MYF(0), id);
}
@@ -7853,6 +7698,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 475811d45b7..dd5b8aacc0a 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -51,7 +51,6 @@ bool parse_sql(THD *thd,
Object_creation_ctx *creation_ctx);
uint kill_one_thread(THD *thd, ulong id, bool only_kill_query);
-void sql_kill(THD *thd, ulong id, bool only_kill_query);
void free_items(Item *item);
void cleanup_items(Item *item);
@@ -84,7 +83,7 @@ bool is_update_query(enum enum_sql_command command);
bool is_log_table_write_query(enum enum_sql_command command);
bool alloc_query(THD *thd, const char *packet, uint packet_length);
void mysql_init_select(LEX *lex);
-void mysql_parse(THD *thd, const char *inBuf, uint length,
+void mysql_parse(THD *thd, char *rawbuf, uint length,
Parser_state *parser_state);
void mysql_reset_thd_for_next_command(THD *thd);
bool mysql_new_select(LEX *lex, bool move_down);
@@ -156,6 +155,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 d7ff753dfd0..0107a4d8144 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -59,7 +59,7 @@
#include "my_md5.h"
#include "transaction.h"
-#include "sql_base.h" // close_thread_tables
+#include "sql_base.h" // close_all_tables_for_name
#include "sql_table.h" // build_table_filename,
// build_table_shadow_filename,
// table_to_filename
@@ -71,6 +71,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;
@@ -1071,7 +1073,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
partition_info *part_info= table->part_info;
bool result= TRUE;
int error;
- const char *save_where;
LEX *old_lex= thd->lex;
LEX lex;
uint8 saved_full_group_by_flag;
@@ -1083,7 +1084,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
func_expr->walk(&Item::change_context_processor, 0,
(uchar*) &lex.select_lex.context);
- save_where= thd->where;
thd->where= "partition function";
/*
In execution we must avoid the use of thd->change_item_tree since
@@ -4185,7 +4185,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index,
*/
bool mysql_unpack_partition(THD *thd,
- const char *part_buf, uint part_info_len,
+ char *part_buf, uint part_info_len,
TABLE* table, bool is_create_table_ind,
handlerton *default_db_type,
bool *work_part_info_used)
@@ -6111,25 +6111,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);
@@ -6138,7 +6145,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);
}
@@ -6155,9 +6162,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)
@@ -6171,20 +6184,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;
@@ -6284,6 +6302,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);
+ }
+ }
+ mysql_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(0);
+}
+
+
+/*
Handle errors for ALTER TABLE for partitioning
SYNOPSIS
handle_alter_part_error()
@@ -6296,13 +6363,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))
{
/*
@@ -6403,6 +6483,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.
@@ -6440,7 +6536,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;
@@ -6539,20 +6637,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
@@ -6563,40 +6659,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;
}
}
@@ -6615,54 +6725,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;
}
}
@@ -6705,13 +6825,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
@@ -6720,36 +6841,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
@@ -6758,7 +6899,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
table_list, FALSE, NULL,
written_bin_log));
err:
- close_thread_tables(thd);
+ 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.h b/sql/sql_partition.h
index 2e0ea740555..c644e63794c 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -110,7 +110,7 @@ void get_full_part_id_from_key(const TABLE *table, uchar *buf,
KEY *key_info,
const key_range *key_spec,
part_id_range *part_spec);
-bool mysql_unpack_partition(THD *thd, const char *part_buf,
+bool mysql_unpack_partition(THD *thd, char *part_buf,
uint part_info_len,
TABLE *table, bool is_create_table_ind,
handlerton *default_db_type,
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 3a0945faa49..7e8c1fed999 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -21,7 +21,7 @@
#include "sql_locale.h"
#include "sql_plugin.h"
#include "sql_parse.h" // check_table_access
-#include "sql_base.h" // close_thread_tables
+#include "sql_base.h" // close_mysql_tables
#include "key.h" // key_copy
#include "sql_show.h" // remove_status_vars, add_status_vars
#include "strfunc.h" // find_set
@@ -1453,8 +1453,8 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
sql_print_error(ER(ER_GET_ERRNO), my_errno);
end_read_record(&read_record_info);
table->m_needs_reopen= TRUE; // Force close to free memory
+ close_mysql_tables(new_thd);
end:
- close_thread_tables(new_thd);
/* Remember that we don't have a THD */
my_pthread_setspecific_ptr(THR_THD, 0);
DBUG_VOID_RETURN;
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 089e751900e..a77dbe2dab4 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -90,7 +90,7 @@ When one supplies long data for a placeholder:
#include "set_var.h"
#include "sql_prepare.h"
#include "sql_parse.h" // insert_precheck, update_precheck, delete_precheck
-#include "sql_base.h" // close_thread_tables
+#include "sql_base.h" // open_normal_and_derived_tables
#include "sql_cache.h" // query_cache_*
#include "sql_view.h" // create_view_precheck
#include "sql_delete.h" // mysql_prepare_delete
@@ -152,6 +152,7 @@ public:
THD *thd;
Select_fetch_protocol_binary result;
Item_param **param_array;
+ Server_side_cursor *cursor;
uint param_count;
uint last_errno;
uint flags;
@@ -352,8 +353,11 @@ static bool send_prep_stmt(Prepared_statement *stmt, uint columns)
&stmt->lex->param_list,
Protocol::SEND_EOF);
}
- /* Flag that a response has already been sent */
- thd->stmt_da->disable_status();
+
+ if (!error)
+ /* Flag that a response has already been sent */
+ thd->stmt_da->disable_status();
+
DBUG_RETURN(error);
}
#else
@@ -2672,7 +2676,6 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length)
if (!cursor->is_open())
{
stmt->close_cursor();
- thd->cursor= 0;
reset_stmt_params(stmt);
}
@@ -2989,12 +2992,6 @@ Execute_sql_statement::execute_server_code(THD *thd)
error= mysql_execute_command(thd);
- if (thd->killed_errno())
- {
- if (! thd->stmt_da->is_set())
- thd->send_kill_message();
- }
-
/* report error issued during command execution */
if (error == 0 && thd->spcont == NULL)
general_log_write(thd, COM_STMT_EXECUTE,
@@ -3016,6 +3013,7 @@ Prepared_statement::Prepared_statement(THD *thd_arg)
thd(thd_arg),
result(thd_arg),
param_array(0),
+ cursor(0),
param_count(0),
last_errno(0),
flags((uint) IS_IN_USE)
@@ -3102,13 +3100,8 @@ void Prepared_statement::cleanup_stmt()
DBUG_ENTER("Prepared_statement::cleanup_stmt");
DBUG_PRINT("enter",("stmt: 0x%lx", (long) this));
- delete lex->sphead;
- lex->sphead= 0;
- /* The order is important */
- lex->unit.cleanup();
cleanup_items(free_list);
thd->cleanup_after_query();
- close_thread_tables(thd);
thd->rollback_item_tree_changes();
DBUG_VOID_RETURN;
@@ -3272,21 +3265,16 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
to PREPARE stmt FROM "CREATE PROCEDURE ..."
*/
DBUG_ASSERT(lex->sphead == NULL || error != 0);
- if (lex->sphead)
- {
- delete lex->sphead;
- lex->sphead= NULL;
- }
+ /* The order is important */
+ lex->unit.cleanup();
+ /* No need to commit statement transaction, it's not started. */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+
+ close_thread_tables(thd);
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
lex_end(lex);
cleanup_stmt();
- /*
- If not inside a multi-statement transaction, the metadata
- locks have already been released and our savepoint points
- to ticket which has been released as well.
- */
- if (thd->in_multi_stmt_transaction_mode())
- thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
thd->restore_backup_statement(this, &stmt_backup);
thd->stmt_arena= old_stmt_arena;
@@ -3393,11 +3381,6 @@ Prepared_statement::set_parameters(String *expanded_query,
and execute of a new statement. If this happens repeatedly
more than MAX_REPREPARE_ATTEMPTS times, we give up.
- In future we need to be able to keep the metadata locks between
- prepare and execute, but right now open_and_lock_tables(), as
- well as close_thread_tables() are buried deep inside
- execution code (mysql_execute_command()).
-
@return TRUE if an error, FALSE if success
@retval TRUE either MAX_REPREPARE_ATTEMPTS has been reached,
or some general error
@@ -3484,11 +3467,6 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
error= server_runnable->execute_server_code(thd);
- delete lex->sphead;
- lex->sphead= 0;
- /* The order is important */
- lex->unit.cleanup();
- close_thread_tables(thd);
thd->cleanup_after_query();
thd->restore_active_arena(this, &stmt_backup);
@@ -3777,8 +3755,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
/* Go! */
if (open_cursor)
- error= mysql_open_cursor(thd, (uint) ALWAYS_MATERIALIZED_CURSOR,
- &result, &cursor);
+ error= mysql_open_cursor(thd, &result, &cursor);
else
{
/*
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index 7067ca084e2..f0f6a1969f5 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -133,6 +133,16 @@
Type of locks to be acquired is specified directly.
*/
#define SELECT_HIGH_PRIORITY (1ULL << 34) // SELECT, user
+/**
+ Is set in slave SQL thread when there was an
+ error on master, which, when is not reproducible
+ on slave (i.e. the query succeeds on slave),
+ is not terminal to the state of repliation,
+ and should be ignored. The slave SQL thread,
+ however, needs to rollback the effects of the
+ succeeded statement to keep replication consistent.
+*/
+#define OPTION_MASTER_SQL_ERROR (1ULL << 35)
/* The rest of the file is included in the server only */
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 130a99a374f..301b22bd70e 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -24,10 +24,9 @@
#include "sql_table.h" // build_table_filename
#include "sql_view.h" // mysql_frm_type, mysql_rename_view
#include "sql_trigger.h"
-#include "lock.h" // wait_if_global_read_lock, lock_table_names,
- // unlock_table_names,
+#include "lock.h" // wait_if_global_read_lock
// start_waiting_global_read_lock
-#include "sql_base.h" // tdc_remove_table
+#include "sql_base.h" // tdc_remove_table, lock_table_names,
#include "sql_handler.h" // mysql_ha_rm_tables
#include "datadict.h"
@@ -144,7 +143,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
}
}
- if (lock_table_names(thd, table_list))
+ if (lock_table_names(thd, table_list, 0, thd->variables.lock_wait_timeout,
+ MYSQL_OPEN_SKIP_TEMPORARY))
goto err;
mysql_mutex_lock(&LOCK_open);
@@ -197,7 +197,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
if (!error)
query_cache_invalidate3(thd, table_list, 0);
- unlock_table_names(thd);
+ thd->mdl_context.release_transactional_locks();
err:
thd->global_read_lock.start_waiting_global_read_lock(thd);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 5f994c09d6d..ab6c6e738b2 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -452,6 +452,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
#ifndef DBUG_OFF
int left_events = max_binlog_dump_events;
#endif
+ int old_max_allowed_packet= thd->variables.max_allowed_packet;
DBUG_ENTER("mysql_binlog_send");
DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos));
@@ -975,6 +976,7 @@ end:
mysql_mutex_lock(&LOCK_thread_count);
thd->current_linfo = 0;
mysql_mutex_unlock(&LOCK_thread_count);
+ thd->variables.max_allowed_packet= old_max_allowed_packet;
DBUG_VOID_RETURN;
err:
@@ -993,6 +995,7 @@ err:
mysql_mutex_unlock(&LOCK_thread_count);
if (file >= 0)
mysql_file_close(file, MYF(MY_WME));
+ thd->variables.max_allowed_packet= old_max_allowed_packet;
my_message(my_errno, errmsg, MYF(0));
DBUG_VOID_RETURN;
@@ -1394,12 +1397,9 @@ bool change_master(THD* thd, Master_info* mi)
/*
Before processing the command, save the previous state.
*/
- char *pos;
- pos= strmake(saved_host, mi->host, HOSTNAME_LENGTH);
- pos= '\0';
+ strmake(saved_host, mi->host, HOSTNAME_LENGTH);
saved_port= mi->port;
- pos= strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
- pos= '\0';
+ strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
saved_log_pos= mi->master_log_pos;
/*
@@ -1690,6 +1690,7 @@ bool mysql_show_binlog_events(THD* thd)
IO_CACHE log;
File file = -1;
MYSQL_BIN_LOG *binary_log= NULL;
+ int old_max_allowed_packet= thd->variables.max_allowed_packet;
DBUG_ENTER("mysql_show_binlog_events");
Log_event::init_show_field_list(&field_list);
@@ -1844,6 +1845,7 @@ err:
mysql_mutex_lock(&LOCK_thread_count);
thd->current_linfo = 0;
mysql_mutex_unlock(&LOCK_thread_count);
+ thd->variables.max_allowed_packet= old_max_allowed_packet;
DBUG_RETURN(ret);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 9c9a436cc24..ccfd93a1bc8 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -33,7 +33,6 @@
#include "sql_select.h"
#include "sql_cache.h" // query_cache_*
#include "sql_table.h" // primary_key_name
-#include "sql_cursor.h"
#include "probes_mysql.h"
#include "key.h" // key_copy, key_cmp, key_cmp_if_same
#include "lock.h" // mysql_unlock_some_tables,
@@ -300,7 +299,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
thd->is_error()));
res|= thd->is_error();
if (unlikely(res))
- result->abort();
+ result->abort_result_set();
MYSQL_SELECT_DONE((int) res, (ulong) thd->limit_found_rows);
DBUG_RETURN(res);
@@ -2340,35 +2339,13 @@ JOIN::exec()
curr_join->fields= curr_fields_list;
curr_join->procedure= procedure;
- if (is_top_level_join() && thd->cursor && tables != const_tables)
- {
- /*
- We are here if this is JOIN::exec for the last select of the main unit
- and the client requested to open a cursor.
- We check that not all tables are constant because this case is not
- handled by do_select() separately, and this case is not implemented
- for cursors yet.
- */
- DBUG_ASSERT(error == 0);
- /*
- curr_join is used only for reusable joins - that is,
- to perform SELECT for each outer row (like in subselects).
- This join is main, so we know for sure that curr_join == join.
- */
- DBUG_ASSERT(curr_join == this);
- /* Open cursor for the last join sweep */
- error= thd->cursor->open(this);
- }
- else
- {
- thd_proc_info(thd, "Sending data");
- DBUG_PRINT("info", ("%s", thd->proc_info));
- result->send_result_set_metadata((procedure ? curr_join->procedure_fields_list :
- *curr_fields_list),
- Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
- error= do_select(curr_join, curr_fields_list, NULL, procedure);
- thd->limit_found_rows= curr_join->send_records;
- }
+ thd_proc_info(thd, "Sending data");
+ DBUG_PRINT("info", ("%s", thd->proc_info));
+ result->send_result_set_metadata((procedure ? curr_join->procedure_fields_list :
+ *curr_fields_list),
+ Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
+ error= do_select(curr_join, curr_fields_list, NULL, procedure);
+ thd->limit_found_rows= curr_join->send_records;
/* Accumulate the counts from all join iterations of all join parts. */
thd->examined_row_count+= curr_join->examined_rows;
@@ -2563,16 +2540,6 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
join->exec();
- if (thd->cursor && thd->cursor->is_open())
- {
- /*
- A cursor was opened for the last sweep in exec().
- We are here only if this is mysql_select for top-level SELECT_LEX_UNIT
- and there were no error.
- */
- free_join= 0;
- }
-
if (thd->lex->describe & DESCRIBE_EXTENDED)
{
select_lex->where= join->conds_history;
@@ -11642,37 +11609,23 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
enum_nested_loop_state rc;
READ_RECORD *info= &join_tab->read_record;
- if (join->resume_nested_loop)
- {
- /* If not the last table, plunge down the nested loop */
- if (join_tab < join->join_tab + join->tables - 1)
- rc= (*join_tab->next_select)(join, join_tab + 1, 0);
- else
- {
- join->resume_nested_loop= FALSE;
- rc= NESTED_LOOP_OK;
- }
- }
- else
- {
- join->return_tab= join_tab;
-
- if (join_tab->last_inner)
- {
- /* join_tab is the first inner table for an outer join operation. */
+ join->return_tab= join_tab;
- /* Set initial state of guard variables for this table.*/
- join_tab->found=0;
- join_tab->not_null_compl= 1;
+ if (join_tab->last_inner)
+ {
+ /* join_tab is the first inner table for an outer join operation. */
- /* Set first_unmatched for the last inner table of this group */
- join_tab->last_inner->first_unmatched= join_tab;
- }
- join->thd->warning_info->reset_current_row_for_warning();
+ /* Set initial state of guard variables for this table.*/
+ join_tab->found=0;
+ join_tab->not_null_compl= 1;
- error= (*join_tab->read_first_record)(join_tab);
- rc= evaluate_join_record(join, join_tab, error);
+ /* Set first_unmatched for the last inner table of this group */
+ join_tab->last_inner->first_unmatched= join_tab;
}
+ join->thd->warning_info->reset_current_row_for_warning();
+
+ error= (*join_tab->read_first_record)(join_tab);
+ rc= evaluate_join_record(join, join_tab, error);
while (rc == NESTED_LOOP_OK)
{
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 0496870bb3f..40f9e6d4054 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -309,11 +309,6 @@ public:
bool sort_and_group;
bool first_record,full_join,group, no_field_update;
bool do_send_rows;
- /**
- TRUE when we want to resume nested loop iterations when
- fetching data from a cursor
- */
- bool resume_nested_loop;
table_map const_table_map,found_const_table_map;
/*
Bitmap of all inner tables from outer joins
@@ -479,7 +474,6 @@ public:
sort_and_group= 0;
first_record= 0;
do_send_rows= 1;
- resume_nested_loop= FALSE;
send_records= 0;
found_records= 0;
fetch_limit= HA_POS_ERROR;
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index c7f9cf0b132..cfbf8e96719 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -36,7 +36,7 @@
#include "sql_priv.h"
#include "sql_servers.h"
#include "unireg.h"
-#include "sql_base.h" // close_thread_tables
+#include "sql_base.h" // close_mysql_tables
#include "records.h" // init_read_record, end_read_record
#include "hash_filo.h"
#include <m_ctype.h>
@@ -280,9 +280,7 @@ bool servers_reload(THD *thd)
}
end:
- trans_commit_implicit(thd);
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ close_mysql_tables(thd);
DBUG_PRINT("info", ("unlocking servers_cache"));
mysql_rwlock_unlock(&THR_LOCK_servers);
DBUG_RETURN(return_val);
@@ -535,6 +533,7 @@ int insert_server_record(TABLE *table, FOREIGN_SERVER *server)
{
int error;
DBUG_ENTER("insert_server_record");
+ tmp_disable_binlog(table->in_use);
table->use_all_columns();
empty_record(table);
@@ -571,6 +570,8 @@ int insert_server_record(TABLE *table, FOREIGN_SERVER *server)
}
else
error= ER_FOREIGN_SERVER_EXISTS;
+
+ reenable_binlog(table->in_use);
DBUG_RETURN(error);
}
@@ -625,7 +626,7 @@ int drop_server(THD *thd, LEX_SERVER_OPTIONS *server_options)
error= delete_server_record(table, name.str, name.length);
/* close the servers table before we call closed_cached_connection_tables */
- close_thread_tables(thd);
+ close_mysql_tables(thd);
if (close_cached_connection_tables(thd, TRUE, &name))
{
@@ -880,6 +881,7 @@ update_server_record(TABLE *table, FOREIGN_SERVER *server)
{
int error=0;
DBUG_ENTER("update_server_record");
+ tmp_disable_binlog(table->in_use);
table->use_all_columns();
/* set the field that's the PK to the value we're looking for */
table->field[0]->store(server->server_name,
@@ -913,6 +915,7 @@ update_server_record(TABLE *table, FOREIGN_SERVER *server)
}
end:
+ reenable_binlog(table->in_use);
DBUG_RETURN(error);
}
@@ -938,6 +941,7 @@ delete_server_record(TABLE *table,
{
int error;
DBUG_ENTER("delete_server_record");
+ tmp_disable_binlog(table->in_use);
table->use_all_columns();
/* set the field that's the PK to the value we're looking for */
@@ -959,6 +963,7 @@ delete_server_record(TABLE *table,
table->file->print_error(error, MYF(0));
}
+ reenable_binlog(table->in_use);
DBUG_RETURN(error);
}
@@ -1050,7 +1055,7 @@ int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options)
error= update_server(thd, existing, altered);
/* close the servers table before we call closed_cached_connection_tables */
- close_thread_tables(thd);
+ close_mysql_tables(thd);
if (close_cached_connection_tables(thd, FALSE, &name))
{
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 78508df2c9e..4d58db2e36c 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -460,8 +460,19 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db,
continue;
file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
- if (wild && wild_compare(uname, wild, 0))
- continue;
+ if (wild)
+ {
+ if (lower_case_table_names)
+ {
+ if (my_wildcmp(files_charset_info,
+ uname, uname + file_name_len,
+ wild, wild + wild_length,
+ wild_prefix, wild_one,wild_many))
+ continue;
+ }
+ else if (wild_compare(uname, wild, 0))
+ continue;
+ }
if (!(file_name=
thd->make_lex_string(file_name, uname, file_name_len, TRUE)))
{
@@ -649,22 +660,30 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
Protocol *protocol= thd->protocol;
char buff[2048];
String buffer(buff, sizeof(buff), system_charset_info);
+ List<Item> field_list;
+ bool error= TRUE;
DBUG_ENTER("mysqld_show_create");
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
table_list->table_name));
+ /*
+ Metadata locks taken during SHOW CREATE should be released when
+ the statmement completes as it is an information statement.
+ */
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
+
/* We want to preserve the tree for views. */
thd->lex->view_prepare_mode= TRUE;
{
Show_create_error_handler view_error_suppressor(thd, table_list);
thd->push_internal_handler(&view_error_suppressor);
- bool error=
+ bool open_error=
open_normal_and_derived_tables(thd, table_list,
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL);
thd->pop_internal_handler();
- if (error && (thd->killed || thd->is_error()))
- DBUG_RETURN(TRUE);
+ if (open_error && (thd->killed || thd->is_error()))
+ goto exit;
}
/* TODO: add environment variables show when it become possible */
@@ -672,7 +691,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
{
my_error(ER_WRONG_OBJECT, MYF(0),
table_list->db, table_list->table_name, "VIEW");
- DBUG_RETURN(TRUE);
+ goto exit;
}
buffer.length(0);
@@ -684,9 +703,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
view_store_create_info(thd, table_list, &buffer) :
store_create_info(thd, table_list, &buffer, NULL,
FALSE /* show_database */)))
- DBUG_RETURN(TRUE);
+ goto exit;
- List<Item> field_list;
if (table_list->view)
{
field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN));
@@ -707,7 +725,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
- DBUG_RETURN(TRUE);
+ goto exit;
+
protocol->prepare_for_resend();
if (table_list->view)
protocol->store(table_list->view_name.str, system_charset_info);
@@ -735,10 +754,16 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
if (protocol->write())
- DBUG_RETURN(TRUE);
+ goto exit;
+ error= FALSE;
my_eof(thd);
- DBUG_RETURN(FALSE);
+
+exit:
+ close_thread_tables(thd);
+ /* Release any metadata locks taken during SHOW CREATE. */
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+ DBUG_RETURN(error);
}
bool mysqld_show_create_db(THD *thd, char *dbname,
@@ -2922,7 +2947,7 @@ make_table_name_list(THD *thd, List<LEX_STRING> *table_names, LEX *lex,
*/
if (res == FIND_FILES_DIR)
{
- if (lex->sql_command != SQLCOM_SELECT)
+ if (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND)
return 1;
thd->clear_error();
return 2;
@@ -4112,7 +4137,6 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
uchar *pos;
char tmp[MAX_FIELD_WIDTH];
String type(tmp,sizeof(tmp), system_charset_info);
- char *end;
DEBUG_SYNC(thd, "get_schema_column");
@@ -4133,7 +4157,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
field->field_name) & COL_ACLS;
if (!tables->schema_table && !col_access)
continue;
- end= tmp;
+ char *end= tmp;
for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
{
if (col_access & 1)
@@ -4169,7 +4193,6 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
table->field[15]->store((const char*) pos,
strlen((const char*) pos), cs);
- end= tmp;
if (field->unireg_check == Field::NEXT_NUMBER)
table->field[16]->store(STRING_WITH_LEN("auto_increment"), cs);
if (timestamp_field == field &&
@@ -7719,6 +7742,10 @@ TABLE_LIST *get_trigger_table(THD *thd, const sp_name *trg_name)
bool show_create_trigger(THD *thd, const sp_name *trg_name)
{
TABLE_LIST *lst= get_trigger_table(thd, trg_name);
+ uint num_tables; /* NOTE: unused, only to pass to open_tables(). */
+ Table_triggers_list *triggers;
+ int trigger_idx;
+ bool error= TRUE;
if (!lst)
return TRUE;
@@ -7730,35 +7757,35 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name)
}
/*
- Open the table by name in order to load Table_triggers_list object.
-
- NOTE: there is race condition here -- the table can be dropped after
- LOCK_open is released. It will be fixed later by acquiring shared
- metadata lock on trigger or table name.
+ Metadata locks taken during SHOW CREATE TRIGGER should be released when
+ the statement completes as it is an information statement.
*/
+ MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
- uint num_tables; /* NOTE: unused, only to pass to open_tables(). */
-
- if (open_tables(thd, &lst, &num_tables, 0))
+ /*
+ Open the table by name in order to load Table_triggers_list object.
+ */
+ if (open_tables(thd, &lst, &num_tables,
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL))
{
my_error(ER_TRG_CANT_OPEN_TABLE, MYF(0),
(const char *) trg_name->m_db.str,
(const char *) lst->table_name);
- return TRUE;
+ goto exit;
/* Perform closing actions and return error status. */
}
- Table_triggers_list *triggers= lst->table->triggers;
+ triggers= lst->table->triggers;
if (!triggers)
{
my_error(ER_TRG_DOES_NOT_EXIST, MYF(0));
- return TRUE;
+ goto exit;
}
- int trigger_idx= triggers->find_trigger_by_name(&trg_name->m_name);
+ trigger_idx= triggers->find_trigger_by_name(&trg_name->m_name);
if (trigger_idx < 0)
{
@@ -7766,16 +7793,22 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name)
(const char *) trg_name->m_db.str,
(const char *) lst->table_name);
- return TRUE;
+ goto exit;
}
- return show_create_trigger_impl(thd, triggers, trigger_idx);
+ error= show_create_trigger_impl(thd, triggers, trigger_idx);
/*
NOTE: if show_create_trigger_impl() failed, that means we could not
send data to the client. In this case we simply raise the error
status and client connection will be closed.
*/
+
+exit:
+ close_thread_tables(thd);
+ /* Release any metadata locks taken during SHOW CREATE TRIGGER. */
+ thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+ return error;
}
class IS_internal_schema_access : public ACL_internal_schema_access
diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc
index f340da373e8..09e9a828fa1 100644
--- a/sql/sql_signal.cc
+++ b/sql/sql_signal.cc
@@ -499,18 +499,6 @@ bool Resignal_statement::execute(THD *thd)
}
/* RESIGNAL with signal_value */
-
- /* Make room for 2 conditions */
- thd->warning_info->reserve_space(thd, 2);
-
- MYSQL_ERROR *raised= NULL;
- raised= thd->raise_condition_no_handler(signaled->get_sql_errno(),
- signaled->get_sqlstate(),
- signaled->get_level(),
- signaled->get_message_text());
- if (raised)
- raised->copy_opt_attributes(signaled);
-
result= raise_condition(thd, signaled);
DBUG_RETURN(result);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index d28b4859ab5..1db7aa55792 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -22,17 +22,17 @@
#include "sql_rename.h" // do_rename
#include "sql_parse.h" // test_if_data_home_dir
#include "sql_cache.h" // query_cache_*
-#include "sql_base.h" // open_temporary_table
-#include "lock.h" // wait_if_global_read_lock, lock_table_names,
+#include "sql_base.h" // open_temporary_table, lock_table_names
+#include "lock.h" // wait_if_global_read_lock
// start_waiting_global_read_lock,
- // unlock_table_names, mysql_unlock_tables
+ // mysql_unlock_tables
#include "strfunc.h" // find_type2, find_set
#include "sql_view.h" // view_checksum
#include "sql_truncate.h" // regenerate_locked_table
#include "sql_partition.h" // mem_alloc_error,
// generate_partition_syntax,
// partition_info
-#include "sql_db.h" // load_db_opt_by_name, lock_db_cache, creating_database
+#include "sql_db.h" // load_db_opt_by_name
#include "sql_time.h" // make_truncated_value_warning
#include "records.h" // init_read_record, end_read_record
#include "filesort.h" // filesort_free_buffers
@@ -51,15 +51,12 @@
#include "sql_parse.h"
#include "sql_show.h"
#include "transaction.h"
-#include "keycaches.h"
#include "datadict.h" // dd_frm_type()
#ifdef __WIN__
#include <io.h>
#endif
-int creating_table= 0; // How many mysql_create_table are running
-
const char *primary_key_name="PRIMARY";
static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end);
@@ -80,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);
/**
@@ -1088,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;
@@ -1954,7 +1948,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
{
if (!thd->locked_tables_mode)
{
- if (lock_table_names(thd, tables))
+ 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)
@@ -1964,7 +1959,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
else
{
for (table= tables; table; table= table->next_local)
- if (find_temporary_table(thd, table->db, table->table_name))
+ if (table->open_type != OT_BASE_ONLY &&
+ find_temporary_table(thd, table->db, table->table_name))
{
/*
A temporary table.
@@ -2009,8 +2005,11 @@ 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));
- error= drop_temporary_table(thd, table);
-
+ if (table->open_type == OT_BASE_ONLY)
+ error= 1;
+ else
+ error= drop_temporary_table(thd, table);
+
switch (error) {
case 0:
// removed temporary table
@@ -2282,18 +2281,13 @@ err:
{
/*
Under LOCK TABLES we should release meta-data locks on the tables
- which were dropped. Otherwise we can rely on close_thread_tables()
- doing this. Unfortunately in this case we are likely to get more
- false positives in try_acquire_lock() function. So
- it makes sense to remove exclusive meta-data locks in all cases.
+ which were dropped.
Leave LOCK TABLES mode if we managed to drop all tables which were
locked. Additional check for 'non_temp_tables_count' is to avoid
leaving LOCK TABLES mode if we have dropped only temporary tables.
*/
- if (! thd->locked_tables_mode)
- unlock_table_names(thd);
- else
+ if (thd->locked_tables_mode)
{
if (thd->lock && thd->lock->table_count == 0 && non_temp_tables_count > 0)
{
@@ -2302,7 +2296,8 @@ err:
}
for (table= tables; table; table= table->next_local)
{
- if (table->mdl_request.ticket)
+ /* Drop locks for all successfully dropped tables. */
+ if (table->table == NULL && table->mdl_request.ticket)
{
/*
Under LOCK TABLES we may have several instances of table open
@@ -2313,6 +2308,10 @@ err:
}
}
}
+ /*
+ Rely on the caller to implicitly commit the transaction
+ and release metadata locks.
+ */
}
end:
@@ -4211,8 +4210,14 @@ warn:
}
-/*
- Database and name-locking aware wrapper for mysql_create_table_no_lock(),
+/**
+ Implementation of SQLCOM_CREATE_TABLE.
+
+ Take the metadata locks (including a shared lock on the affected
+ schema) and create the table. Is written to be called from
+ mysql_execute_command(), to which it delegates the common parts
+ with other commands (i.e. implicit commit before and after,
+ close of thread tables.
*/
bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
@@ -4222,31 +4227,13 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
bool result;
DBUG_ENTER("mysql_create_table");
- /* Wait for any database locks */
- mysql_mutex_lock(&LOCK_lock_db);
- while (!thd->killed &&
- my_hash_search(&lock_db_cache, (uchar*)create_table->db,
- create_table->db_length))
- {
- wait_for_condition(thd, &LOCK_lock_db, &COND_refresh);
- mysql_mutex_lock(&LOCK_lock_db);
- }
-
- if (thd->killed)
- {
- mysql_mutex_unlock(&LOCK_lock_db);
- DBUG_RETURN(TRUE);
- }
- creating_table++;
- mysql_mutex_unlock(&LOCK_lock_db);
-
/*
Open or obtain an exclusive metadata lock on table being created.
*/
if (open_and_lock_tables(thd, thd->lex->query_tables, FALSE, 0))
{
result= TRUE;
- goto unlock;
+ goto end;
}
/* Got lock. */
@@ -4268,20 +4255,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
result= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
- if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
- {
- /*
- close_thread_tables() takes care about both closing open tables (which
- might be still around in case of error) and releasing metadata locks.
- */
- close_thread_tables(thd);
- }
-
-unlock:
- mysql_mutex_lock(&LOCK_lock_db);
- if (!--creating_table && creating_database)
- mysql_cond_signal(&COND_refresh);
- mysql_mutex_unlock(&LOCK_lock_db);
+end:
DBUG_RETURN(result);
}
@@ -4415,889 +4389,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;
- MDL_request mdl_global_request;
- MDL_request_list mdl_requests;
- /*
- 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);
-
- mdl_global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
- mdl_requests.push_front(&table_list->mdl_request);
- mdl_requests.push_front(&mdl_global_request);
-
- if (thd->mdl_context.acquire_locks(&mdl_requests,
- thd->variables.lock_wait_timeout))
- 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);
- 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);
- table->table= NULL;
- thd->mdl_context.release_transactional_locks();
- if (!result_code) // recreation went ok
- {
- /* Clear the ticket released in close_thread_tables(). */
- 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.
- */
- query_cache_invalidate3(thd, table->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();
- table->table=0; // For query cache
-
- /*
- 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
@@ -5461,29 +4552,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,
@@ -5594,7 +4662,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.
@@ -5634,17 +4702,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;
@@ -5660,7 +4727,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.
@@ -5671,7 +4738,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
@@ -6051,7 +5118,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)
@@ -6460,7 +5527,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.
@@ -6499,7 +5566,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
uint index_add_count= 0;
uint *index_add_buffer= NULL;
uint candidate_key_count= 0;
- bool committed= 0;
bool no_pk;
DBUG_ENTER("mysql_alter_table");
@@ -6576,6 +5642,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
Alter_table_prelocking_strategy alter_prelocking_strategy(alter_info);
+ DEBUG_SYNC(thd, "alter_table_before_open_tables");
error= open_and_lock_tables(thd, table_list, FALSE, 0,
&alter_prelocking_strategy);
@@ -6752,13 +5819,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
goto err;
DBUG_EXECUTE_IF("sleep_alter_enable_indexes", my_sleep(6000000););
error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
- /* COND_refresh will be signaled in close_thread_tables() */
break;
case DISABLE:
if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
goto err;
error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
- /* COND_refresh will be signaled in close_thread_tables() */
break;
default:
DBUG_ASSERT(FALSE);
@@ -6844,8 +5909,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
/*
Under LOCK TABLES we should adjust meta-data locks before finishing
- statement. Otherwise we can rely on close_thread_tables() releasing
- them.
+ statement. Otherwise we can rely on them being released
+ along with the implicit commit.
*/
if (new_name != table_name || new_db != db)
{
@@ -6900,13 +5965,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", {
@@ -7329,7 +6394,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_PRINT("info", ("Committing before unlocking table"));
if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
goto err_new_table_cleanup;
- committed= 1;
}
/*end of if (! new_table) for add/drop index*/
@@ -7393,8 +6457,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
5) Write statement to the binary log.
6) If we are under LOCK TABLES and do ALTER TABLE ... RENAME we
remove placeholders and release metadata locks.
- 7) If we are not not under LOCK TABLES we rely on close_thread_tables()
- call to remove placeholders and releasing metadata locks.
+ 7) If we are not not under LOCK TABLES we rely on the caller
+ (mysql_execute_command()) to release metadata locks.
*/
thd_proc_info(thd, "rename result table");
@@ -7421,7 +6485,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
@@ -8023,7 +7087,13 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
}
}
thd->clear_error();
+ if (! thd->in_sub_stmt)
+ trans_rollback_stmt(thd);
close_thread_tables(thd);
+ /*
+ Don't release metadata locks, this will be done at
+ statement end.
+ */
table->table=0; // For query cache
}
if (protocol->write())
@@ -8033,10 +7103,7 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
my_eof(thd);
DBUG_RETURN(FALSE);
- err:
- close_thread_tables(thd); // Shouldn't be needed
- if (table)
- table->table=0;
+err:
DBUG_RETURN(TRUE);
}
@@ -8073,3 +7140,4 @@ static bool check_engine(THD *thd, const char *table_name,
}
return FALSE;
}
+
diff --git a/sql/sql_table.h b/sql/sql_table.h
index 40b24605bd6..2e1cc89d585 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
{
@@ -139,12 +139,23 @@ bool mysql_create_table_no_lock(THD *thd, const char *db,
HA_CREATE_INFO *create_info,
Alter_info *alter_info,
bool tmp_table, uint select_field_count);
-
+bool mysql_prepare_alter_table(THD *thd, TABLE *table,
+ HA_CREATE_INFO *create_info,
+ Alter_info *alter_info);
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 +169,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,
@@ -210,7 +208,6 @@ uint explain_filename(THD* thd, const char *from, char *to, uint to_length,
extern MYSQL_PLUGIN_IMPORT const char *primary_key_name;
-extern int creating_table; // How many mysql_create_table() are running
extern mysql_mutex_t LOCK_gdl;
#endif /* SQL_TABLE_INCLUDED */
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 2f084c369b6..a5664b00287 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -540,9 +540,9 @@ end:
}
/*
- If we are under LOCK TABLES we should restore original state of meta-data
- locks. Otherwise call to close_thread_tables() will take care about both
- TABLE instance created by open_n_lock_single_table() and metadata lock.
+ If we are under LOCK TABLES we should restore original state of
+ meta-data locks. Otherwise all locks will be released along
+ with the implicit commit.
*/
if (thd->locked_tables_mode && tables && lock_upgrade_done)
mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_NO_READ_WRITE);
@@ -1321,6 +1321,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
thd->reset_db((char*) db, strlen(db));
while ((trg_create_str= it++))
{
+ sp_head *sp;
trg_sql_mode= itm++;
LEX_STRING *trg_definer= it_definer++;
@@ -1357,13 +1358,14 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
*/
lex.set_trg_event_type_for_tables();
- lex.sphead->set_info(0, 0, &lex.sp_chistics, (ulong) *trg_sql_mode);
-
int event= lex.trg_chistics.event;
int action_time= lex.trg_chistics.action_time;
- lex.sphead->set_creation_ctx(creation_ctx);
- triggers->bodies[event][action_time]= lex.sphead;
+ sp= triggers->bodies[event][action_time]= lex.sphead;
+ lex.sphead= NULL; /* Prevent double cleanup. */
+
+ sp->set_info(0, 0, &lex.sp_chistics, (ulong) *trg_sql_mode);
+ sp->set_creation_ctx(creation_ctx);
if (!trg_definer->length)
{
@@ -1376,27 +1378,26 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER),
(const char*) db,
- (const char*) lex.sphead->m_name.str);
+ (const char*) sp->m_name.str);
/*
Set definer to the '' to correct displaying in the information
schema.
*/
- lex.sphead->set_definer((char*) "", 0);
+ sp->set_definer((char*) "", 0);
/*
Triggers without definer information are executed under the
authorization of the invoker.
*/
- lex.sphead->m_chistics->suid= SP_IS_NOT_SUID;
+ sp->m_chistics->suid= SP_IS_NOT_SUID;
}
else
- lex.sphead->set_definer(trg_definer->str, trg_definer->length);
+ sp->set_definer(trg_definer->str, trg_definer->length);
- if (triggers->names_list.push_back(&lex.sphead->m_name,
- &table->mem_root))
+ if (triggers->names_list.push_back(&sp->m_name, &table->mem_root))
goto err_with_lex_cleanup;
if (!(on_table_name= alloc_lex_string(&table->mem_root)))
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index c2482ef1ce0..62e51d9dfe6 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,9 +244,11 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
MDL_ticket **ticket_downgrade)
{
TABLE *table= NULL;
- MDL_ticket *mdl_ticket= NULL;
+ handlerton *table_type;
DBUG_ENTER("open_and_lock_table_for_truncate");
+ DBUG_ASSERT(table_ref->lock_type == TL_WRITE);
+ DBUG_ASSERT(table_ref->mdl_request.type == MDL_SHARED_NO_READ_WRITE);
/*
Before doing anything else, acquire a metadata lock on the table,
or ensure we have one. We don't use open_and_lock_tables()
@@ -264,8 +268,10 @@ 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;
}
else
{
@@ -273,26 +279,31 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
Even though we could use the previous execution branch here just as
well, we must not try to open the table:
*/
- MDL_request mdl_global_request, mdl_request;
- MDL_request_list mdl_requests;
-
- mdl_global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
- mdl_request.init(MDL_key::TABLE, table_ref->db, table_ref->table_name,
- MDL_SHARED_NO_READ_WRITE);
- mdl_requests.push_front(&mdl_request);
- mdl_requests.push_front(&mdl_global_request);
-
- if (thd->mdl_context.acquire_locks(&mdl_requests,
- thd->variables.lock_wait_timeout))
+ DBUG_ASSERT(table_ref->next_global == NULL);
+ if (lock_table_names(thd, table_ref, NULL,
+ thd->variables.lock_wait_timeout,
+ MYSQL_OPEN_SKIP_TEMPORARY))
DBUG_RETURN(TRUE);
- mdl_ticket= mdl_request.ticket;
-
- 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)
@@ -313,7 +324,9 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
else
{
ulong timeout= thd->variables.lock_wait_timeout;
- if (thd->mdl_context.upgrade_shared_lock_to_exclusive(mdl_ticket, timeout))
+ if (thd->mdl_context.
+ 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,
@@ -335,15 +348,14 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
table_ref->required_type= FRMTYPE_TABLE;
/* We don't need to load triggers. */
DBUG_ASSERT(table_ref->trg_event_map == 0);
- /* Work around partition parser rules using alter table's. */
- if (thd->lex->alter_info.flags & ALTER_ADMIN_PARTITION)
- {
- table_ref->lock_type= TL_WRITE;
- table_ref->mdl_request.set_type(MDL_SHARED_WRITE);
- }
- /* Ensure proper lock types (e.g. from the parser). */
- DBUG_ASSERT(table_ref->lock_type == TL_WRITE);
- DBUG_ASSERT(table_ref->mdl_request.type == MDL_SHARED_WRITE);
+ /*
+ Even though we have an MDL lock on the table here, we don't
+ pass MYSQL_OPEN_HAS_MDL_LOCK to open_and_lock_tables
+ since to truncate a MERGE table, we must open and lock
+ merge children, and on those we don't have an MDL lock.
+ Thus clear the ticket to satisfy MDL asserts.
+ */
+ table_ref->mdl_request.ticket= NULL;
/*
Open the table as it will handle some required preparations.
@@ -483,3 +495,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_udf.cc b/sql/sql_udf.cc
index 3d197303fb1..ba1d0ceadeb 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -33,7 +33,7 @@
#include "sql_priv.h"
#include "unireg.h"
-#include "sql_base.h" // close_thread_tables
+#include "sql_base.h" // close_mysql_tables
#include "sql_parse.h" // check_identifier_name
#include "sql_table.h" // write_bin_log
#include "records.h" // init_read_record, end_read_record
@@ -251,7 +251,7 @@ void udf_init()
table->m_needs_reopen= TRUE; // Force close to free memory
end:
- close_thread_tables(new_thd);
+ close_mysql_tables(new_thd);
delete new_thd;
/* Remember that we don't have a THD */
my_pthread_setspecific_ptr(THR_THD, 0);
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 9ca4556524f..acc0f704c44 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -36,8 +36,7 @@ bool mysql_union(THD *thd, LEX *lex, select_result *result,
if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK |
setup_tables_done_option)))
res= unit->exec();
- if (res || !thd->cursor || !thd->cursor->is_open())
- res|= unit->cleanup();
+ res|= unit->cleanup();
DBUG_RETURN(res);
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index c52467531a9..35478e28520 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1261,7 +1261,7 @@ bool mysql_multi_update(THD *thd,
{
/* If we had a another error reported earlier then this will be ignored */
(*result)->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR));
- (*result)->abort();
+ (*result)->abort_result_set();
}
thd->abort_on_warning= 0;
DBUG_RETURN(res);
@@ -1861,7 +1861,7 @@ void multi_update::send_error(uint errcode,const char *err)
}
-void multi_update::abort()
+void multi_update::abort_result_set()
{
/* the error was handled or nothing deleted and no side effects return */
if (error_handled ||
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 69abe70e863..be13349b5a1 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -19,10 +19,10 @@
#include "sql_priv.h"
#include "unireg.h"
#include "sql_view.h"
-#include "sql_base.h" // find_table_in_global_list
+#include "sql_base.h" // find_table_in_global_list, lock_table_names
#include "sql_parse.h" // sql_parse
#include "sql_cache.h" // query_cache_*
-#include "lock.h" // wait_if_global_read_lock, lock_table_names
+#include "lock.h" // wait_if_global_read_lock
#include "sql_show.h" // append_identifier
#include "sql_table.h" // build_table_filename
#include "sql_db.h" // mysql_opt_change_db, mysql_change_db
@@ -1652,7 +1652,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
DBUG_RETURN(TRUE);
}
- if (lock_table_names(thd, views))
+ if (lock_table_names(thd, views, 0, thd->variables.lock_wait_timeout,
+ MYSQL_OPEN_SKIP_TEMPORARY))
DBUG_RETURN(TRUE);
mysql_mutex_lock(&LOCK_open);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 3ba67368565..443b80799aa 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>
@@ -6172,9 +6176,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;
@@ -6393,38 +6408,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
@@ -6436,10 +6467,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();
+ 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
;
@@ -6876,7 +6911,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:
@@ -6907,7 +6949,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:
@@ -6935,7 +6984,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:
@@ -6969,7 +7025,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:
@@ -10693,10 +10756,17 @@ truncate:
lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE_UNSPECIFIED;
lex->select_lex.init_order();
YYPS->m_lock_type= TL_WRITE;
- YYPS->m_mdl_type= MDL_SHARED_WRITE;
+ 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:
@@ -11184,10 +11254,10 @@ flush_options:
Lex->type|= REFRESH_TABLES;
/*
Set type of metadata and table locks for
- FLUSH TABLES table_list WITH READ LOCK.
+ FLUSH TABLES table_list [WITH READ LOCK].
*/
YYPS->m_lock_type= TL_READ_NO_INSERT;
- YYPS->m_mdl_type= MDL_EXCLUSIVE;
+ YYPS->m_mdl_type= MDL_SHARED_HIGH_PRIO;
}
opt_table_list {}
opt_with_read_lock {}
@@ -11197,7 +11267,13 @@ flush_options:
opt_with_read_lock:
/* empty */ {}
| WITH READ_SYM LOCK_SYM
- { Lex->type|= REFRESH_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);
+ }
;
flush_options_list:
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 6e838759e83..320e6d9253e 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2207,14 +2207,21 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
thd->variables.option_bits & OPTION_NOT_AUTOCOMMIT)
{ // activating autocommit
- if (trans_commit(thd))
+ if (trans_commit_stmt(thd) || trans_commit(thd))
{
thd->variables.option_bits&= ~OPTION_AUTOCOMMIT;
return true;
}
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
-
+ /*
+ Don't close thread tables or release metadata locks: if we do so, we
+ risk releasing locks/closing tables of expressions used to assign
+ other variables, as in:
+ set @var=my_stored_function1(), @@autocommit=1, @var2=(select max(a)
+ from my_table), ...
+ The locks will be released at statement end anyway, as SET
+ statement that assigns autocommit is marked to commit
+ transaction implicitly at the end (@sa stmt_causes_implicitcommit()).
+ */
thd->variables.option_bits&=
~(OPTION_BEGIN | OPTION_KEEP_LOG | OPTION_NOT_AUTOCOMMIT);
thd->transaction.all.modified_non_trans_table= false;
diff --git a/sql/table.cc b/sql/table.cc
index c89ce90e719..bcdfd23b4c1 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -541,7 +541,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
int error, table_type;
bool error_given;
File file;
- uchar head[64], *disk_buff;
+ uchar head[64];
char path[FN_REFLEN];
MEM_ROOT **root_ptr, *old_root;
DBUG_ENTER("open_table_def");
@@ -550,7 +550,6 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
error= 1;
error_given= 0;
- disk_buff= NULL;
strxmov(path, share->normalized_path.str, reg_ext, NullS);
if ((file= mysql_file_open(key_file_frm,
diff --git a/sql/table.h b/sql/table.h
index 2bf390aee4d..52ac92299a6 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;
/*
@@ -629,7 +628,7 @@ struct TABLE_SHARE
#ifdef WITH_PARTITION_STORAGE_ENGINE
/* filled in when reading from frm */
bool auto_partitioned;
- const char *partition_info_str;
+ char *partition_info_str;
uint partition_info_str_len;
uint partition_info_buffer_size;
handlerton *default_part_db_type;
diff --git a/sql/transaction.cc b/sql/transaction.cc
index f6786f20dcf..a28fba8805d 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -28,6 +28,12 @@ static bool trans_check(THD *thd)
enum xa_states xa_state= thd->transaction.xid_state.xa_state;
DBUG_ENTER("trans_check");
+ /*
+ Always commit statement transaction before manipulating with
+ the normal one.
+ */
+ DBUG_ASSERT(thd->transaction.stmt.is_empty());
+
if (unlikely(thd->in_sub_stmt))
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
if (xa_state != XA_NOTR)
@@ -252,6 +258,14 @@ bool trans_commit_stmt(THD *thd)
{
DBUG_ENTER("trans_commit_stmt");
int res= FALSE;
+ /*
+ We currently don't invoke commit/rollback at end of
+ a sub-statement. In future, we perhaps should take
+ a savepoint for each nested statement, and release the
+ savepoint when statement has succeeded.
+ */
+ DBUG_ASSERT(! thd->in_sub_stmt);
+
if (thd->transaction.stmt.ha_list)
{
res= ha_commit_trans(thd, FALSE);
@@ -267,6 +281,9 @@ bool trans_commit_stmt(THD *thd)
RUN_HOOK(transaction, after_rollback, (thd, FALSE));
else
RUN_HOOK(transaction, after_commit, (thd, FALSE));
+
+ thd->transaction.stmt.reset();
+
DBUG_RETURN(test(res));
}
@@ -283,6 +300,14 @@ bool trans_rollback_stmt(THD *thd)
{
DBUG_ENTER("trans_rollback_stmt");
+ /*
+ We currently don't invoke commit/rollback at end of
+ a sub-statement. In future, we perhaps should take
+ a savepoint for each nested statement, and release the
+ savepoint when statement has succeeded.
+ */
+ DBUG_ASSERT(! thd->in_sub_stmt);
+
if (thd->transaction.stmt.ha_list)
{
ha_rollback_trans(thd, FALSE);
@@ -294,6 +319,8 @@ bool trans_rollback_stmt(THD *thd)
RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+ thd->transaction.stmt.reset();
+
DBUG_RETURN(FALSE);
}
diff --git a/sql/tztime.cc b/sql/tztime.cc
index af8574c38f1..43d43123158 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -50,13 +50,6 @@
// MYSQL_LOCK_IGNORE_TIMEOUT
/*
- This forward declaration is needed because including sql_base.h
- causes further includes. [TODO] Eliminate this forward declaration
- and include a file with the prototype instead.
-*/
-extern void close_thread_tables(THD *thd);
-
-/*
Now we don't use abbreviations in server but we will do this in future.
*/
#if defined(TZINFO2SQL) || defined(TESTTIME)
@@ -1784,10 +1777,7 @@ end_with_setting_default_tz:
end_with_close:
if (time_zone_tables_exist)
- {
- close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
- }
+ close_mysql_tables(thd);
end_with_cleanup:
diff --git a/sql/udf_example.c b/sql/udf_example.c
index 5f8e71d25fa..36828bdf94d 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -1071,7 +1071,7 @@ char *myfunc_argument_name(UDF_INIT *initid __attribute__((unused)),
{
if (!args->attributes[0])
{
- null_value= 0;
+ *null_value= 1;
return 0;
}
(*length)--; /* space for ending \0 (for debugging purposes) */
diff --git a/storage/archive/CMakeLists.txt b/storage/archive/CMakeLists.txt
index d47fd254b0e..78fb95c0d26 100644
--- a/storage/archive/CMakeLists.txt
+++ b/storage/archive/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(ARCHIVE_SOURCES azio.c ha_archive.cc ha_archive.h)
MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE LINK_LIBRARIES ${ZLIB_LIBRARY})
diff --git a/storage/blackhole/CMakeLists.txt b/storage/blackhole/CMakeLists.txt
index 5a4bb3fe607..bc14fdde0c1 100644
--- a/storage/blackhole/CMakeLists.txt
+++ b/storage/blackhole/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(BLACKHOLE_SOURCES ha_blackhole.cc ha_blackhole.h)
MYSQL_ADD_PLUGIN(blackhole ${BLACKHOLE_SOURCES} STORAGE_ENGINE)
diff --git a/storage/csv/CMakeLists.txt b/storage/csv/CMakeLists.txt
index 73d1794a369..910942325b9 100644
--- a/storage/csv/CMakeLists.txt
+++ b/storage/csv/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(CSV_PLUGIN_STATIC "csv")
SET(CSV_PLUGIN_MANDATORY TRUE)
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 216097f0fdc..e8012a86ae6 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -519,7 +519,7 @@ int ha_tina::encode_quote(uchar *buf)
const char *ptr;
const char *end_ptr;
const bool was_null= (*field)->is_null();
-
+
/*
assistance for backwards compatibility in production builds.
note: this will not work for ENUM columns.
@@ -531,7 +531,7 @@ int ha_tina::encode_quote(uchar *buf)
}
(*field)->val_str(&attribute,&attribute);
-
+
if (was_null)
(*field)->set_null();
@@ -542,34 +542,30 @@ int ha_tina::encode_quote(uchar *buf)
buffer.append('"');
- while (ptr < end_ptr)
+ for (; ptr < end_ptr; ptr++)
{
if (*ptr == '"')
{
buffer.append('\\');
buffer.append('"');
- *ptr++;
}
else if (*ptr == '\r')
{
buffer.append('\\');
buffer.append('r');
- *ptr++;
}
else if (*ptr == '\\')
{
buffer.append('\\');
buffer.append('\\');
- *ptr++;
}
else if (*ptr == '\n')
{
buffer.append('\\');
buffer.append('n');
- *ptr++;
}
else
- buffer.append(*ptr++);
+ buffer.append(*ptr);
}
buffer.append('"');
}
diff --git a/storage/example/CMakeLists.txt b/storage/example/CMakeLists.txt
index 5a6f5d78c6b..3d94d09f075 100644
--- a/storage/example/CMakeLists.txt
+++ b/storage/example/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(EXAMPLE_PLUGIN_DYNAMIC "ha_example")
SET(EXAMPLE_SOURCES ha_example.cc)
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 899f55a33f7..306f8eaeccd 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -180,7 +180,7 @@ static int example_done_func(void *p)
my_hash_free(&example_open_tables);
mysql_mutex_destroy(&example_mutex);
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
diff --git a/storage/federated/CMakeLists.txt b/storage/federated/CMakeLists.txt
index ac55543f276..74f29b1f8bd 100644
--- a/storage/federated/CMakeLists.txt
+++ b/storage/federated/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(FEDERATED_PLUGIN_STATIC "federated")
SET(FEDERATED_PLUGIN_DYNAMIC "ha_federated")
diff --git a/storage/heap/CMakeLists.txt b/storage/heap/CMakeLists.txt
index 2c0b65b0cc4..8f3c1be809f 100644
--- a/storage/heap/CMakeLists.txt
+++ b/storage/heap/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(HEAP_PLUGIN_STATIC "heap")
SET(HEAP_PLUGIN_MANDATORY TRUE)
diff --git a/storage/ibmdb2i/CMakeLists.txt b/storage/ibmdb2i/CMakeLists.txt
index e8db6989583..54da2b00ef2 100644
--- a/storage/ibmdb2i/CMakeLists.txt
+++ b/storage/ibmdb2i/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CHECK_INCLUDE_FILES(qlgusr.h HAVE_PASE_ENVIRONMENT)
IF(HAVE_PASE_ENVIRONMENT)
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 218dbad2df0..e993aa0d96a 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -1,5 +1,5 @@
-# Copyright (C) 2009 Oracle/Innobase Oy
-#
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This is the CMakeLists for InnoDB Plugin
@@ -43,7 +43,7 @@ ENDIF()
# Enable InnoDB's UNIV_DEBUG if MySQL's WITH_DEBUG[_FULL] is defined
# enable when this bug is resolved:
# Bug#54861 Additional connections not handled properly in mtr --embedded
-#IF(WITH_DEBUG OR WITH_DEBUG_FULL)
+#IF(WITH_DEBUG)
# ADD_DEFINITIONS("-DUNIV_DEBUG")
#ENDIF()
diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt
index b057a62a6dd..487fbded2df 100644
--- a/storage/myisam/CMakeLists.txt
+++ b/storage/myisam/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c
ha_myisam.cc
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 065f18965d1..6134b4f46df 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -29,7 +29,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
int error;
uint count;
MYISAM_SHARE *share=info->s;
- uint flag;
DBUG_ENTER("mi_lock_database");
DBUG_PRINT("enter",("lock_type: %d old lock %d r_locks: %u w_locks: %u "
"global_changed: %d open_count: %u name: '%s'",
@@ -49,7 +48,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
DBUG_RETURN(0);
}
- flag=error=0;
+ error= 0;
mysql_mutex_lock(&share->intern_lock);
if (share->kfile >= 0) /* May only be false on windows */
{
@@ -121,14 +120,12 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{
if (share->r_locks)
{ /* Only read locks left */
- flag=1;
if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
error=my_errno;
}
else if (!share->w_locks)
{ /* No more locks */
- flag=1;
if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
error=my_errno;
@@ -150,7 +147,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
*/
if (share->w_locks == 1)
{
- flag=1;
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
MYF(MY_SEEK_NOT_DONE)))
{
@@ -165,7 +161,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
if (!share->r_locks && !share->w_locks)
{
- flag=1;
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
info->lock_wait | MY_SEEK_NOT_DONE))
{
@@ -191,7 +186,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{ /* Change READONLY to RW */
if (share->r_locks == 1)
{
- flag=1;
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
MYF(info->lock_wait | MY_SEEK_NOT_DONE)))
{
@@ -208,7 +202,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{
if (!share->w_locks)
{
- flag=1;
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
info->lock_wait | MY_SEEK_NOT_DONE))
{
@@ -256,11 +249,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
#endif
mysql_mutex_unlock(&share->intern_lock);
-#if defined(FULL_LOG) || defined(_lint)
- lock_type|=(int) (flag << 8); /* Set bit to set if real lock */
- myisam_log_command(MI_LOG_LOCK,info,(uchar*) &lock_type,sizeof(lock_type),
- error);
-#endif
DBUG_RETURN(error);
} /* mi_lock_database */
diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c
index 74fca5902f5..f83afa3c886 100644
--- a/storage/myisam/mi_statrec.c
+++ b/storage/myisam/mi_statrec.c
@@ -273,7 +273,12 @@ int _mi_read_rnd_static_record(MI_INFO *info, uchar *buf,
DBUG_RETURN(error);
}
- /* Read record with cacheing */
+ /*
+ Read record with caching. If my_b_read() returns TRUE, less than the
+ requested bytes have been read. In this case rec_cache.error is
+ either -1 for a read error, or contains the number of bytes copied
+ into the buffer.
+ */
error=my_b_read(&info->rec_cache,(uchar*) buf,share->base.reclength);
if (info->s->base.pack_reclength != info->s->base.reclength && !error)
{
@@ -293,8 +298,17 @@ int _mi_read_rnd_static_record(MI_INFO *info, uchar *buf,
info->update|= HA_STATE_AKTIV | HA_STATE_KEY_CHANGED;
DBUG_RETURN(0);
}
- /* my_errno should be set if rec_cache.error == -1 */
+ /* error is TRUE. my_errno should be set if rec_cache.error == -1 */
if (info->rec_cache.error != -1 || my_errno == 0)
- my_errno=HA_ERR_WRONG_IN_RECORD;
+ {
+ /*
+ If we could not get a full record, we either have a broken record,
+ or are at end of file.
+ */
+ if (info->rec_cache.error == 0)
+ my_errno= HA_ERR_END_OF_FILE;
+ else
+ my_errno= HA_ERR_WRONG_IN_RECORD;
+ }
DBUG_RETURN(my_errno); /* Something wrong (EOF?) */
}
diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c
index 88cf643faf9..03d22de68fa 100644
--- a/storage/myisam/rt_split.c
+++ b/storage/myisam/rt_split.c
@@ -255,7 +255,6 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
SplitStruct *stop;
double *coord_buf;
double *next_coord;
- double *old_coord;
int n_dim;
uchar *source_cur, *cur1, *cur2;
uchar *new_page= info->buff;
@@ -293,8 +292,6 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
rtree_d_mbr(keyinfo->seg, key, key_length, cur->coords);
cur->key = key;
- old_coord = next_coord;
-
if (split_rtree_node(task, max_keys + 1,
mi_getint(page) + full_length + 2, full_length,
rt_PAGE_MIN_SIZE(keyinfo->block_length),
diff --git a/storage/myisammrg/CMakeLists.txt b/storage/myisammrg/CMakeLists.txt
index 739bcd565bc..eec3ca783dc 100644
--- a/storage/myisammrg/CMakeLists.txt
+++ b/storage/myisammrg/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(MYISAMMRG_SOURCES myrg_close.c myrg_create.c myrg_delete.c myrg_extra.c myrg_info.c
ha_myisammrg.cc
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index eb43e141f27..f62aff4e383 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -475,10 +475,7 @@ int ha_myisammrg::add_children_list(void)
child_l->parent_l= parent_l;
/* Copy select_lex. Used in unique_table() at least. */
child_l->select_lex= parent_l->select_lex;
- /*
- Set the expected table version, to not cause spurious re-prepare.
- @todo: revise after the fix for Bug#36171
- */
+ /* Set the expected table version, to not cause spurious re-prepare. */
child_l->set_table_ref_id(mrg_child_def->get_child_table_ref_type(),
mrg_child_def->get_child_def_version());
/* Link TABLE_LIST object into the children list. */
@@ -617,15 +614,17 @@ extern "C" MI_INFO *myisammrg_attach_children_callback(void *callback_param)
param->need_compat_check= TRUE;
/*
- If parent is temporary, children must be temporary too and vice
- versa. This check must be done for every child on every open because
- the table def version can overlap between temporary and
- non-temporary tables. We need to detect the case where a
- non-temporary table has been replaced with a temporary table of the
- same version. Or vice versa. A very unlikely case, but it could
- happen.
+ If child is temporary, parent must be temporary as well. Other
+ parent/child combinations are allowed. This check must be done for
+ every child on every open because the table def version can overlap
+ between temporary and non-temporary tables. We need to detect the
+ case where a non-temporary table has been replaced with a temporary
+ table of the same version. Or vice versa. A very unlikely case, but
+ it could happen. (Note that the condition was different from
+ 5.1.23/6.0.4(Bug#19627) to 5.5.6 (Bug#36171): child->s->tmp_table !=
+ parent->s->tmp_table. Tables were required to have the same status.)
*/
- if (child->s->tmp_table != parent->s->tmp_table)
+ if (child->s->tmp_table && !parent->s->tmp_table)
{
DBUG_PRINT("error", ("temporary table mismatch parent: %d child: %d",
parent->s->tmp_table, child->s->tmp_table));
@@ -1321,6 +1320,8 @@ int ha_myisammrg::extra(enum ha_extra_function operation)
if (operation == HA_EXTRA_FORCE_REOPEN ||
operation == HA_EXTRA_PREPARE_FOR_DROP)
return 0;
+ if (operation == HA_EXTRA_MMAP && !opt_myisam_use_mmap)
+ return 0;
return myrg_extra(file,operation,0);
}
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index c9e19d32e96..b8e86b89181 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -226,9 +226,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
int save_errno;
int insert_method;
uint length;
- uint dir_length;
uint child_count;
- size_t name_buff_length;
File fd;
IO_CACHE file_cache;
char parent_name_buff[FN_REFLEN * 2];
@@ -300,7 +298,6 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
}
/* Call callback for each child. */
- dir_length= dirname_part(parent_name_buff, parent_name, &name_buff_length);
my_b_seek(&file_cache, 0);
while ((length= my_b_gets(&file_cache, child_name_buff, FN_REFLEN - 1)))
{
@@ -381,7 +378,6 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
{
ulonglong file_offset;
MI_INFO *myisam;
- int rc;
int errpos;
int save_errno;
uint idx;
@@ -400,7 +396,6 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
here and in ha_myisammrg::store_lock() forces consistent data.
*/
mysql_mutex_lock(&m_info->mutex);
- rc= 1;
errpos= 0;
file_offset= 0;
min_keys= 0;
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/pfs.cc b/storage/perfschema/pfs.cc
index 93c9cf14e9d..60ef2a3b194 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1117,7 +1117,6 @@ get_thread_mutex_locker_v1(PSI_mutex_locker_state *state,
}
PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
[pfs_thread->m_wait_locker_count];
- pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
pfs_locker->m_target.m_mutex= pfs_mutex;
pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1163,7 +1162,6 @@ get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state,
}
PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
[pfs_thread->m_wait_locker_count];
- pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
pfs_locker->m_target.m_rwlock= pfs_rwlock;
pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1222,7 +1220,6 @@ get_thread_cond_locker_v1(PSI_cond_locker_state *state,
}
PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
[pfs_thread->m_wait_locker_count];
- pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
pfs_locker->m_target.m_cond= pfs_cond;
pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1267,7 +1264,6 @@ get_thread_table_locker_v1(PSI_table_locker_state *state,
}
PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
[pfs_thread->m_wait_locker_count];
- pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
pfs_locker->m_target.m_table= pfs_table;
pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1320,7 +1316,6 @@ get_thread_file_name_locker_v1(PSI_file_locker_state *state,
PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
[pfs_thread->m_wait_locker_count];
- pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
pfs_locker->m_target.m_file= pfs_file;
pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1372,7 +1367,6 @@ get_thread_file_stream_locker_v1(PSI_file_locker_state *state,
}
PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
[pfs_thread->m_wait_locker_count];
- pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
pfs_locker->m_target.m_file= pfs_file;
pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1441,7 +1435,6 @@ get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state,
}
PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
[pfs_thread->m_wait_locker_count];
- pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
pfs_locker->m_target.m_file= pfs_file;
pfs_locker->m_waits_current.m_thread= pfs_thread;
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_events_waits.cc b/storage/perfschema/pfs_events_waits.cc
index e32a77512cc..b6cadf9e61c 100644
--- a/storage/perfschema/pfs_events_waits.cc
+++ b/storage/perfschema/pfs_events_waits.cc
@@ -80,25 +80,10 @@ void cleanup_events_waits_history_long(void)
events_waits_history_long_array= NULL;
}
-static void copy_events_waits(PFS_events_waits *dest,
- const PFS_events_waits *source)
+static inline void copy_events_waits(PFS_events_waits *dest,
+ const PFS_events_waits *source)
{
- /* m_wait_class must be the first member of PFS_events_waits. */
- compile_time_assert(offsetof(PFS_events_waits, m_wait_class) == 0);
-
- char* dest_body= (reinterpret_cast<char*> (dest)) + sizeof(events_waits_class);
- const char* source_body= (reinterpret_cast<const char*> (source))
- + sizeof(events_waits_class);
-
- /* See comments in table_events_waits_common::make_row(). */
-
- /* Signal readers they are about to read garbage ... */
- dest->m_wait_class= NO_WAIT_CLASS;
- /* ... that this can generate. */
- memcpy(dest_body, source_body,
- sizeof(PFS_events_waits) - sizeof(events_waits_class));
- /* Signal readers the record is now clean again. */
- dest->m_wait_class= source->m_wait_class;
+ memcpy(dest, source, sizeof(PFS_events_waits));
}
/**
@@ -116,9 +101,7 @@ void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait)
causing a potential race condition.
We are not testing for this and insert a possibly empty record,
to make this thread (the writer) faster.
- This is ok, the truncated data will have
- wait->m_wait_class == NO_WAIT_CLASS,
- which readers of m_waits_history will filter out.
+ This is ok, the readers of m_waits_history will filter this out.
*/
copy_events_waits(&thread->m_waits_history[index], wait);
diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h
index 9a5ed8644f3..d277db39d8d 100644
--- a/storage/perfschema/pfs_events_waits.h
+++ b/storage/perfschema/pfs_events_waits.h
@@ -97,7 +97,7 @@ struct PFS_events_waits
- TRUNCATE EVENTS_WAITS_HISTORY
- TRUNCATE EVENTS_WAITS_HISTORY_LONG
*/
- volatile events_waits_class m_wait_class;
+ events_waits_class m_wait_class;
/** Executing thread. */
PFS_thread *m_thread;
/** Instrument metadata. */
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index a09d7f1ba30..5e5972b68f1 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -217,16 +217,8 @@ void table_events_waits_common::make_row(bool thread_own_wait,
or 8 atomics per recorded event.
The problem is that we record a *lot* of events ...
- Instead, a *dirty* marking is done using m_wait_class.
- Using m_wait_class alone does not guarantee anything, it just filters
- out most of the bad data.
- This is acceptable because this code is garbage-proof,
- and won't crash on bad data, only display it,
- very rarely (which is accepted).
-
- If a bad record is displayed, it's a very transient failure:
- the next select * from EVENTS_WAITS_CURRENT/_HISTORY/_HISTORY_LONG will
- show clean data again.
+ This code is prepared to accept *dirty* records,
+ and sanitizes all the data before returning a row.
*/
m_row.m_thread_internal_id= safe_thread->m_thread_internal_id;
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/CMakeLists.txt b/strings/CMakeLists.txt
index e1e14f20218..552bf942700 100644
--- a/strings/CMakeLists.txt
+++ b/strings/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index f5221bb3a21..3007d76a5a4 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -994,86 +994,6 @@ static int my_strxfrm_big5(uchar *dest, const uchar *src, int len)
#endif
-/*
-** Calculate min_str and max_str that ranges a LIKE string.
-** Arguments:
-** ptr Pointer to LIKE string.
-** ptr_length Length of LIKE string.
-** escape Escape character in LIKE. (Normally '\').
-** All escape characters should be removed from min_str and max_str
-** res_length Length of min_str and max_str.
-** min_str Smallest case sensitive string that ranges LIKE.
-** Should be space padded to res_length.
-** max_str Largest case sensitive string that ranges LIKE.
-** Normally padded with the biggest character sort value.
-**
-** The function should return 0 if ok and 1 if the LIKE string can't be
-** optimized !
-*/
-
-#define max_sort_char ((char) 255)
-
-static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
- const char *ptr,size_t ptr_length,
- pbool escape, pbool w_one, pbool w_many,
- size_t res_length,
- char *min_str, char *max_str,
- size_t *min_length, size_t *max_length)
-{
- const char *end= ptr + ptr_length;
- char *min_org=min_str;
- char *min_end=min_str+res_length;
- size_t charlen= res_length / cs->mbmaxlen;
-
- for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--)
- {
- if (ptr+1 != end && isbig5code(ptr[0],ptr[1]))
- {
- *min_str++= *max_str++ = *ptr++;
- *min_str++= *max_str++ = *ptr;
- continue;
- }
- if (*ptr == escape && ptr+1 != end)
- {
- ptr++; /* Skip escape */
- if (isbig5code(ptr[0], ptr[1]))
- *min_str++= *max_str++ = *ptr++;
- if (min_str < min_end)
- *min_str++= *max_str++= *ptr;
- continue;
- }
- if (*ptr == w_one) /* '_' in SQL */
- {
- *min_str++='\0'; /* This should be min char */
- *max_str++=max_sort_char;
- continue;
- }
- if (*ptr == w_many) /* '%' in SQL */
- {
- /*
- Calculate length of keys:
- 'a\0\0... is the smallest possible string when we have space expand
- a\ff\ff... is the biggest possible string
- */
- *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
- res_length);
- *max_length= res_length;
- do {
- *min_str++ = 0;
- *max_str++ = max_sort_char;
- } while (min_str != min_end);
- return 0;
- }
- *min_str++= *max_str++ = *ptr;
- }
-
- *min_length= *max_length= (size_t) (min_str-min_org);
- while (min_str != min_end)
- *min_str++= *max_str++= ' ';
- return 0;
-}
-
-
static uint ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{
@@ -6955,7 +6875,7 @@ static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
my_strnncollsp_big5,
my_strnxfrm_big5,
my_strnxfrmlen_simple,
- my_like_range_big5,
+ my_like_range_mb,
my_wildcmp_mb,
my_strcasecmp_mb,
my_instr_mb,
@@ -7019,7 +6939,7 @@ CHARSET_INFO my_charset_big5_chinese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xF9D5, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_big5_handler,
@@ -7052,7 +6972,7 @@ CHARSET_INFO my_charset_big5_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xF9FE, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_big5_handler,
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 67555ac4384..df4083c9f8d 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -1812,77 +1812,6 @@ static size_t my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)),
}
-/*
-** Calculate min_str and max_str that ranges a LIKE string.
-** Arguments:
-** ptr Pointer to LIKE string.
-** ptr_length Length of LIKE string.
-** escape Escape character in LIKE. (Normally '\').
-** All escape characters should be removed from min_str and max_str
-** res_length Length of min_str and max_str.
-** min_str Smallest case sensitive string that ranges LIKE.
-** Should be space padded to res_length.
-** max_str Largest case sensitive string that ranges LIKE.
-** Normally padded with the biggest character sort value.
-**
-** The function should return 0 if ok and 1 if the LIKE string can't be
-** optimized !
-*/
-
-#define max_sort_char ((char) 255)
-
-static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)),
- const char *ptr,size_t ptr_length,
- pbool escape, pbool w_one, pbool w_many,
- size_t res_length,
- char *min_str,char *max_str,
- size_t *min_length, size_t *max_length)
-{
- const char *end=ptr+ptr_length;
- char *min_org=min_str;
- char *min_end=min_str+res_length;
-
- while (ptr < end && min_str < min_end) {
- if (ismbchar_cp932(cs, ptr, end)) {
- *min_str++ = *max_str++ = *ptr++;
- if (min_str < min_end)
- *min_str++ = *max_str++ = *ptr++;
- continue;
- }
- if (*ptr == escape && ptr+1 < end) {
- ptr++; /* Skip escape */
- if (ismbchar_cp932(cs, ptr, end))
- *min_str++ = *max_str++ = *ptr++;
- if (min_str < min_end)
- *min_str++ = *max_str++ = *ptr++;
- continue;
- }
- if (*ptr == w_one) { /* '_' in SQL */
- *min_str++ = '\0'; /* This should be min char */
- *max_str++ = max_sort_char;
- ptr++;
- continue;
- }
- if (*ptr == w_many)
- { /* '%' in SQL */
- *min_length = (size_t)(min_str - min_org);
- *max_length = res_length;
- do
- {
- *min_str++= 0;
- *max_str++= max_sort_char;
- } while (min_str < min_end);
- return 0;
- }
- *min_str++ = *max_str++ = *ptr++;
- }
- *min_length = *max_length = (size_t) (min_str - min_org);
- while (min_str < min_end)
- *min_str++ = *max_str++ = ' '; /* Because if key compression */
- return 0;
-}
-
-
static uint16 cp932_to_unicode[65536]=
{
0x0000, 0x0001, 0x0002, 0x0003, /* 0000 */
@@ -34852,7 +34781,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncollsp_cp932,
my_strnxfrm_cp932,
my_strnxfrmlen_simple,
- my_like_range_cp932,
+ my_like_range_mb,
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_8bit,
my_instr_mb,
@@ -34918,7 +34847,7 @@ CHARSET_INFO my_charset_cp932_japanese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFCFC, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
@@ -34950,7 +34879,7 @@ CHARSET_INFO my_charset_cp932_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFCFC, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index c2067ac6f6b..7329f9ec09a 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -10029,7 +10029,7 @@ CHARSET_INFO my_charset_euckr_korean_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFEFE, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
@@ -10062,7 +10062,7 @@ CHARSET_INFO my_charset_euckr_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFEFE, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 25c15a08d4e..6180e0e1a7a 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -67573,7 +67573,7 @@ CHARSET_INFO my_charset_eucjpms_japanese_ci=
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFEFE, /* max_sort_char */
' ', /* pad_char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
@@ -67606,7 +67606,7 @@ CHARSET_INFO my_charset_eucjpms_bin=
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFEFE, /* max_sort_char */
' ', /* pad_char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 46f3e9c6da5..b1acd643df3 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -6432,7 +6432,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xF7FE, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
@@ -6464,7 +6464,7 @@ CHARSET_INFO my_charset_gb2312_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xF7FE, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 609bc2ecd27..547c8821229 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -3548,86 +3548,6 @@ static size_t my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
}
-/*
-** Calculate min_str and max_str that ranges a LIKE string.
-** Arguments:
-** ptr Pointer to LIKE string.
-** ptr_length Length of LIKE string.
-** escape Escape character in LIKE. (Normally '\').
-** All escape characters should be removed from min_str and max_str
-** res_length Length of min_str and max_str.
-** min_str Smallest case sensitive string that ranges LIKE.
-** Should be space padded to res_length.
-** max_str Largest case sensitive string that ranges LIKE.
-** Normally padded with the biggest character sort value.
-**
-** The function should return 0 if ok and 1 if the LIKE string can't be
-** optimized !
-*/
-
-#define max_sort_char ((uchar) 255)
-
-static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)),
- const char *ptr,size_t ptr_length,
- pbool escape, pbool w_one, pbool w_many,
- size_t res_length,
- char *min_str,char *max_str,
- size_t *min_length,size_t *max_length)
-{
- const char *end= ptr + ptr_length;
- char *min_org=min_str;
- char *min_end=min_str+res_length;
- size_t charlen= res_length / cs->mbmaxlen;
-
- for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--)
- {
- if (ptr+1 != end && isgbkcode(ptr[0],ptr[1]))
- {
- *min_str++= *max_str++ = *ptr++;
- *min_str++= *max_str++ = *ptr;
- continue;
- }
- if (*ptr == escape && ptr+1 != end)
- {
- ptr++; /* Skip escape */
- if (isgbkcode(ptr[0], ptr[1]))
- *min_str++= *max_str++ = *ptr;
- if (min_str < min_end)
- *min_str++= *max_str++= *ptr;
- continue;
- }
- if (*ptr == w_one) /* '_' in SQL */
- {
- *min_str++='\0'; /* This should be min char */
- *max_str++=max_sort_char;
- continue;
- }
- if (*ptr == w_many) /* '%' in SQL */
- {
- /*
- Calculate length of keys:
- 'a\0\0... is the smallest possible string when we have space expand
- a\ff\ff... is the biggest possible string
- */
- *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
- res_length);
- *max_length= res_length;
- do {
- *min_str++= 0;
- *max_str++= max_sort_char;
- } while (min_str != min_end);
- return 0;
- }
- *min_str++= *max_str++ = *ptr;
- }
-
- *min_length= *max_length = (size_t) (min_str - min_org);
- while (min_str != min_end)
- *min_str++= *max_str++= ' '; /* Because if key compression */
- return 0;
-}
-
-
static uint ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{
@@ -10841,7 +10761,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncollsp_gbk,
my_strnxfrm_gbk,
my_strnxfrmlen_simple,
- my_like_range_gbk,
+ my_like_range_mb,
my_wildcmp_mb,
my_strcasecmp_mb,
my_instr_mb,
@@ -10906,7 +10826,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xA967, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
@@ -10938,7 +10858,7 @@ CHARSET_INFO my_charset_gbk_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFEFE, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index b1b381da59e..b2f2e3cd22e 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -604,7 +604,9 @@ my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
DESCRIPTION
Write max key:
- for non-Unicode character sets:
- just set to 255.
+ just bfill using max_sort_char if max_sort_char is one byte.
+ In case when max_sort_char is two bytes, fill with double-byte pairs
+ and optionally pad with a single space character.
- for Unicode character set (utf-8):
create a buffer with multibyte representation of the max_sort_char
character, and copy it into max_str in a loop.
@@ -616,12 +618,20 @@ static void pad_max_char(CHARSET_INFO *cs, char *str, char *end)
if (!(cs->state & MY_CS_UNICODE))
{
- bfill(str, end - str, 255);
- return;
+ if (cs->max_sort_char <= 255)
+ {
+ bfill(str, end - str, cs->max_sort_char);
+ return;
+ }
+ buf[0]= cs->max_sort_char >> 8;
+ buf[1]= cs->max_sort_char & 0xFF;
+ buflen= 2;
+ }
+ else
+ {
+ buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
+ (uchar*) buf + sizeof(buf));
}
-
- buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
- (uchar*) buf + sizeof(buf));
DBUG_ASSERT(buflen > 0);
do
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 90c76dc3c79..91adf4ebddf 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -1179,86 +1179,6 @@ static size_t my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
}
-/*
-** Calculate min_str and max_str that ranges a LIKE string.
-** Arguments:
-** ptr Pointer to LIKE string.
-** ptr_length Length of LIKE string.
-** escape Escape character in LIKE. (Normally '\').
-** All escape characters should be removed from min_str and max_str
-** res_length Length of min_str and max_str.
-** min_str Smallest case sensitive string that ranges LIKE.
-** Should be space padded to res_length.
-** max_str Largest case sensitive string that ranges LIKE.
-** Normally padded with the biggest character sort value.
-**
-** The function should return 0 if ok and 1 if the LIKE string can't be
-** optimized !
-*/
-
-#define max_sort_char ((char) 255)
-
-static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
- const char *ptr,size_t ptr_length,
- pbool escape, pbool w_one, pbool w_many,
- size_t res_length,
- char *min_str,char *max_str,
- size_t *min_length,size_t *max_length)
-{
- const char *end= ptr + ptr_length;
- char *min_org=min_str;
- char *min_end=min_str+res_length;
- size_t charlen= res_length / cs->mbmaxlen;
-
- for ( ; ptr < end && min_str < min_end && charlen > 0 ; charlen--)
- {
- if (ismbchar_sjis(cs, ptr, end)) {
- *min_str++ = *max_str++ = *ptr++;
- if (min_str < min_end)
- *min_str++ = *max_str++ = *ptr++;
- continue;
- }
- if (*ptr == escape && ptr+1 < end) {
- ptr++; /* Skip escape */
- if (ismbchar_sjis(cs, ptr, end))
- *min_str++ = *max_str++ = *ptr++;
- if (min_str < min_end)
- *min_str++ = *max_str++ = *ptr++;
- continue;
- }
- if (*ptr == w_one) { /* '_' in SQL */
- *min_str++ = '\0'; /* This should be min char */
- *max_str++ = max_sort_char;
- ptr++;
- continue;
- }
- if (*ptr == w_many)
- { /* '%' in SQL */
- /*
- Calculate length of keys:
- 'a\0\0... is the smallest possible string when we have space expand
- a\ff\ff... is the biggest possible string
- */
- *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
- res_length);
- *max_length= res_length;
- do
- {
- *min_str++= 0;
- *max_str++= max_sort_char;
- } while (min_str < min_end);
- return 0;
- }
- *min_str++ = *max_str++ = *ptr++;
- }
-
- *min_length= *max_length= (size_t) (min_str - min_org);
- while (min_str != min_end)
- *min_str++= *max_str++= ' '; /* Because if key compression */
- return 0;
-}
-
-
/* SJIS->Unicode conversion table */
static uint16 sjis_to_unicode[65536]=
{
@@ -34231,7 +34151,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncollsp_sjis,
my_strnxfrm_sjis,
my_strnxfrmlen_simple,
- my_like_range_sjis,
+ my_like_range_mb,
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_8bit,
my_instr_mb,
@@ -34297,7 +34217,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFCFC, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
@@ -34329,7 +34249,7 @@ CHARSET_INFO my_charset_sjis_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFCFC, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index 4fabbdbaeb3..9f4d032ffe0 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -67316,7 +67316,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci=
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFEFE, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
@@ -67349,7 +67349,7 @@ CHARSET_INFO my_charset_ujis_bin=
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFEFE, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
diff --git a/strings/decimal.c b/strings/decimal.c
index 99b7ccd3249..7625ed80ec3 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1917,8 +1917,7 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
int decimal_intg(decimal_t *from)
{
int res;
- dec1 *tmp_res;
- tmp_res= remove_leading_zeroes(from, &res);
+ remove_leading_zeroes(from, &res);
return res;
}
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index 72c4d1ab2d0..ef676c8ee2a 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -1,17 +1,17 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
IF(WIN32)
SET(localstatedir "C:\\mysql\\data")
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/CMakeLists.txt b/tests/CMakeLists.txt
index b0e3342b1bc..8bd6320ba62 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
ADD_DEFINITIONS("-DMYSQL_CLIENT")
diff --git a/unittest/Makefile.am b/unittest/Makefile.am
index 6197586b008..da655d1844e 100644
--- a/unittest/Makefile.am
+++ b/unittest/Makefile.am
@@ -13,12 +13,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-SUBDIRS = mytap . mysys examples
+SUBDIRS = mytap . mysys examples strings
EXTRA_DIST = unit.pl
CLEANFILES = unit
-unittests = mytap mysys @mysql_se_unittest_dirs@ @mysql_pg_unittest_dirs@
+unittests = mytap mysys strings @mysql_se_unittest_dirs@ @mysql_pg_unittest_dirs@
test:
perl unit.pl run $(unittests)
diff --git a/unittest/examples/CMakeLists.txt b/unittest/examples/CMakeLists.txt
index a5aa5a93985..52272bc412e 100644
--- a/unittest/examples/CMakeLists.txt
+++ b/unittest/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/sql
diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt
index 56a3d67f25f..f23a5addba0 100644
--- a/unittest/mysys/CMakeLists.txt
+++ b/unittest/mysys/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 MySQL AB, 2009 Sun Microsystems,Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# 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
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
diff --git a/unittest/mytap/CMakeLists.txt b/unittest/mytap/CMakeLists.txt
index 8a2f6c9639a..c4f213e338a 100644
--- a/unittest/mytap/CMakeLists.txt
+++ b/unittest/mytap/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 MySQL AB, 2009 Sun Microsystems, Inc
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(mytap tap.c)
diff --git a/unittest/strings/Makefile.am b/unittest/strings/Makefile.am
new file mode 100644
index 00000000000..5b18d89f58e
--- /dev/null
+++ b/unittest/strings/Makefile.am
@@ -0,0 +1,27 @@
+# Copyright 2000, 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
+
+AM_CPPFLAGS = @ZLIB_INCLUDES@ -I$(top_builddir)/include
+AM_CPPFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/unittest/mytap
+
+LDADD = $(top_builddir)/unittest/mytap/libmytap.a \
+ $(top_builddir)/mysys/libmysys.a \
+ $(top_builddir)/dbug/libdbug.a \
+ $(top_builddir)/strings/libmystrings.a
+
+noinst_PROGRAMS = strings-t
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c
new file mode 100644
index 00000000000..278f42e56a5
--- /dev/null
+++ b/unittest/strings/strings-t.c
@@ -0,0 +1,114 @@
+/* Copyright 2000, 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 <tap.h>
+#include <my_global.h>
+#include <my_sys.h>
+
+
+/*
+ Test that like_range() returns well-formed results.
+*/
+static int
+test_like_range_for_charset(CHARSET_INFO *cs, const char *src, size_t src_len)
+{
+ char min_str[32], max_str[32];
+ size_t min_len, max_len, min_well_formed_len, max_well_formed_len;
+ int error= 0;
+
+ cs->coll->like_range(cs, src, src_len, '\\', '_', '%',
+ sizeof(min_str), min_str, max_str, &min_len, &max_len);
+ diag("min_len=%d\tmax_len=%d\t%s", (int) min_len, (int) max_len, cs->name);
+ min_well_formed_len= cs->cset->well_formed_len(cs,
+ min_str, min_str + min_len,
+ 10000, &error);
+ max_well_formed_len= cs->cset->well_formed_len(cs,
+ max_str, max_str + max_len,
+ 10000, &error);
+ if (min_len != min_well_formed_len)
+ diag("Bad min_str: min_well_formed_len=%d min_str[%d]=0x%02X",
+ (int) min_well_formed_len, (int) min_well_formed_len,
+ (uchar) min_str[min_well_formed_len]);
+ if (max_len != max_well_formed_len)
+ diag("Bad max_str: max_well_formed_len=%d max_str[%d]=0x%02X",
+ (int) max_well_formed_len, (int) max_well_formed_len,
+ (uchar) max_str[max_well_formed_len]);
+ return
+ min_len == min_well_formed_len &&
+ max_len == max_well_formed_len ? 0 : 1;
+}
+
+
+static CHARSET_INFO *charset_list[]=
+{
+#ifdef HAVE_CHARSET_big5
+ &my_charset_big5_chinese_ci,
+ &my_charset_big5_bin,
+#endif
+#ifdef HAVE_CHARSET_euckr
+ &my_charset_euckr_korean_ci,
+ &my_charset_euckr_bin,
+#endif
+#ifdef HAVE_CHARSET_gb2312
+ &my_charset_gb2312_chinese_ci,
+ &my_charset_gb2312_bin,
+#endif
+#ifdef HAVE_CHARSET_gbk
+ &my_charset_gbk_chinese_ci,
+ &my_charset_gbk_bin,
+#endif
+#ifdef HAVE_CHARSET_latin1
+ &my_charset_latin1,
+ &my_charset_latin1_bin,
+#endif
+#ifdef HAVE_CHARSET_sjis
+ &my_charset_sjis_japanese_ci,
+ &my_charset_sjis_bin,
+#endif
+#ifdef HAVE_CHARSET_tis620
+ &my_charset_tis620_thai_ci,
+ &my_charset_tis620_bin,
+#endif
+#ifdef HAVE_CHARSET_ujis
+ &my_charset_ujis_japanese_ci,
+ &my_charset_ujis_bin,
+#endif
+#ifdef HAVE_CHARSET_utf8
+ &my_charset_utf8_general_ci,
+ &my_charset_utf8_unicode_ci,
+ &my_charset_utf8_bin,
+#endif
+};
+
+
+int main()
+{
+ size_t i, failed= 0;
+
+ plan(1);
+ diag("Testing my_like_range_xxx() functions");
+
+ for (i= 0; i < array_elements(charset_list); i++)
+ {
+ CHARSET_INFO *cs= charset_list[i];
+ if (test_like_range_for_charset(cs, "abc%", 4))
+ {
+ ++failed;
+ diag("Failed for %s", cs->name);
+ }
+ }
+ ok(failed == 0, "Testing my_like_range_xxx() functions");
+ return exit_status();
+}
diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt
index dae2ed2bb2f..e61281a43d8 100644
--- a/vio/CMakeLists.txt
+++ b/vio/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${SSL_INCLUDE_DIRS})
diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt
index 4be153bfdfa..68799947e44 100644
--- a/zlib/CMakeLists.txt
+++ b/zlib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
#
# 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
-
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include