summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzr-mysql/default.conf6
-rw-r--r--.bzrignore6
-rwxr-xr-xBUILD/SETUP.sh15
-rwxr-xr-xBUILD/build_mccge.sh1
-rwxr-xr-xBUILD/check-cpu117
-rwxr-xr-xBUILD/compile-ia64-debug-max2
-rw-r--r--[-rwxr-xr-x]CMakeLists.txt62
-rw-r--r--Makefile.am4
-rw-r--r--[-rwxr-xr-x]client/CMakeLists.txt2
-rw-r--r--client/client_priv.h2
-rw-r--r--client/completion_hash.cc3
-rw-r--r--client/mysql.cc105
-rw-r--r--client/mysql_upgrade.c7
-rw-r--r--client/mysqladmin.cc24
-rw-r--r--client/mysqlbinlog.cc49
-rw-r--r--client/mysqlcheck.c27
-rw-r--r--client/mysqldump.c51
-rw-r--r--client/mysqlimport.c18
-rw-r--r--client/mysqlshow.c23
-rw-r--r--client/mysqlslap.c46
-rw-r--r--client/mysqltest.cc128
-rw-r--r--client/readline.cc8
-rw-r--r--client/sql_string.h2
-rw-r--r--cmake/build_configurations/mysql_release.cmake141
-rw-r--r--cmake/configure.pl6
-rw-r--r--cmake/create_initial_db.cmake.in8
-rw-r--r--[-rwxr-xr-x]cmake/install_layout.cmake0
-rw-r--r--cmake/install_macros.cmake125
-rw-r--r--cmake/libutils.cmake7
-rw-r--r--cmake/mysql_add_executable.cmake13
-rw-r--r--cmake/os/AIX.cmake4
-rw-r--r--cmake/os/FreeBSD.cmake3
-rw-r--r--cmake/os/Windows.cmake4
-rw-r--r--cmake/os/WindowsCache.cmake2
-rw-r--r--cmake/package_name.cmake6
-rw-r--r--cmake/plugin.cmake2
-rw-r--r--cmake/ssl.cmake6
-rw-r--r--cmd-line-utils/readline/Makefile.am2
-rw-r--r--config.h.cmake178
-rw-r--r--config/ac-macros/maintainer.m464
-rw-r--r--config/ac-macros/misc.m432
-rw-r--r--configure.cmake143
-rw-r--r--configure.in338
-rw-r--r--[-rwxr-xr-x]dbug/CMakeLists.txt2
-rw-r--r--dbug/Makefile.am2
-rw-r--r--dbug/dbug.c110
-rw-r--r--dbug/dbug_analyze.c118
-rw-r--r--dbug/sanity.c13
-rw-r--r--dbug/user.r8
-rw-r--r--[-rwxr-xr-x]extra/CMakeLists.txt2
-rw-r--r--extra/comp_err.c30
-rw-r--r--extra/my_print_defaults.c7
-rw-r--r--extra/mysql_waitpid.c14
-rw-r--r--extra/perror.c6
-rw-r--r--extra/replace.c34
-rw-r--r--extra/resolve_stack_dump.c4
-rw-r--r--extra/resolveip.c3
-rw-r--r--[-rwxr-xr-x]extra/yassl/CMakeLists.txt2
-rw-r--r--extra/yassl/include/yassl_int.hpp3
-rw-r--r--extra/yassl/src/crypto_wrapper.cpp5
-rw-r--r--extra/yassl/src/socket_wrapper.cpp2
-rw-r--r--[-rwxr-xr-x]extra/yassl/taocrypt/CMakeLists.txt1
-rw-r--r--extra/yassl/taocrypt/include/blowfish.hpp6
-rw-r--r--extra/yassl/taocrypt/include/misc.hpp2
-rw-r--r--extra/yassl/taocrypt/include/runtime.hpp16
-rw-r--r--extra/yassl/taocrypt/src/aes.cpp3
-rw-r--r--extra/yassl/taocrypt/src/algebra.cpp6
-rw-r--r--extra/yassl/taocrypt/src/blowfish.cpp3
-rw-r--r--extra/yassl/taocrypt/src/integer.cpp32
-rw-r--r--extra/yassl/taocrypt/src/misc.cpp23
-rw-r--r--extra/yassl/taocrypt/src/random.cpp61
-rw-r--r--extra/yassl/taocrypt/src/twofish.cpp3
-rw-r--r--extra/yassl/testsuite/test.hpp14
-rw-r--r--include/CMakeLists.txt4
-rw-r--r--include/Makefile.am15
-rw-r--r--include/config-netware.h161
-rw-r--r--include/config-win.h1
-rw-r--r--include/hash.h8
-rw-r--r--include/heap.h17
-rw-r--r--include/help_start.h28
-rw-r--r--include/lf.h2
-rw-r--r--include/m_string.h47
-rw-r--r--include/my_alarm.h4
-rw-r--r--include/my_bitmap.h16
-rw-r--r--include/my_compiler.h129
-rw-r--r--include/my_dbug.h2
-rw-r--r--include/my_global.h144
-rw-r--r--include/my_list.h2
-rw-r--r--include/my_net.h2
-rw-r--r--include/my_nosys.h2
-rw-r--r--include/my_pthread.h11
-rw-r--r--include/my_stacktrace.h2
-rw-r--r--include/my_sys.h118
-rw-r--r--include/my_time.h2
-rw-r--r--include/myisam.h2
-rw-r--r--include/mysql.h8
-rw-r--r--include/mysql.h.pp6
-rw-r--r--include/mysql/psi/mysql_file.h104
-rw-r--r--include/mysql/psi/mysql_thread.h77
-rw-r--r--include/mysql/psi/psi.h257
-rw-r--r--include/mysql/psi/psi_abi_v1.h6
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp101
-rw-r--r--include/mysql/psi/psi_abi_v2.h6
-rw-r--r--include/mysql/psi/psi_abi_v2.h.pp25
-rw-r--r--include/mysys_err.h6
-rw-r--r--include/thr_lock.h6
-rw-r--r--include/typelib.h6
-rw-r--r--[-rwxr-xr-x]libmysql/CMakeLists.txt10
-rw-r--r--libmysql/Makefile.am2
-rw-r--r--libmysql/Makefile.shared8
-rw-r--r--libmysql/dll.c20
-rw-r--r--libmysql/get_password.c14
-rw-r--r--libmysql/libmysql.c103
-rw-r--r--libmysqld/CMakeLists.txt8
-rw-r--r--libmysqld/Makefile.am39
-rw-r--r--libmysqld/examples/Makefile.am3
-rw-r--r--libmysqld/lib_sql.cc17
-rw-r--r--libmysqld/libmysqld.c8
-rw-r--r--mysql-test/CMakeLists.txt1
-rw-r--r--mysql-test/collections/default.daily1
-rw-r--r--mysql-test/collections/default.experimental4
-rw-r--r--mysql-test/collections/default.push6
-rw-r--r--mysql-test/collections/disabled-per-push.list186
-rw-r--r--mysql-test/collections/mysql-next-mr.push6
-rw-r--r--mysql-test/collections/mysql-trunk.push6
-rw-r--r--mysql-test/extra/binlog_tests/binlog.test7
-rw-r--r--mysql-test/extra/binlog_tests/binlog_truncate.test41
-rw-r--r--mysql-test/extra/binlog_tests/drop_temp_table.test30
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test15
-rw-r--r--mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_conflicts.test5
-rw-r--r--mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc967
-rw-r--r--mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test389
-rw-r--r--mysql-test/include/check_concurrent_insert.inc18
-rw-r--r--mysql-test/include/check_no_concurrent_insert.inc14
-rw-r--r--mysql-test/include/check_no_row_lock.inc4
-rw-r--r--mysql-test/include/ctype_numconv.inc38
-rw-r--r--mysql-test/include/diff_tables.inc18
-rw-r--r--mysql-test/include/mix1.inc41
-rw-r--r--mysql-test/include/mysqld--help.inc2
-rw-r--r--[-rwxr-xr-x]mysql-test/include/parser_bug21114.inc0
-rw-r--r--mysql-test/include/rpl_diff_tables.inc35
-rw-r--r--[-rwxr-xr-x]mysql-test/include/show_msg.inc0
-rw-r--r--[-rwxr-xr-x]mysql-test/include/show_msg80.inc0
-rw-r--r--[-rwxr-xr-x]mysql-test/lib/My/Handles.pm0
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt17
-rw-r--r--[-rwxr-xr-x]mysql-test/lib/My/SafeProcess/safe_kill_win.cc0
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc2
-rw-r--r--[-rwxr-xr-x]mysql-test/lib/My/SafeProcess/safe_process_win.cc0
-rw-r--r--mysql-test/lib/mtr_cases.pm44
-rw-r--r--mysql-test/lib/v1/mtr_misc.pl1
-rw-r--r--mysql-test/lib/v1/mtr_report.pl14
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl12
-rwxr-xr-xmysql-test/mysql-stress-test.pl2
-rwxr-xr-xmysql-test/mysql-test-run.pl41
-rw-r--r--mysql-test/r/archive.result8
-rw-r--r--[-rwxr-xr-x]mysql-test/r/bug46080.result0
-rw-r--r--mysql-test/r/bug46760.result2
-rw-r--r--mysql-test/r/commit.result272
-rw-r--r--mysql-test/r/create.result55
-rw-r--r--mysql-test/r/ctype_binary.result51
-rw-r--r--mysql-test/r/ctype_cp1251.result51
-rw-r--r--[-rwxr-xr-x]mysql-test/r/ctype_eucjpms.result0
-rw-r--r--mysql-test/r/ctype_latin1.result51
-rw-r--r--mysql-test/r/ctype_ucs.result51
-rw-r--r--mysql-test/r/drop.result10
-rw-r--r--mysql-test/r/error_simulation.result35
-rw-r--r--mysql-test/r/func_analyse.result (renamed from mysql-test/r/analyse.result)0
-rw-r--r--mysql-test/r/func_digest.result21
-rw-r--r--mysql-test/r/func_in.result20
-rw-r--r--mysql-test/r/func_like.result14
-rw-r--r--mysql-test/r/group_by.result29
-rw-r--r--mysql-test/r/having.result16
-rw-r--r--mysql-test/r/information_schema.result29
-rw-r--r--mysql-test/r/information_schema_parameters.result30
-rw-r--r--mysql-test/r/information_schema_routines.result60
-rw-r--r--mysql-test/r/innodb_mysql_lock2.result70
-rw-r--r--mysql-test/r/loaddata.result29
-rw-r--r--mysql-test/r/lock_sync.result2
-rw-r--r--mysql-test/r/log_state.result2
-rw-r--r--[-rwxr-xr-x]mysql-test/r/lowercase_mixed_tmpdir_innodb.result0
-rw-r--r--mysql-test/r/lowercase_table2.result2
-rw-r--r--mysql-test/r/lowercase_view.result17
-rw-r--r--mysql-test/r/mdl_sync.result140
-rw-r--r--mysql-test/r/merge.result52
-rw-r--r--mysql-test/r/mysql_upgrade.result42
-rw-r--r--mysql-test/r/mysqld--help-notwin.result2
-rw-r--r--mysql-test/r/mysqld--help-win.result2
-rw-r--r--mysql-test/r/parser_not_embedded.result45
-rw-r--r--mysql-test/r/partition_innodb.result22
-rw-r--r--mysql-test/r/partition_innodb_semi_consistent.result3
-rw-r--r--mysql-test/r/ps.result4
-rw-r--r--mysql-test/r/rename.result11
-rw-r--r--mysql-test/r/rpl_mysqldump_slave.result6
-rw-r--r--mysql-test/r/select.result34
-rw-r--r--mysql-test/r/single_delete_update.result1074
-rw-r--r--mysql-test/r/sp_sync.result31
-rw-r--r--mysql-test/r/sp_trans_log.result2
-rw-r--r--mysql-test/r/subselect.result17
-rw-r--r--mysql-test/r/subselect4.result25
-rw-r--r--mysql-test/r/truncate.result8
-rw-r--r--mysql-test/r/truncate_coverage.result13
-rw-r--r--mysql-test/r/update.result18
-rw-r--r--mysql-test/r/view.result1
-rw-r--r--mysql-test/std_data/intersect-bug50389.tsv441
-rw-r--r--mysql-test/suite/binlog/r/binlog_base64_flag.result11
-rw-r--r--mysql-test/suite/binlog/r/binlog_innodb.result28
-rw-r--r--mysql-test/suite/binlog/r/binlog_multi_engine.result5
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_binlog.result9
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result19
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_binlog.result13
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result0
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result19
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result8
-rw-r--r--mysql-test/suite/binlog/r/binlog_truncate_innodb.result340
-rw-r--r--mysql-test/suite/binlog/r/binlog_truncate_myisam.result90
-rw-r--r--mysql-test/suite/binlog/t/binlog_base64_flag.test13
-rw-r--r--mysql-test/suite/binlog/t/binlog_innodb.test28
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed_simulate.test10
-rw-r--r--mysql-test/suite/binlog/t/binlog_row_binlog-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_truncate_innodb.test33
-rw-r--r--mysql-test/suite/binlog/t/binlog_truncate_myisam.test16
-rw-r--r--mysql-test/suite/binlog/t/disabled.def1
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result1
-rw-r--r--mysql-test/suite/funcs_1/r/is_basics_mixed.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_innodb.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result76
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_memory.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_myisam.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_engines_innodb.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_engines_myisam.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result1
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views.result1
-rw-r--r--mysql-test/suite/funcs_1/r/ndb_views.result1
-rw-r--r--mysql-test/suite/funcs_1/views/func_view.inc4
-rw-r--r--mysql-test/suite/funcs_1/views/views_master.inc2
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/include/have_i54.inc0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test0
-rw-r--r--mysql-test/suite/innodb/r/innodb-index.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-semi-consistent.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-zip.result5
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug38231.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug52745.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug53591.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug54044.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_file_format.result8
-rw-r--r--mysql-test/suite/innodb/r/innodb_information_schema.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result112
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc-44030-master.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc-master.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb-master.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb-semi-consistent.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb-system-table-view-master.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt4
-rw-r--r--mysql-test/suite/innodb/t/innodb-zip.test6
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug38231.test23
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug47167.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug54044.test11
-rw-r--r--mysql-test/suite/innodb/t/innodb_file_format.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql-master.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql.test75
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_format.result2
-rw-r--r--mysql-test/suite/ndb/t/disabled.def3
-rw-r--r--mysql-test/suite/parts/r/partition_alter3_innodb.result94
-rw-r--r--mysql-test/suite/parts/r/partition_basic_innodb.result432
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_instruments.result2
-rw-r--r--mysql-test/suite/perfschema/r/misc.result2
-rw-r--r--mysql-test/suite/perfschema/r/myisam_file_io.result1
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade.result10
-rw-r--r--mysql-test/suite/perfschema/r/query_cache.result1
-rw-r--r--mysql-test/suite/perfschema/r/thread_cache.result34
-rw-r--r--mysql-test/suite/perfschema/t/misc.test14
-rw-r--r--mysql-test/suite/perfschema/t/myisam_file_io.test9
-rw-r--r--mysql-test/suite/perfschema/t/no_threads-master.opt2
-rw-r--r--mysql-test/suite/perfschema/t/query_cache.test8
-rw-r--r--mysql-test/suite/perfschema/t/thread_cache.test134
-rw-r--r--mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_concurrency_error.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_current_user.result205
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_temp.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result1513
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result924
-rw-r--r--mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result256
-rw-r--r--mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result31
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_conflicts.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result1539
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_savepoint.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_skip.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result20
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_conflicts.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result1513
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_innodb.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result112
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_until.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_temp_temporary.result240
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user.cnf9
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user.test239
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_temp.test28
-rw-r--r--mysql-test/suite/rpl/t/rpl_invoked_features-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_mixed_row_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_savepoint.test47
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_skip.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_loaddata_concurrent.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_sync-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_sync-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_temporary.test228
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result2
-rw-r--r--mysql-test/suite/rpl_ndb/t/disabled.def3
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test1
-rw-r--r--mysql-test/suite/sys_vars/r/default_storage_engine_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_file_format_basic.result14
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result16
-rw-r--r--mysql-test/suite/sys_vars/r/large_files_support_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/r/sql_select_limit_func.result10
-rw-r--r--mysql-test/suite/sys_vars/r/storage_engine_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/t/default_storage_engine_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sql_select_limit_func.test8
-rw-r--r--mysql-test/suite/sys_vars/t/storage_engine_basic.test1
-rw-r--r--mysql-test/t/archive.test9
-rw-r--r--mysql-test/t/bootstrap-master.opt1
-rw-r--r--mysql-test/t/bootstrap.test4
-rw-r--r--mysql-test/t/bug46080-master.opt2
-rw-r--r--mysql-test/t/bug46760.test2
-rw-r--r--mysql-test/t/commit.test350
-rw-r--r--mysql-test/t/crash_commit_before-master.opt3
-rw-r--r--mysql-test/t/create.test67
-rw-r--r--mysql-test/t/ctype_utf8-master.opt1
-rw-r--r--mysql-test/t/ctype_utf8mb4-master.opt1
-rw-r--r--mysql-test/t/ctype_utf8mb4_innodb-master.opt1
-rw-r--r--mysql-test/t/disabled.def9
-rw-r--r--mysql-test/t/drop.test17
-rw-r--r--mysql-test/t/error_simulation.test31
-rw-r--r--mysql-test/t/func_analyse.test (renamed from mysql-test/t/analyse.test)0
-rw-r--r--mysql-test/t/func_digest.test13
-rw-r--r--mysql-test/t/func_in.test15
-rw-r--r--mysql-test/t/func_like.test18
-rw-r--r--mysql-test/t/group_by.test23
-rw-r--r--mysql-test/t/having.test21
-rw-r--r--mysql-test/t/implicit_commit-master.opt1
-rw-r--r--mysql-test/t/information_schema.test25
-rw-r--r--mysql-test/t/innodb_mysql_lock2.test112
-rw-r--r--mysql-test/t/loaddata.test32
-rw-r--r--mysql-test/t/lock_sync-master.opt1
-rw-r--r--mysql-test/t/lock_sync.test2
-rw-r--r--mysql-test/t/lowercase_table2.test2
-rw-r--r--mysql-test/t/lowercase_view.test22
-rw-r--r--mysql-test/t/mdl_sync-master.opt1
-rw-r--r--mysql-test/t/mdl_sync.test219
-rw-r--r--mysql-test/t/merge.test59
-rw-r--r--mysql-test/t/mysql-bug45236-master.opt1
-rw-r--r--[-rwxr-xr-x]mysql-test/t/mysql_delimiter_19799.sql0
-rw-r--r--mysql-test/t/mysql_upgrade.test17
-rw-r--r--mysql-test/t/mysqlbinlog.test10
-rw-r--r--mysql-test/t/mysqlbinlog2.test24
-rw-r--r--mysql-test/t/mysqldump-max-master.opt1
-rw-r--r--mysql-test/t/parser.test1
-rw-r--r--mysql-test/t/parser_not_embedded.test75
-rw-r--r--mysql-test/t/partition_innodb.test17
-rw-r--r--mysql-test/t/partition_innodb_semi_consistent-master.opt2
-rw-r--r--mysql-test/t/partition_innodb_semi_consistent.test3
-rw-r--r--mysql-test/t/ps_3innodb-master.opt1
-rw-r--r--mysql-test/t/rename.test14
-rw-r--r--mysql-test/t/rpl_mysqldump_slave.test3
-rw-r--r--mysql-test/t/select.test34
-rw-r--r--mysql-test/t/single_delete_update.test481
-rw-r--r--mysql-test/t/sp_sync.test35
-rw-r--r--mysql-test/t/sp_trans_log.test5
-rw-r--r--mysql-test/t/strict-master.opt1
-rw-r--r--mysql-test/t/subselect.test25
-rw-r--r--mysql-test/t/subselect4.test29
-rw-r--r--mysql-test/t/truncate.test8
-rw-r--r--mysql-test/t/truncate_coverage.test20
-rw-r--r--mysql-test/t/update.test20
-rw-r--r--mysql-test/t/view.test1
-rw-r--r--[-rwxr-xr-x]mysql-test/t/windows.test0
-rw-r--r--[-rwxr-xr-x]mysys/CMakeLists.txt8
-rw-r--r--mysys/Makefile.am7
-rw-r--r--mysys/array.c9
-rw-r--r--mysys/charset.c4
-rw-r--r--mysys/default.c12
-rw-r--r--mysys/default_modify.c4
-rw-r--r--mysys/errors.c2
-rw-r--r--mysys/hash.c4
-rw-r--r--mysys/lf_alloc-pin.c2
-rw-r--r--mysys/lf_dynarray.c8
-rw-r--r--mysys/lf_hash.c4
-rw-r--r--mysys/list.c4
-rw-r--r--mysys/mf_cache.c10
-rw-r--r--mysys/mf_dirname.c17
-rw-r--r--mysys/mf_fn_ext.c2
-rw-r--r--mysys/mf_iocache.c4
-rw-r--r--mysys/mf_keycache.c14
-rw-r--r--mysys/mf_keycaches.c4
-rw-r--r--mysys/mf_loadpath.c2
-rw-r--r--mysys/mf_pack.c91
-rw-r--r--mysys/mf_path.c3
-rw-r--r--mysys/mf_sort.c2
-rw-r--r--mysys/mf_tempdir.c6
-rw-r--r--mysys/mf_tempfile.c20
-rw-r--r--mysys/mf_unixpath.c11
-rw-r--r--mysys/mf_util.c47
-rw-r--r--mysys/mf_wfile.c3
-rw-r--r--mysys/my_alloc.c6
-rw-r--r--mysys/my_bitmap.c8
-rw-r--r--mysys/my_clock.c4
-rw-r--r--mysys/my_compress.c12
-rw-r--r--mysys/my_copy.c6
-rw-r--r--mysys/my_delete.c32
-rw-r--r--mysys/my_error.c6
-rw-r--r--mysys/my_file.c2
-rw-r--r--mysys/my_fopen.c2
-rw-r--r--mysys/my_gethwaddr.c4
-rw-r--r--mysys/my_getopt.c30
-rw-r--r--mysys/my_getsystime.c8
-rw-r--r--mysys/my_getwd.c25
-rw-r--r--mysys/my_handler.c1
-rw-r--r--mysys/my_init.c92
-rw-r--r--mysys/my_largepage.c11
-rw-r--r--mysys/my_lib.c142
-rw-r--r--mysys/my_lock.c59
-rw-r--r--mysys/my_lockmem.c5
-rw-r--r--mysys/my_malloc.c118
-rw-r--r--mysys/my_mess.c6
-rw-r--r--mysys/my_mmap.c18
-rw-r--r--mysys/my_netware.c150
-rw-r--r--mysys/my_once.c4
-rw-r--r--mysys/my_open.c2
-rw-r--r--mysys/my_pthread.c28
-rw-r--r--mysys/my_rdtsc.c38
-rw-r--r--mysys/my_realloc.c75
-rw-r--r--mysys/my_redel.c19
-rw-r--r--mysys/my_rename.c2
-rw-r--r--mysys/my_sleep.c4
-rw-r--r--mysys/my_static.c33
-rw-r--r--mysys/my_static.h25
-rw-r--r--mysys/my_windac.c8
-rw-r--r--mysys/queues.c7
-rw-r--r--mysys/safemalloc.c576
-rw-r--r--mysys/stacktrace.c153
-rw-r--r--mysys/string.c7
-rw-r--r--mysys/test_charset.c4
-rw-r--r--mysys/testhash.c2
-rw-r--r--mysys/thr_alarm.c12
-rw-r--r--mysys/thr_lock.c221
-rw-r--r--mysys/tree.c4
-rw-r--r--mysys/trie.c2
-rwxr-xr-xnetware/BUILD/apply-patch41
-rwxr-xr-xnetware/BUILD/compile-AUTOTOOLS26
-rwxr-xr-xnetware/BUILD/compile-linux-tools67
-rwxr-xr-xnetware/BUILD/compile-netware-END52
-rwxr-xr-xnetware/BUILD/compile-netware-START26
-rwxr-xr-xnetware/BUILD/compile-netware-all15
-rwxr-xr-xnetware/BUILD/compile-netware-debug21
-rwxr-xr-xnetware/BUILD/compile-netware-max23
-rwxr-xr-xnetware/BUILD/compile-netware-max-debug23
-rwxr-xr-xnetware/BUILD/compile-netware-src35
-rwxr-xr-xnetware/BUILD/compile-netware-standard23
-rwxr-xr-xnetware/BUILD/create-patch56
-rwxr-xr-xnetware/BUILD/cron-build46
-rwxr-xr-xnetware/BUILD/crontab4
-rw-r--r--netware/BUILD/knetware.imp2
-rwxr-xr-xnetware/BUILD/mwasmnlm11
-rwxr-xr-xnetware/BUILD/mwccnlm16
-rwxr-xr-xnetware/BUILD/mwenv75
-rwxr-xr-xnetware/BUILD/mwldnlm18
-rwxr-xr-xnetware/BUILD/nwbuild86
-rw-r--r--netware/BUILD/openssl.imp9
-rwxr-xr-xnetware/BUILD/save-patch56
-rw-r--r--netware/Makefile.am117
-rw-r--r--netware/comp_err.def11
-rw-r--r--netware/install_test_db.ncf1
-rw-r--r--netware/libmysql.def12
-rw-r--r--netware/libmysqlmain.c38
-rw-r--r--netware/my_manage.c475
-rw-r--r--netware/my_manage.h118
-rw-r--r--netware/my_print_defaults.def11
-rw-r--r--netware/myisam_ftdump.def12
-rw-r--r--netware/myisamchk.def12
-rw-r--r--netware/myisamlog.def12
-rw-r--r--netware/myisampack.def12
-rw-r--r--netware/mysql.def13
-rw-r--r--netware/mysql.xdcbin128 -> 0 bytes
-rw-r--r--netware/mysql_client_test.def10
-rw-r--r--netware/mysql_fix_privilege_tables.pl227
-rw-r--r--netware/mysql_install_db.c447
-rw-r--r--netware/mysql_install_db.def12
-rw-r--r--netware/mysql_secure_installation.pl218
-rw-r--r--netware/mysql_test_run.c1415
-rw-r--r--netware/mysql_test_run.def11
-rw-r--r--netware/mysql_upgrade.def11
-rw-r--r--netware/mysql_waitpid.def12
-rw-r--r--netware/mysqladmin.def12
-rw-r--r--netware/mysqlbinlog.def12
-rw-r--r--netware/mysqlcheck.def12
-rw-r--r--netware/mysqld.def12
-rw-r--r--netware/mysqld_safe.c726
-rw-r--r--netware/mysqld_safe.def13
-rw-r--r--netware/mysqldump.def12
-rw-r--r--netware/mysqlimport.def12
-rw-r--r--netware/mysqlshow.def12
-rw-r--r--netware/mysqlslap.def11
-rw-r--r--netware/mysqltest.def11
-rw-r--r--netware/perror.def11
-rw-r--r--netware/replace.def11
-rw-r--r--netware/resolve_stack_dump.def12
-rw-r--r--netware/resolveip.def11
-rw-r--r--netware/static_init_db.sql34
-rw-r--r--packaging/WiX/AdminBackground.jpgbin0 -> 20557 bytes
-rw-r--r--packaging/WiX/AdminHeader.jpgbin0 -> 3469 bytes
-rw-r--r--packaging/WiX/CMakeLists.txt112
-rw-r--r--packaging/WiX/CPackWixConfig.cmake105
-rw-r--r--packaging/WiX/MySQLServer.icobin0 -> 22486 bytes
-rw-r--r--packaging/WiX/ca/CMakeLists.txt27
-rw-r--r--packaging/WiX/ca/CustomAction.cpp188
-rw-r--r--packaging/WiX/ca/CustomAction.def8
-rw-r--r--packaging/WiX/ca/CustomAction.rc18
-rw-r--r--packaging/WiX/create_msi.cmake.in312
-rw-r--r--packaging/WiX/extra.wxs.in60
-rw-r--r--packaging/WiX/mysql_server.wxs.in114
-rw-r--r--plugin/audit_null/CMakeLists.txt3
-rw-r--r--plugin/daemon_example/CMakeLists.txt3
-rw-r--r--plugin/daemon_example/Makefile.am4
-rw-r--r--plugin/daemon_example/daemon_example.cc2
-rw-r--r--plugin/semisync/Makefile.am4
-rw-r--r--plugin/semisync/semisync_master.h2
-rw-r--r--[-rwxr-xr-x]regex/CMakeLists.txt0
-rw-r--r--regex/regcomp.c7
-rw-r--r--[-rwxr-xr-x]scripts/CMakeLists.txt102
-rw-r--r--scripts/make_binary_distribution.sh395
-rw-r--r--scripts/mysql_config.pl.in3
-rw-r--r--scripts/mysql_config.sh5
-rwxr-xr-xscripts/mysql_secure_installation.pl.in2
-rw-r--r--scripts/mysql_secure_installation.sh22
-rw-r--r--scripts/mysql_system_tables_fix.sql4
-rw-r--r--scripts/mysqld_safe.sh25
-rw-r--r--scripts/mysqlhotcopy.sh20
-rw-r--r--sql-common/client.c124
-rw-r--r--sql-common/my_time.c23
-rw-r--r--[-rwxr-xr-x]sql/CMakeLists.txt13
-rw-r--r--sql/Makefile.am14
-rw-r--r--sql/datadict.cc161
-rw-r--r--sql/datadict.h40
-rw-r--r--sql/debug_sync.cc4
-rw-r--r--sql/derror.cc5
-rw-r--r--sql/event_data_objects.cc6
-rw-r--r--[-rwxr-xr-x]sql/event_scheduler.cc3
-rw-r--r--[-rwxr-xr-x]sql/examples/CMakeLists.txt4
-rw-r--r--sql/field.cc10
-rw-r--r--sql/filesort.cc51
-rw-r--r--sql/gstream.h2
-rw-r--r--sql/ha_ndbcluster.cc52
-rw-r--r--sql/ha_ndbcluster_binlog.cc23
-rw-r--r--sql/ha_partition.cc64
-rw-r--r--sql/ha_partition.h15
-rw-r--r--sql/handler.cc15
-rw-r--r--sql/handler.h22
-rw-r--r--sql/item.cc77
-rw-r--r--sql/item.h38
-rw-r--r--sql/item_cmpfunc.cc33
-rw-r--r--sql/item_cmpfunc.h12
-rw-r--r--sql/item_create.cc26
-rw-r--r--sql/item_func.cc18
-rw-r--r--sql/item_strfunc.cc17
-rw-r--r--sql/item_strfunc.h13
-rw-r--r--sql/item_sum.cc5
-rw-r--r--sql/item_sum.h5
-rw-r--r--sql/item_timefunc.cc24
-rw-r--r--sql/keycaches.cc6
-rw-r--r--sql/lock.cc26
-rw-r--r--sql/lock.h15
-rw-r--r--sql/log.cc101
-rw-r--r--sql/log.h5
-rw-r--r--sql/log_event.cc170
-rw-r--r--sql/log_event.h19
-rw-r--r--sql/log_event_old.cc16
-rw-r--r--sql/mdl.cc982
-rw-r--r--sql/mdl.h146
-rw-r--r--sql/my_decimal.cc8
-rw-r--r--sql/my_lock.c78
-rw-r--r--sql/mysqld.cc491
-rw-r--r--sql/net_serv.cc7
-rw-r--r--sql/opt_range.cc169
-rw-r--r--sql/opt_range.h21
-rw-r--r--sql/partition_info.cc6
-rw-r--r--sql/protocol.cc24
-rw-r--r--sql/records.cc61
-rw-r--r--sql/records.h2
-rw-r--r--sql/repl_failsafe.cc5
-rw-r--r--sql/rpl_filter.cc4
-rw-r--r--sql/rpl_handler.cc53
-rw-r--r--sql/rpl_injector.cc2
-rw-r--r--sql/rpl_mi.cc37
-rw-r--r--sql/rpl_rli.cc5
-rw-r--r--sql/rpl_utility.cc12
-rw-r--r--sql/share/CMakeLists.txt6
-rw-r--r--sql/slave.cc23
-rw-r--r--sql/sp_head.cc13
-rw-r--r--sql/sp_head.h4
-rw-r--r--sql/sp_pcontext.cc4
-rw-r--r--sql/sp_rcontext.cc4
-rw-r--r--sql/spatial.cc39
-rw-r--r--sql/spatial.h16
-rw-r--r--sql/sql_acl.cc33
-rw-r--r--sql/sql_analyse.cc10
-rw-r--r--sql/sql_base.cc862
-rw-r--r--sql/sql_base.h170
-rw-r--r--sql/sql_binlog.cc31
-rw-r--r--sql/sql_bitmap.h10
-rw-r--r--sql/sql_cache.cc2
-rw-r--r--sql/sql_class.cc358
-rw-r--r--sql/sql_class.h386
-rw-r--r--sql/sql_connect.cc12
-rw-r--r--sql/sql_cursor.cc8
-rw-r--r--sql/sql_db.cc27
-rw-r--r--sql/sql_delete.cc344
-rw-r--r--sql/sql_delete.h4
-rw-r--r--sql/sql_handler.cc45
-rw-r--r--sql/sql_handler.h1
-rw-r--r--sql/sql_insert.cc23
-rw-r--r--sql/sql_lex.cc12
-rw-r--r--sql/sql_lex.h14
-rw-r--r--sql/sql_list.h4
-rw-r--r--sql/sql_load.cc62
-rw-r--r--sql/sql_locale.cc2
-rw-r--r--sql/sql_manager.cc4
-rw-r--r--sql/sql_map.cc2
-rw-r--r--sql/sql_parse.cc104
-rw-r--r--sql/sql_parse.h10
-rw-r--r--sql/sql_partition.cc2
-rw-r--r--sql/sql_plist.h132
-rw-r--r--sql/sql_plugin.cc39
-rw-r--r--sql/sql_plugin.h14
-rw-r--r--sql/sql_prepare.cc31
-rw-r--r--sql/sql_priv.h5
-rw-r--r--sql/sql_profile.cc6
-rw-r--r--sql/sql_profile.h4
-rw-r--r--sql/sql_rename.cc3
-rw-r--r--sql/sql_repl.cc3
-rw-r--r--sql/sql_select.cc749
-rw-r--r--sql/sql_select.h8
-rw-r--r--sql/sql_show.cc108
-rw-r--r--sql/sql_string.h2
-rw-r--r--sql/sql_table.cc249
-rw-r--r--sql/sql_test.cc6
-rw-r--r--sql/sql_trigger.cc6
-rw-r--r--sql/sql_truncate.cc485
-rw-r--r--sql/sql_truncate.h (renamed from include/help_end.h)21
-rw-r--r--sql/sql_udf.cc2
-rw-r--r--sql/sql_update.cc53
-rw-r--r--sql/sql_view.cc53
-rw-r--r--sql/sql_view.h2
-rw-r--r--sql/sql_yacc.yy141
-rw-r--r--sql/sys_vars.cc46
-rw-r--r--sql/sys_vars.h30
-rw-r--r--sql/table.cc119
-rw-r--r--sql/table.h42
-rw-r--r--sql/transaction.cc35
-rw-r--r--sql/tztime.cc10
-rw-r--r--sql/udf_example.c2
-rw-r--r--sql/uniques.cc4
-rw-r--r--sql/unireg.cc22
-rw-r--r--sql/unireg.h4
-rw-r--r--storage/archive/Makefile.am4
-rw-r--r--storage/archive/archive_reader.c6
-rw-r--r--storage/archive/ha_archive.cc15
-rw-r--r--storage/blackhole/Makefile.am4
-rw-r--r--storage/blackhole/ha_blackhole.cc4
-rw-r--r--storage/csv/Makefile.am4
-rw-r--r--storage/csv/ha_tina.cc8
-rw-r--r--storage/csv/ha_tina.h2
-rw-r--r--storage/csv/transparent_file.cc2
-rw-r--r--storage/example/Makefile.am4
-rw-r--r--storage/example/ha_example.cc4
-rw-r--r--storage/federated/Makefile.am4
-rw-r--r--storage/federated/ha_federated.cc17
-rw-r--r--[-rwxr-xr-x]storage/heap/CMakeLists.txt6
-rw-r--r--storage/heap/ha_heap.cc123
-rw-r--r--storage/heap/hp_block.c2
-rw-r--r--storage/heap/hp_close.c2
-rw-r--r--storage/heap/hp_create.c26
-rw-r--r--storage/heap/hp_hash.c4
-rw-r--r--storage/heap/hp_open.c25
-rw-r--r--storage/heap/hp_rename.c2
-rw-r--r--storage/heap/hp_test1.c11
-rw-r--r--storage/heap/hp_test2.c31
-rw-r--r--storage/ibmdb2i/Makefile.am4
-rw-r--r--storage/ibmdb2i/db2i_constraints.cc2
-rw-r--r--storage/ibmdb2i/db2i_conversion.cc6
-rw-r--r--storage/ibmdb2i/db2i_file.cc15
-rw-r--r--storage/ibmdb2i/db2i_file.h2
-rw-r--r--storage/ibmdb2i/db2i_global.h2
-rw-r--r--storage/ibmdb2i/db2i_ileBridge.cc4
-rw-r--r--storage/ibmdb2i/db2i_ileBridge.h2
-rw-r--r--storage/ibmdb2i/ha_ibmdb2i.cc8
-rw-r--r--storage/innobase/CMakeLists.txt3
-rw-r--r--storage/innobase/Makefile.am4
-rw-r--r--storage/innobase/dict/dict0crea.c18
-rw-r--r--storage/innobase/handler/ha_innodb.cc82
-rw-r--r--storage/innobase/include/os0file.h14
-rw-r--r--storage/innobase/include/os0file.ic30
-rw-r--r--storage/innobase/include/srv0start.h4
-rw-r--r--storage/innobase/include/sync0rw.ic33
-rw-r--r--storage/innobase/include/sync0sync.ic13
-rw-r--r--storage/innobase/include/univ.i2
-rw-r--r--storage/innobase/include/ut0dbg.h46
-rw-r--r--storage/innobase/os/os0file.c22
-rw-r--r--storage/innobase/os/os0proc.c4
-rw-r--r--storage/innobase/os/os0thread.c12
-rw-r--r--storage/innobase/row/row0merge.c10
-rw-r--r--storage/innobase/srv/srv0start.c26
-rw-r--r--storage/innobase/ut/ut0dbg.c27
-rw-r--r--storage/innobase/ut/ut0mem.c6
-rw-r--r--[-rwxr-xr-x]storage/myisam/CMakeLists.txt0
-rw-r--r--storage/myisam/ft_boolean_search.c4
-rw-r--r--storage/myisam/ft_nlq_search.c2
-rw-r--r--storage/myisam/ft_stopwords.c6
-rw-r--r--storage/myisam/ha_myisam.cc6
-rw-r--r--storage/myisam/mi_check.c55
-rw-r--r--storage/myisam/mi_close.c12
-rw-r--r--storage/myisam/mi_create.c8
-rw-r--r--storage/myisam/mi_dbug.c17
-rw-r--r--storage/myisam/mi_dynrec.c4
-rw-r--r--storage/myisam/mi_log.c8
-rw-r--r--storage/myisam/mi_open.c11
-rw-r--r--storage/myisam/mi_packrec.c4
-rw-r--r--storage/myisam/mi_preload.c4
-rw-r--r--storage/myisam/mi_search.c8
-rw-r--r--storage/myisam/mi_static.c8
-rw-r--r--storage/myisam/mi_test2.c29
-rw-r--r--storage/myisam/mi_test3.c14
-rw-r--r--storage/myisam/mi_unique.c2
-rw-r--r--storage/myisam/mi_write.c4
-rw-r--r--storage/myisam/myisam_ftdump.c3
-rw-r--r--storage/myisam/myisamchk.c24
-rw-r--r--storage/myisam/myisamdef.h20
-rw-r--r--storage/myisam/myisamlog.c14
-rw-r--r--storage/myisam/myisampack.c54
-rw-r--r--storage/myisam/rt_index.c2
-rw-r--r--storage/myisam/sort.c151
-rw-r--r--[-rwxr-xr-x]storage/myisammrg/CMakeLists.txt0
-rw-r--r--storage/myisammrg/ha_myisammrg.cc11
-rw-r--r--storage/myisammrg/myrg_close.c4
-rw-r--r--storage/myisammrg/myrg_open.c11
-rw-r--r--storage/ndb/config/win-lib.am2
-rw-r--r--storage/ndb/config/win-prg.am2
-rw-r--r--storage/ndb/include/util/NdbAutoPtr.hpp4
-rw-r--r--storage/ndb/src/common/portlib/NdbMutex.c21
-rw-r--r--storage/ndb/src/mgmapi/mgmapi.cpp6
-rw-r--r--storage/ndb/src/mgmapi/ndb_logevent.cpp2
-rw-r--r--storage/ndb/src/mgmclient/main.cpp2
-rw-r--r--storage/ndb/src/mgmsrv/main.cpp2
-rw-r--r--storage/ndb/src/ndbapi/DictCache.cpp32
-rw-r--r--storage/ndb/test/ndbapi/testIndexStat.cpp6
-rw-r--r--storage/ndb/tools/restore/consumer_restore.cpp4
-rw-r--r--storage/perfschema/CMakeLists.txt7
-rw-r--r--storage/perfschema/Makefile.am6
-rw-r--r--storage/perfschema/ha_perfschema.cc15
-rw-r--r--storage/perfschema/ha_perfschema.h6
-rw-r--r--storage/perfschema/pfs.cc39
-rw-r--r--storage/perfschema/pfs.h9
-rw-r--r--storage/perfschema/pfs_atomic.cc6
-rw-r--r--storage/perfschema/pfs_atomic.h6
-rw-r--r--storage/perfschema/pfs_check.cc7
-rw-r--r--storage/perfschema/pfs_column_types.h6
-rw-r--r--storage/perfschema/pfs_column_values.cc7
-rw-r--r--storage/perfschema/pfs_column_values.h6
-rw-r--r--storage/perfschema/pfs_engine_table.cc74
-rw-r--r--storage/perfschema/pfs_engine_table.h29
-rw-r--r--storage/perfschema/pfs_events_waits.cc6
-rw-r--r--storage/perfschema/pfs_events_waits.h6
-rw-r--r--storage/perfschema/pfs_global.cc11
-rw-r--r--storage/perfschema/pfs_global.h62
-rw-r--r--storage/perfschema/pfs_instr.cc231
-rw-r--r--storage/perfschema/pfs_instr.h49
-rw-r--r--storage/perfschema/pfs_instr_class.cc6
-rw-r--r--storage/perfschema/pfs_instr_class.h7
-rw-r--r--storage/perfschema/pfs_lock.h6
-rw-r--r--storage/perfschema/pfs_server.cc7
-rw-r--r--storage/perfschema/pfs_server.h6
-rw-r--r--storage/perfschema/pfs_stat.h6
-rw-r--r--storage/perfschema/pfs_timer.cc6
-rw-r--r--storage/perfschema/pfs_timer.h6
-rw-r--r--storage/perfschema/plug.in6
-rw-r--r--storage/perfschema/table_all_instr.cc11
-rw-r--r--storage/perfschema/table_all_instr.h10
-rw-r--r--storage/perfschema/table_events_waits.cc11
-rw-r--r--storage/perfschema/table_events_waits.h8
-rw-r--r--storage/perfschema/table_events_waits_summary.cc12
-rw-r--r--storage/perfschema/table_events_waits_summary.h8
-rw-r--r--storage/perfschema/table_file_instances.cc12
-rw-r--r--storage/perfschema/table_file_instances.h8
-rw-r--r--storage/perfschema/table_file_summary.cc14
-rw-r--r--storage/perfschema/table_file_summary.h10
-rw-r--r--storage/perfschema/table_performance_timers.cc10
-rw-r--r--storage/perfschema/table_performance_timers.h8
-rw-r--r--storage/perfschema/table_processlist.cc11
-rw-r--r--storage/perfschema/table_processlist.h8
-rw-r--r--storage/perfschema/table_setup_consumers.cc9
-rw-r--r--storage/perfschema/table_setup_consumers.h6
-rw-r--r--storage/perfschema/table_setup_instruments.cc10
-rw-r--r--storage/perfschema/table_setup_instruments.h6
-rw-r--r--storage/perfschema/table_setup_timers.cc9
-rw-r--r--storage/perfschema/table_setup_timers.h6
-rw-r--r--storage/perfschema/table_sync_instances.cc16
-rw-r--r--storage/perfschema/table_sync_instances.h12
-rw-r--r--storage/perfschema/unittest/CMakeLists.txt6
-rw-r--r--storage/perfschema/unittest/conf.txt6
-rw-r--r--storage/perfschema/unittest/pfs-t.cc84
-rw-r--r--storage/perfschema/unittest/pfs_instr-oom-t.cc9
-rw-r--r--storage/perfschema/unittest/pfs_instr-t.cc9
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-oom-t.cc9
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-t.cc10
-rw-r--r--storage/perfschema/unittest/pfs_timer-t.cc8
-rw-r--r--storage/perfschema/unittest/stub_pfs_global.h6
-rw-r--r--storage/perfschema/unittest/stub_print_error.h6
-rw-r--r--[-rwxr-xr-x]strings/CMakeLists.txt2
-rw-r--r--strings/Makefile.am8
-rw-r--r--strings/bcmp.c66
-rw-r--r--strings/ctype-big5.c8
-rw-r--r--strings/ctype-cp932.c8
-rw-r--r--strings/ctype-czech.c8
-rw-r--r--strings/ctype-euc_kr.c8
-rw-r--r--strings/ctype-eucjpms.c8
-rw-r--r--strings/ctype-gb2312.c8
-rw-r--r--strings/ctype-gbk.c10
-rw-r--r--strings/ctype-simple.c13
-rw-r--r--strings/ctype-sjis.c8
-rw-r--r--strings/ctype-tis620.c8
-rw-r--r--strings/ctype-ujis.c8
-rw-r--r--strings/ctype-win1250ch.c16
-rw-r--r--strings/do_ctype.c16
-rw-r--r--strings/int2str.c4
-rw-r--r--strings/my_strtoll10.c11
-rw-r--r--strings/str_test.c10
-rw-r--r--strings/strtol.c2
-rw-r--r--strings/strtoul.c2
-rw-r--r--strings/xml.c8
-rw-r--r--support-files/CMakeLists.txt9
-rw-r--r--support-files/mysql.spec.sh257
-rw-r--r--[-rwxr-xr-x]tests/CMakeLists.txt2
-rw-r--r--tests/mysql_client_test.c88
-rw-r--r--tests/thread_test.c2
-rw-r--r--unittest/mysys/CMakeLists.txt2
-rw-r--r--unittest/mysys/Makefile.am2
-rw-r--r--unittest/mysys/my_malloc-t.c43
-rw-r--r--[-rwxr-xr-x]vio/CMakeLists.txt0
-rw-r--r--vio/test-ssl.c26
-rw-r--r--vio/test-sslclient.c6
-rw-r--r--vio/test-sslserver.c4
-rw-r--r--vio/vio.c6
-rw-r--r--vio/viossl.c30
-rw-r--r--vio/viosslfactories.c44
-rw-r--r--vio/viotest-ssl.c24
-rw-r--r--[-rwxr-xr-x]win/mysql_manifest.cmake0
-rw-r--r--[-rwxr-xr-x]zlib/CMakeLists.txt0
883 files changed, 23625 insertions, 16328 deletions
diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf
index df9a60f35ad..4eab3d239d0 100644
--- a/.bzr-mysql/default.conf
+++ b/.bzr-mysql/default.conf
@@ -1,4 +1,4 @@
[MYSQL]
-post_commit_to = commits@lists.mysql.com, innodb_dev_ww@oracle.com
-post_push_to = commits@lists.mysql.com, innodb_dev_ww@oracle.com
-tree_name = "mysql-trunk-innodb"
+post_commit_to = "commits@lists.mysql.com"
+post_push_to = "commits@lists.mysql.com"
+tree_name = "mysql-trunk-bugfixing"
diff --git a/.bzrignore b/.bzrignore
index 7733bd2aa7c..f5f678ca360 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -996,6 +996,8 @@ libmysqld/.deps/sql_crypt.Po
libmysqld/.deps/sql_cursor.Po
libmysqld/.deps/sql_db.Po
libmysqld/.deps/sql_delete.Po
+libmysqld/.deps/sql_truncate.Po
+libmysqld/.deps/datadict.Po
libmysqld/.deps/sql_derived.Po
libmysqld/.deps/sql_do.Po
libmysqld/.deps/sql_error.Po
@@ -1172,6 +1174,8 @@ libmysqld/sql_cursor.cc
libmysqld/sql_cursor.h
libmysqld/sql_db.cc
libmysqld/sql_delete.cc
+libmysqld/sql_truncate.cc
+libmysqld/datadict.cc
libmysqld/sql_derived.cc
libmysqld/sql_do.cc
libmysqld/sql_error.cc
@@ -2062,6 +2066,8 @@ sql/.deps/sql_crypt.Po
sql/.deps/sql_cursor.Po
sql/.deps/sql_db.Po
sql/.deps/sql_delete.Po
+sql/.deps/sql_truncate.Po
+sql/.deps/datadict.Po
sql/.deps/sql_derived.Po
sql/.deps/sql_do.Po
sql/.deps/sql_error.Po
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 0bc16f120e5..b5f1c7b200e 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -90,22 +90,19 @@ SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" != "xpedantic" ]; then
# Both C and C++ warnings
- warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
- warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
- warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
+ warnings="-Wall -Wextra -Wunused -Wwrite-strings"
# For more warnings, uncomment the following line
-# warnings="$global_warnings -Wshadow"
+# warnings="$warnings -Wshadow"
# C warnings
- c_warnings="$warnings -Wunused-parameter"
+ c_warnings="$warnings"
# C++ warnings
- cxx_warnings="$warnings"
+ cxx_warnings="$warnings -Wno-unused-parameter"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
- cxx_warnings="$cxx_warnings -Wreorder"
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
# Added unless --with-debug=full
- debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized"
+ debug_extra_cflags="-O0 -g3 -gdwarf-2"
else
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
c_warnings="$warnings"
@@ -128,7 +125,7 @@ valgrind_configs="--with-valgrind"
#
# Used in -debug builds
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
-debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
+debug_cflags="$debug_cflags -DSAFE_MUTEX"
error_inject="--with-error-inject "
#
# Base C++ flags for all builds
diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh
index 2d7c0d2a2c2..aae017aa54d 100755
--- a/BUILD/build_mccge.sh
+++ b/BUILD/build_mccge.sh
@@ -1066,7 +1066,6 @@ set_with_debug_flags()
if test "x$with_debug_flag" = "xyes" ; then
if test "x$developer_flag" = "xyes" ; then
loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
- loc_debug_flags="$loc_debug_flags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC"
compiler_flags="$compiler_flags $loc_debug_flags"
fi
fi
diff --git a/BUILD/check-cpu b/BUILD/check-cpu
index eb001ee61ae..f9f5d423f4f 100755
--- a/BUILD/check-cpu
+++ b/BUILD/check-cpu
@@ -187,69 +187,76 @@ check_cpu () {
cc=$CC
fi
- if test "x$compiler" = "x" ; then
- cc_ver=`$cc --version | sed 1q`
- cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
+ 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`
-
- 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
+ fi
- echo failed >&2
+ 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;
- done
- rm __test.*
- fi
- if test "x$core2" = "xyes" ; then
- cpu_arg="core2"
- fi
+ fi
+
+ echo failed >&2
+ check_cpu_cflags=""
+ break;
+ done
+ rm __test.*
return 0
}
-
+
check_cpu
diff --git a/BUILD/compile-ia64-debug-max b/BUILD/compile-ia64-debug-max
index 123bfb06300..e9b534c302e 100755
--- a/BUILD/compile-ia64-debug-max
+++ b/BUILD/compile-ia64-debug-max
@@ -4,5 +4,5 @@ gmake -k maintainer-clean || true
path=`dirname $0`
. "$path/autorun.sh"
-CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
+CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
gmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4c7f552e93..fed3d61be8f 100755..100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,8 +34,20 @@ ENDIF()
SET(CUSTOM_C_FLAGS $ENV{CFLAGS})
OPTION(WITH_DEBUG "Use dbug/safemutex" OFF)
-OPTION(WITH_DEBUG_FULL "Use dbug and safemalloc/safemutex. Slow" 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
+# set that will be compiled in; it's merely provided as a hint to
+# custom packaging steps.
+OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON)
+
+# Use a default manufacturer if no manufacturer was identified.
+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})
+ENDIF()
# We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
# which turns out to be not trivial, as this involves synchronization
@@ -92,6 +104,27 @@ IF(DEFINED ENV{CPPFLAGS})
ADD_DEFINITIONS($ENV{CPPFLAGS})
ENDIF()
+#
+# Control aspects of the development environment which are
+# specific to MySQL maintainers and developers.
+#
+OPTION(MYSQL_MAINTAINER_MODE "MySQL maintainer-specific development environment" OFF)
+# Whether the maintainer mode should be enabled.
+IF(MYSQL_MAINTAINER_MODE)
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(MY_MAINTAINER_C_WARNINGS "-Wall -Wextra -Wunused -Wwrite-strings -Werror"
+ CACHE STRING "C warning options used in maintainer builds.")
+ ENDIF()
+ IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_C_WARNINGS} -Wno-unused-parameter"
+ CACHE STRING "C++ warning options used in maintainer builds.")
+ ENDIF()
+ # Do not make warnings in checks into errors.
+ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error")
+ ENDIF()
+ENDIF()
+
# Add macros
INCLUDE(character_sets)
INCLUDE(zlib)
@@ -135,9 +168,9 @@ IF(WITH_ERROR_INJECT)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DERROR_INJECT_SUPPORT")
ENDIF()
-OPTION(ENABLE_LOCAL_INFILE
+OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
-MARK_AS_ADVANCED(ENABLE_LOCAL_INFILE)
+MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF)
MARK_AS_ADVANCED(WITH_FAST_MUTEXES)
@@ -166,14 +199,13 @@ IF(NOT CMAKE_BUILD_TYPE
ENDIF()
ENDIF()
-# Add safemalloc and safemutex for debug condifurations, except on Windows
-# (C runtime library provides safemalloc functionality and safemutex has never
-# worked there)
+# Add safemutex for debug configurations, except on Windows
+# (safemutex has never worked on Windows)
IF(WITH_DEBUG OR WITH_DEBUG_FULL AND NOT WIN32)
FOREACH(LANG C CXX)
IF(WITH_DEBUG_FULL)
SET(CMAKE_${LANG}_FLAGS_DEBUG
- "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+ "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
ELSE()
SET(CMAKE_${LANG}_FLAGS_DEBUG
"${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
@@ -218,6 +250,19 @@ MYSQL_CHECK_SSL()
# Add readline or libedit.
MYSQL_CHECK_READLINE()
+#
+# Setup maintainer mode options by the end. Platform checks are
+# not run with the warning options as to not perturb fragile checks
+# (i.e. do not make warnings into errors).
+#
+IF(MYSQL_MAINTAINER_MODE)
+ # Set compiler flags required under maintainer mode.
+ MESSAGE(STATUS "C warning options: ${MY_MAINTAINER_C_WARNINGS}")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}")
+ MESSAGE(STATUS "C++ warning options: ${MY_MAINTAINER_CXX_WARNINGS}")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}")
+ENDIF()
+
IF(NOT WITHOUT_SERVER)
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
# Add storage engines and plugins.
@@ -280,6 +325,7 @@ IF(WIN32)
ELSE()
SET(CPACK_GENERATOR "TGZ")
ENDIF()
+ADD_SUBDIRECTORY(packaging/WiX)
INCLUDE(CPack)
IF(UNIX)
INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL)
diff --git a/Makefile.am b/Makefile.am
index 91174568026..297e923905e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,7 +27,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@pstack_dir@ libservices \
@sql_union_dirs@ unittest \
@sql_server@ @man_dirs@ tests \
- netware @libmysqld_dirs@ \
+ @libmysqld_dirs@ \
mysql-test support-files sql-bench \
win \
cmake
@@ -36,7 +36,7 @@ DIST_SUBDIRS = . include Docs zlib \
pstack libservices \
strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
vio sql man tests \
- netware libmysqld \
+ libmysqld \
mysql-test support-files sql-bench \
win \
cmake \
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index f4e223c9c72..d0bb8d43edd 100755..100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -33,7 +33,7 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(mysql ${READLINE_LIBRARY})
ENDIF(UNIX)
-MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc)
+MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqltest mysqlclient regex)
diff --git a/client/client_priv.h b/client/client_priv.h
index b0991c0134f..e7911fc31f7 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -60,7 +60,7 @@ enum options_client
OPT_IMPORT_USE_THREADS,
OPT_MYSQL_NUMBER_OF_QUERY,
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
- OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
+ OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA,
OPT_MYSQLDUMP_SLAVE_APPLY,
OPT_MYSQLDUMP_SLAVE_DATA,
OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT,
diff --git a/client/completion_hash.cc b/client/completion_hash.cc
index cd0ea17dfaf..dc7f0329db8 100644
--- a/client/completion_hash.cc
+++ b/client/completion_hash.cc
@@ -22,7 +22,6 @@
#include <my_global.h>
#include <m_string.h>
-#undef SAFEMALLOC // Speed things up
#include <my_sys.h>
#include "completion_hash.h"
@@ -213,7 +212,7 @@ void completion_hash_clean(HashTable *ht)
void completion_hash_free(HashTable *ht)
{
completion_hash_clean(ht);
- my_free(ht->arBuckets, MYF(0));
+ my_free(ht->arBuckets);
}
diff --git a/client/mysql.cc b/client/mysql.cc
index 58ef51f3fff..abf01d8127d 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -88,10 +88,9 @@ extern "C" {
#endif
#endif
-#undef bcmp // Fix problem with new readline
#if defined(__WIN__)
#include <conio.h>
-#elif !defined(__NETWARE__)
+#else
#include <readline/readline.h>
#define HAVE_READLINE
#endif
@@ -109,7 +108,7 @@ extern "C" {
#define cmp_database(cs,A,B) strcmp((A),(B))
#endif
-#if !defined(__WIN__) && !defined(__NETWARE__) && !defined(THREAD)
+#if !defined(__WIN__) && !defined(THREAD)
#define USE_POPEN
#endif
@@ -1205,7 +1204,7 @@ int main(int argc,char *argv[])
strncmp(link_name, "/dev/null", 10) == 0)
{
/* The .mysql_history file is a symlink to /dev/null, don't use it */
- my_free(histfile, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(histfile);
histfile= 0;
}
}
@@ -1266,23 +1265,23 @@ sig_handler mysql_end(int sig)
glob_buffer.free();
old_buffer.free();
processed_prompt.free();
- my_free(server_version,MYF(MY_ALLOW_ZERO_PTR));
- my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR));
- my_free(histfile,MYF(MY_ALLOW_ZERO_PTR));
- my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR));
- my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
- my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
- my_free(current_user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(full_username,MYF(MY_ALLOW_ZERO_PTR));
- my_free(part_username,MYF(MY_ALLOW_ZERO_PTR));
- my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(server_version);
+ my_free(opt_password);
+ my_free(opt_mysql_unix_port);
+ my_free(histfile);
+ my_free(histfile_tmp);
+ my_free(current_db);
+ my_free(current_host);
+ my_free(current_user);
+ my_free(full_username);
+ my_free(part_username);
+ my_free(default_prompt);
#ifdef HAVE_SMEM
- my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(shared_memory_base_name);
#endif
- my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(current_prompt);
while (embedded_server_arg_count > 1)
- my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
+ my_free(embedded_server_args[--embedded_server_arg_count]);
mysql_server_end();
free_defaults(defaults_argv);
my_end(my_end_arg);
@@ -1365,10 +1364,6 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0},
{"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"auto-rehash", OPT_AUTO_REHASH,
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table "
"and field completion, but startup and reconnecting may take a longer time. "
@@ -1582,11 +1577,6 @@ static struct my_option my_long_options[] =
static void usage(int version)
{
- /* Divert all help information on NetWare to logger screen. */
-#ifdef __NETWARE__
-#define printf consoleprintf
-#endif
-
#if defined(USE_LIBEDIT_INTERFACE)
const char* readline= "";
#else
@@ -1609,10 +1599,6 @@ static void usage(int version)
my_print_help(my_long_options);
print_defaults("my", load_default_groups);
my_print_variables(my_long_options);
- NETWARE_SET_SCREEN_MODE(1);
-#ifdef __NETWARE__
-#undef printf
-#endif
}
@@ -1621,11 +1607,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch(optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case OPT_CHARSETS_DIR:
strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1);
charsets_dir = mysql_charsets_dir;
@@ -1736,7 +1717,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument)
{
char *start= argument;
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
opt_password= my_strdup(argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; // Destroy argument
if (*start)
@@ -1833,7 +1814,7 @@ static int get_options(int argc, char **argv)
if (argc == 1)
{
skip_updates= 0;
- my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(current_db);
current_db= my_strdup(*argv, MYF(MY_WME));
}
if (tty_password)
@@ -1851,10 +1832,6 @@ static int get_options(int argc, char **argv)
static int read_and_execute(bool interactive)
{
-#if defined(__NETWARE__)
- char linebuffer[254];
- String buffer;
-#endif
#if defined(__WIN__)
String tmpbuf;
String buffer;
@@ -1900,18 +1877,8 @@ static int read_and_execute(bool interactive)
if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE);
-#if defined(__WIN__) || defined(__NETWARE__)
+#if defined(__WIN__)
tee_fputs(prompt, stdout);
-#if defined(__NETWARE__)
- line=fgets(linebuffer, sizeof(linebuffer)-1, stdin);
- /* Remove the '\n' */
- if (line)
- {
- char *p = strrchr(line, '\n');
- if (p != NULL)
- *p = '\0';
- }
-#else
if (!tmpbuf.is_alloced())
tmpbuf.alloc(65535);
tmpbuf.length(0);
@@ -1932,12 +1899,11 @@ static int read_and_execute(bool interactive)
*/
if (line)
line= buffer.c_ptr();
-#endif /* __NETWARE__ */
#else
if (opt_outfile)
fputs(prompt, OUTFILE);
line= readline(prompt);
-#endif /* defined(__WIN__) || defined(__NETWARE__) */
+#endif /* defined(__WIN__) */
/*
When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS
@@ -1985,10 +1951,8 @@ static int read_and_execute(bool interactive)
}
}
-#if defined(__WIN__) || defined(__NETWARE__)
- buffer.free();
-#endif
#if defined(__WIN__)
+ buffer.free();
tmpbuf.free();
#endif
@@ -2731,7 +2695,7 @@ static void get_current_db()
{
MYSQL_RES *res;
- my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(current_db);
current_db= NULL;
/* In case of error below current_db will be NULL */
if (!mysql_query(&mysql, "SELECT DATABASE()") &&
@@ -3945,8 +3909,6 @@ static int
com_quit(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
{
- /* let the screen auto close on a normal shutdown */
- NETWARE_SET_SCREEN_MODE(SCR_AUTOCLOSE_ON_EXIT);
status.exit_status=0;
return 1;
}
@@ -4023,12 +3985,12 @@ com_connect(String *buffer, char *line)
tmp= get_arg(buff, 0);
if (tmp && *tmp)
{
- my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(current_db);
current_db= my_strdup(tmp, MYF(MY_WME));
tmp= get_arg(buff, 1);
if (tmp)
{
- my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(current_host);
current_host=my_strdup(tmp,MYF(MY_WME));
}
}
@@ -4200,7 +4162,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
if (mysql_select_db(&mysql,tmp))
return put_error(&mysql);
}
- my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(current_db);
current_db=my_strdup(tmp,MYF(MY_WME));
#ifdef HAVE_READLINE
if (select_db > 1)
@@ -4664,7 +4626,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...)
{
va_list args;
- NETWARE_YIELD;
va_start(args, fmt);
(void) vfprintf(file, fmt, args);
va_end(args);
@@ -4680,7 +4641,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...)
void tee_fputs(const char *s, FILE *file)
{
- NETWARE_YIELD;
fputs(s, file);
if (opt_outfile)
fputs(s, OUTFILE);
@@ -4689,7 +4649,6 @@ void tee_fputs(const char *s, FILE *file)
void tee_puts(const char *s, FILE *file)
{
- NETWARE_YIELD;
fputs(s, file);
fputc('\n', file);
if (opt_outfile)
@@ -4706,7 +4665,7 @@ void tee_putc(int c, FILE *file)
putc(c, OUTFILE);
}
-#if defined(__WIN__) || defined(__NETWARE__)
+#if defined(__WIN__)
#include <time.h>
#else
#include <sys/times.h>
@@ -4718,8 +4677,8 @@ void tee_putc(int c, FILE *file)
static ulong start_timer(void)
{
-#if defined(__WIN__) || defined(__NETWARE__)
- return clock();
+#if defined(__WIN__)
+ return clock();
#else
struct tms tms_tmp;
return times(&tms_tmp);
@@ -4952,8 +4911,8 @@ static void add_int_to_prompt(int toadd)
static void init_username()
{
- my_free(full_username,MYF(MY_ALLOW_ZERO_PTR));
- my_free(part_username,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(full_username);
+ my_free(part_username);
MYSQL_RES *result;
LINT_INIT(result);
@@ -4971,7 +4930,7 @@ static int com_prompt(String *buffer, char *line)
{
char *ptr=strchr(line, ' ');
prompt_counter = 0;
- my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(current_prompt);
current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME));
if (!ptr)
tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt);
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 0ad44f3d20d..20436200c7e 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -57,8 +57,6 @@ static my_bool not_used; /* Can't use GET_BOOL without a value pointer */
static my_bool opt_write_binlog;
-#include <help_start.h>
-
static struct my_option my_long_options[]=
{
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
@@ -139,8 +137,6 @@ static struct my_option my_long_options[]=
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-#include <help_end.h>
-
static void free_used_memory(void)
{
@@ -809,9 +805,6 @@ int main(int argc, char **argv)
char self_name[FN_REFLEN];
MY_INIT(argv[0]);
-#ifdef __NETWARE__
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
-#endif
#if __WIN__
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 64371224e2b..69381b749a1 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -116,10 +116,6 @@ static TYPELIB command_typelib=
static struct my_option my_long_options[] =
{
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"count", 'c',
"Number of iterations to make. This works with -i (--sleep) only.",
&nr_iterations, &nr_iterations, 0, GET_UINT,
@@ -222,11 +218,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int error = 0;
switch(optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case 'c':
opt_count_iterations= 1;
break;
@@ -236,7 +227,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument)
{
char *start=argument;
- my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
opt_password=my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@@ -448,10 +439,10 @@ int main(int argc,char *argv[])
} /* got connection */
mysql_close(&mysql);
- my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(user,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
+ my_free(user);
#ifdef HAVE_SMEM
- my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(shared_memory_base_name);
#endif
free_defaults(save_argv);
my_end(my_end_arg);
@@ -1008,8 +999,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
/* free up memory from prompted password */
if (typed_password != argv[1])
{
- my_free(typed_password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(verified,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(typed_password);
+ my_free(verified);
}
argc--; argv++;
break;
@@ -1068,13 +1059,11 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return 0;
}
-#include <help_start.h>
static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s on %s\n",my_progname,ADMIN_VERSION,
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
}
@@ -1118,7 +1107,6 @@ static void usage(void)
version Get version info from server");
}
-#include <help_end.h>
static int drop_db(MYSQL *mysql, const char *db)
{
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 9d85e24d03f..277c2d62544 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -68,20 +68,20 @@ TYPELIB base64_output_mode_typelib=
{ array_elements(base64_output_mode_names) - 1, "",
base64_output_mode_names, NULL };
static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC;
-static const char *opt_base64_output_mode_str= NullS;
-static const char* database= 0;
+static char *opt_base64_output_mode_str= NullS;
+static char* database= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
static my_bool debug_info_flag, debug_check_flag;
static my_bool force_if_open_opt= 1;
static ulonglong offset = 0;
-static const char* host = 0;
+static char* host = 0;
static int port= 0;
static uint my_end_arg;
static const char* sock= 0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name= 0;
#endif
-static const char* user = 0;
+static char* user = 0;
static char* pass = 0;
static char *charset= 0;
@@ -96,7 +96,7 @@ static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX;
static ulonglong rec_count= 0;
static short binlog_flags = 0;
static MYSQL* mysql = NULL;
-static const char* dirname_for_local_load= 0;
+static char* dirname_for_local_load= 0;
/**
Pointer to the Format_description_log_event of the currently active binlog.
@@ -191,7 +191,7 @@ public:
int init()
{
return init_dynamic_array(&file_names, sizeof(File_name_record),
- 100,100 CALLER_INFO);
+ 100, 100);
}
void init_by_dir_name(const char *dir)
@@ -213,7 +213,7 @@ public:
{
if (ptr->fname)
{
- my_free(ptr->fname, MYF(MY_WME));
+ my_free(ptr->fname);
delete ptr->event;
bzero((char *)ptr, sizeof(File_name_record));
}
@@ -436,13 +436,13 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
ptr= fname + target_dir_name_len;
memcpy(ptr,bname,blen);
ptr+= blen;
- ptr+= my_sprintf(ptr, (ptr, "-%x", file_id));
+ ptr+= sprintf(ptr, "-%x", file_id);
if ((file= create_unique_file(fname,ptr)) < 0)
{
error("Could not construct local filename %s%s.",
target_dir_name,bname);
- my_free(fname, MYF(0));
+ my_free(fname);
delete ce;
DBUG_RETURN(ERROR_STOP);
}
@@ -458,7 +458,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
if (set_dynamic(&file_names, (uchar*)&rec, file_id))
{
error("Out of memory.");
- my_free(fname, MYF(0));
+ my_free(fname);
delete ce;
DBUG_RETURN(ERROR_STOP);
}
@@ -822,7 +822,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
*/
convert_path_to_forward_slashes((char*) ce->fname);
ce->print(result_file, print_event_info, TRUE);
- my_free((char*)ce->fname,MYF(MY_WME));
+ my_free((void*)ce->fname);
delete ce;
}
else
@@ -887,7 +887,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
}
if (fname)
- my_free(fname, MYF(MY_WME));
+ my_free(fname);
break;
}
case TABLE_MAP_EVENT:
@@ -1002,10 +1002,6 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"base64-output", OPT_BASE64_OUTPUT_MODE,
/* 'unspec' is not mentioned because it is just a placeholder. */
"Determine when the output statements should be base64-encoded BINLOG "
@@ -1222,23 +1218,21 @@ static void warning(const char *format,...)
*/
static void cleanup()
{
- my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) database, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) host, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) user, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) dirname_for_local_load, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(pass);
+ my_free(database);
+ my_free(host);
+ my_free(user);
+ my_free(dirname_for_local_load);
delete glob_description_event;
if (mysql)
mysql_close(mysql);
}
-#include <help_start.h>
static void print_version()
{
printf("%s Ver 3.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
}
@@ -1280,7 +1274,6 @@ static my_time_t convert_str_to_timestamp(const char* str)
my_system_gmt_sec(&l_time, &dummy_my_timezone, &dummy_in_dst_time_gap);
}
-#include <help_end.h>
extern "C" my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
@@ -1288,11 +1281,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
{
bool tty_password=0;
switch (optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
#ifndef DBUG_OFF
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);
@@ -1306,7 +1294,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
argument= (char*) ""; // Don't require password
if (argument)
{
- my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(pass);
char *start=argument;
pass= my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
@@ -2032,6 +2020,7 @@ int main(int argc, char** argv)
{
usage();
free_defaults(defaults_argv);
+ my_end(my_end_arg);
exit(1);
}
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 1fc9f179895..ce733e57db6 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -62,10 +62,6 @@ static struct my_option my_long_options[] =
"Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.",
&opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"auto-repair", OPT_AUTO_REPAIR,
"If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.",
&opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
@@ -208,13 +204,11 @@ static uint fixed_name_length(const char *name);
static char *fix_table_name(char *dest, char *src);
int what_to_do = 0;
-#include <help_start.h>
static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, CHECK_VERSION,
MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
} /* print_version */
@@ -245,18 +239,12 @@ static void usage(void)
my_print_variables(my_long_options);
} /* usage */
-#include <help_end.h>
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch(optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case 'a':
what_to_do = DO_ANALYZE;
break;
@@ -291,7 +279,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument)
{
char *start = argument;
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
opt_password = my_strdup(argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@@ -470,7 +458,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
}
*--end = 0;
handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1));
- my_free(table_names_comma_sep, MYF(0));
+ my_free(table_names_comma_sep);
}
else
for (; tables > 0; tables--, table_names++)
@@ -569,7 +557,7 @@ static int process_all_tables_in_db(char *database)
*--end = 0;
if (tot_length)
handle_request_for_tables(tables + 1, tot_length - 1);
- my_free(tables, MYF(0));
+ my_free(tables);
}
else
{
@@ -708,8 +696,7 @@ static int handle_request_for_tables(char *tables, uint length)
if (opt_all_in_1)
{
/* No backticks here as we added them before */
- query_length= my_sprintf(query,
- (query, "%s TABLE %s %s", op, tables, options));
+ query_length= sprintf(query, "%s TABLE %s %s", op, tables, options);
}
else
{
@@ -727,7 +714,7 @@ static int handle_request_for_tables(char *tables, uint length)
return 1;
}
print_result();
- my_free(query, MYF(0));
+ my_free(query);
return 0;
}
@@ -899,9 +886,9 @@ int main(int argc, char **argv)
dbDisconnect(current_host);
if (opt_auto_repair)
delete_dynamic(&tables4repair);
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
#ifdef HAVE_SMEM
- my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(shared_memory_base_name);
#endif
my_end(my_end_arg);
return(first_error!=0);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 2d92f0891eb..68cfde864b5 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -212,10 +212,6 @@ static struct my_option my_long_options[] =
"Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.",
&opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -433,10 +429,10 @@ static struct my_option my_long_options[] =
&opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r',
- "Direct output to a given file. This option should be used in MSDOS, "
- "because it prevents new line '\\n' from being converted to '\\r\\n' "
- "(carriage return + line feed).",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Direct output to a given file. This option should be used in systems "
+ "(e.g., DOS, Windows) that use carriage-return linefeed pairs (\\r\\n) "
+ "to separate text lines. This option ensures that only a single newline "
+ "is used.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"routines", 'R', "Dump stored routines (functions and procedures).",
&opt_routines, &opt_routines, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -531,7 +527,6 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
static int dump_tablespaces_for_databases(char** databases);
static int dump_tablespaces(char* ts_where);
-#include <help_start.h>
/*
Print the supplied message if in verbose mode
@@ -575,7 +570,6 @@ static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION,
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
} /* print_version */
@@ -585,7 +579,6 @@ static void short_usage_sub(void)
printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n",
my_progname);
printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname);
- NETWARE_SET_SCREEN_MODE(1);
}
@@ -608,8 +601,6 @@ static void short_usage(void)
printf("For more options, use %s --help\n", my_progname);
}
-#include <help_end.h>
-
static void write_header(FILE *sql_file, char *db_name)
{
@@ -715,12 +706,6 @@ static void write_footer(FILE *sql_file)
} /* write_footer */
-static void free_table_ent(char *key)
-{
- my_free(key, MYF(0));
-}
-
-
uchar* get_table_key(const char *entry, size_t *length,
my_bool not_used __attribute__((unused)))
{
@@ -734,18 +719,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; /* Don't require password */
if (argument)
{
char *start=argument;
- my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
opt_password=my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@@ -905,8 +885,7 @@ static int get_options(int *argc, char ***argv)
defaults_argv= *argv;
if (my_hash_init(&ignore_table, charset_info, 16, 0, 0,
- (my_hash_get_key) get_table_key,
- (my_hash_free_key) free_table_ent, 0))
+ (my_hash_get_key) get_table_key, my_free, 0))
return(EX_EOM);
/* Don't copy internal log tables */
if (my_hash_insert(&ignore_table,
@@ -1420,7 +1399,7 @@ static void free_resources()
{
if (md_result_file && md_result_file != stdout)
my_fclose(md_result_file, MYF(0));
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
if (my_hash_inited(&ignore_table))
my_hash_free(&ignore_table);
if (extended_insert)
@@ -1534,7 +1513,7 @@ static void unescape(FILE *file,char *pos,uint length)
fputs(tmp, file);
fputc('\'', file);
check_io(file);
- my_free(tmp, MYF(MY_WME));
+ my_free(tmp);
DBUG_VOID_RETURN;
} /* unescape */
@@ -2201,7 +2180,7 @@ static uint dump_routines_for_db(char *db)
}
}
- my_free(query_str, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(query_str);
}
} /* end of routine printing */
mysql_free_result(routine_res);
@@ -2374,12 +2353,12 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (mysql_errno(mysql) == ER_VIEW_INVALID)
fprintf(sql_file, "\n-- failed on view %s: %s\n\n", result_table, scv_buff ? scv_buff : "");
- my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(scv_buff);
DBUG_RETURN(0);
}
else
- my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(scv_buff);
if (mysql_num_rows(result))
{
@@ -2855,7 +2834,7 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
DBUG_RETURN(TRUE);
}
- my_free(query_str, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(query_str);
}
DBUG_RETURN(FALSE);
@@ -4073,7 +4052,7 @@ static int dump_all_tables_in_db(char *database)
if (include_table((uchar*) hash_key, end - hash_key))
{
dump_table(table,database);
- my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(order_by);
order_by= 0;
if (opt_dump_triggers && ! opt_xml &&
mysql_get_server_version(mysql) >= 50009)
@@ -4345,7 +4324,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
dump_routines_for_db(db);
}
free_root(&root, MYF(0));
- my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(order_by);
order_by= 0;
if (opt_xml)
{
@@ -5258,7 +5237,7 @@ int main(int argc, char **argv)
goto err;
#ifdef HAVE_SMEM
- my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(shared_memory_base_name);
#endif
/*
No reason to explicitely COMMIT the transaction, neither to explicitely
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 3bf17cb1df7..3d71e437e40 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -67,10 +67,6 @@ static char *shared_memory_base_name=0;
static struct my_option my_long_options[] =
{
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -184,13 +180,11 @@ static struct my_option my_long_options[] =
static const char *load_default_groups[]= { "mysqlimport","client",0 };
-#include <help_start.h>
static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n" ,my_progname,
IMPORT_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
}
@@ -212,25 +206,19 @@ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n");
my_print_variables(my_long_options);
}
-#include <help_end.h>
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch(optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; /* Don't require password */
if (argument)
{
char *start=argument;
- my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
opt_password=my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@@ -684,9 +672,9 @@ int main(int argc, char **argv)
exitcode= error;
db_disconnect(current_host, mysql);
}
- my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
#ifdef HAVE_SMEM
- my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(shared_memory_base_name);
#endif
free_defaults(argv_to_free);
my_end(my_end_arg);
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index d8561d13b81..bb05400e0d8 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -149,10 +149,9 @@ int main(int argc, char **argv)
break;
}
mysql_close(&mysql); /* Close & free connection */
- if (opt_password)
- my_free(opt_password,MYF(0));
+ my_free(opt_password);
#ifdef HAVE_SMEM
- my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(shared_memory_base_name);
#endif
my_end(my_end_arg);
exit(error ? 1 : 0);
@@ -161,10 +160,6 @@ int main(int argc, char **argv)
static struct my_option my_long_options[] =
{
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"character-sets-dir", 'c', "Directory for character set files.",
&charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
@@ -241,14 +236,11 @@ static struct my_option my_long_options[] =
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-
-#include <help_start.h>
static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,SHOW_VERSION,
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
}
@@ -271,18 +263,12 @@ are shown.");
my_print_variables(my_long_options);
}
-#include <help_end.h>
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch(optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case 'v':
opt_verbose++;
break;
@@ -292,7 +278,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument)
{
char *start=argument;
- my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
opt_password=my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@@ -671,8 +657,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
char query[1024],*end;
MYSQL_RES *result;
MYSQL_ROW row;
- ulong rows;
- LINT_INIT(rows);
+ ulong UNINIT_VAR(rows);
if (mysql_select_db(mysql,db))
{
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 714a8cb9039..e605e2d522c 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -399,10 +399,8 @@ int main(int argc, char **argv)
mysql_close(&mysql); /* Close & free connection */
/* now free all the strings we created */
- if (opt_password)
- my_free(opt_password, MYF(0));
-
- my_free(concurrency, MYF(0));
+ my_free(opt_password);
+ my_free(concurrency);
statement_cleanup(create_statements);
statement_cleanup(query_statements);
@@ -411,8 +409,7 @@ int main(int argc, char **argv)
option_cleanup(engine_options);
#ifdef HAVE_SMEM
- if (shared_memory_base_name)
- my_free(shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(shared_memory_base_name);
#endif
free_defaults(defaults_argv);
my_end(my_end_arg);
@@ -504,7 +501,7 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
if (opt_csv_str)
print_conclusions_csv(&conclusion);
- my_free(head_sptr, MYF(0));
+ my_free(head_sptr);
}
@@ -679,8 +676,6 @@ static struct my_option my_long_options[] =
};
-#include <help_start.h>
-
static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname, SLAP_VERSION,
@@ -699,7 +694,6 @@ static void usage(void)
my_print_help(my_long_options);
}
-#include <help_end.h>
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
@@ -707,11 +701,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
{
DBUG_ENTER("get_one_option");
switch(optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case 'v':
verbose++;
break;
@@ -721,7 +710,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument)
{
char *start= argument;
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
opt_password= my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@@ -1367,7 +1356,7 @@ get_options(int *argc,char ***argv)
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
parse_delimiter(tmp_string, &create_statements, delimiter[0]);
- my_free(tmp_string, MYF(0));
+ my_free(tmp_string);
}
else if (create_string)
{
@@ -1396,7 +1385,7 @@ get_options(int *argc,char ***argv)
if (user_supplied_query)
actual_queries= parse_delimiter(tmp_string, &query_statements,
delimiter[0]);
- my_free(tmp_string, MYF(0));
+ my_free(tmp_string);
}
else if (user_supplied_query)
{
@@ -1427,7 +1416,7 @@ get_options(int *argc,char ***argv)
if (user_supplied_pre_statements)
(void)parse_delimiter(tmp_string, &pre_statements,
delimiter[0]);
- my_free(tmp_string, MYF(0));
+ my_free(tmp_string);
}
else if (user_supplied_pre_statements)
{
@@ -1458,7 +1447,7 @@ get_options(int *argc,char ***argv)
if (user_supplied_post_statements)
(void)parse_delimiter(tmp_string, &post_statements,
delimiter[0]);
- my_free(tmp_string, MYF(0));
+ my_free(tmp_string);
}
else if (user_supplied_post_statements)
{
@@ -1555,9 +1544,9 @@ drop_primary_key_list(void)
if (primary_keys_number_of)
{
for (counter= 0; counter < primary_keys_number_of; counter++)
- my_free(primary_keys[counter], MYF(0));
+ my_free(primary_keys[counter]);
- my_free(primary_keys, MYF(0));
+ my_free(primary_keys);
}
return 0;
@@ -2154,11 +2143,9 @@ option_cleanup(option_string *stmt)
for (ptr= stmt; ptr; ptr= nptr)
{
nptr= ptr->next;
- if (ptr->string)
- my_free(ptr->string, MYF(0));
- if (ptr->option)
- my_free(ptr->option, MYF(0));
- my_free(ptr, MYF(0));
+ my_free(ptr->string);
+ my_free(ptr->option);
+ my_free(ptr);
}
}
@@ -2172,9 +2159,8 @@ statement_cleanup(statement *stmt)
for (ptr= stmt; ptr; ptr= nptr)
{
nptr= ptr->next;
- if (ptr->string)
- my_free(ptr->string, MYF(0));
- my_free(ptr, MYF(0));
+ my_free(ptr->string);
+ my_free(ptr);
}
}
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 75b23ea9af7..c8ec6c981ef 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -84,10 +84,10 @@ static my_bool get_one_option(int optid, const struct my_option *,
C_MODE_END
enum {
- OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
- OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
- OPT_MAX_CONNECT_RETRIES, OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS,
- OPT_LOG_DIR, OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION
+ OPT_PS_PROTOCOL=OPT_MAX_CLIENT_OPTION, OPT_SP_PROTOCOL,
+ OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, OPT_MAX_CONNECT_RETRIES,
+ OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS, OPT_LOG_DIR,
+ OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION
};
static int record= 0, opt_sleep= -1;
@@ -156,7 +156,7 @@ static struct st_block *cur_block, *block_stack_end;
struct st_test_file
{
FILE* file;
- const char *file_name;
+ char *file_name;
uint lineno; /* Current line in file */
};
@@ -1106,9 +1106,9 @@ void close_connections()
mysql_close(&next_con->mysql);
if (next_con->util_mysql)
mysql_close(next_con->util_mysql);
- my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(next_con->name);
}
- my_free(connections, MYF(MY_WME));
+ my_free(connections);
DBUG_VOID_RETURN;
}
@@ -1137,7 +1137,7 @@ void close_files()
DBUG_PRINT("info", ("closing file: %s", cur_file->file_name));
fclose(cur_file->file);
}
- my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(cur_file->file_name);
cur_file->file_name= 0;
}
DBUG_VOID_RETURN;
@@ -1157,22 +1157,22 @@ void free_used_memory()
for (i= 0 ; i < q_lines.elements ; i++)
{
struct st_command **q= dynamic_element(&q_lines, i, struct st_command**);
- my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((*q)->query_buf);
if ((*q)->content.str)
dynstr_free(&(*q)->content);
- my_free((*q),MYF(0));
+ my_free((*q));
}
for (i= 0; i < 10; i++)
{
if (var_reg[i].alloced_len)
- my_free(var_reg[i].str_val, MYF(MY_WME));
+ my_free(var_reg[i].str_val);
}
while (embedded_server_arg_count > 1)
- my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
+ my_free(embedded_server_args[--embedded_server_arg_count]);
delete_dynamic(&q_lines);
dynstr_free(&ds_res);
free_all_replace();
- my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_pass);
free_defaults(default_argv);
free_re();
#ifdef __WIN__
@@ -1933,9 +1933,10 @@ static uchar *get_var_key(const uchar* var, size_t *len,
static void var_free(void *v)
{
- my_free(((VAR*) v)->str_val, MYF(MY_WME));
- if (((VAR*)v)->alloced)
- my_free(v, MYF(MY_WME));
+ VAR *var= (VAR*) v;
+ my_free(var->str_val);
+ if (var->alloced)
+ my_free(var);
}
C_MODE_END
@@ -3706,7 +3707,6 @@ void do_send_quit(struct st_command *command)
void do_change_user(struct st_command *command)
{
MYSQL *mysql = &cur_con->mysql;
- /* static keyword to make the NetWare compiler happy. */
static DYNAMIC_STRING ds_user, ds_passwd, ds_db;
const struct command_arg change_user_args[] = {
{ "user", ARG_STRING, FALSE, &ds_user, "User to connect as" },
@@ -4824,7 +4824,7 @@ void do_close_connection(struct st_command *command)
con->util_mysql= 0;
con->pending= FALSE;
- my_free(con->name, MYF(0));
+ my_free(con->name);
/*
When the connection is closed set name to "-closed_connection-"
@@ -5491,7 +5491,7 @@ int read_line(char *buf, int size)
fclose(cur_file->file);
cur_file->file= 0;
}
- my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(cur_file->file_name);
cur_file->file_name= 0;
if (cur_file == file_stack)
{
@@ -5827,7 +5827,7 @@ int read_command(struct st_command** command_ptr)
(struct st_command*) my_malloc(sizeof(*command),
MYF(MY_WME|MY_ZEROFILL))) ||
insert_dynamic(&q_lines, (uchar*) &command))
- die(NullS);
+ die("Out of memory");
command->type= Q_UNKNOWN;
read_command_buf[0]= 0;
@@ -5967,9 +5967,6 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
&silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
- "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
- 0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Always sleep this many seconds on sleep commands.",
&opt_sleep, &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, -1, 0,
0, 0, 0},
@@ -6008,8 +6005,6 @@ static struct my_option my_long_options[] =
};
-#include <help_start.h>
-
void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,MTEST_VERSION,
@@ -6028,8 +6023,6 @@ void usage()
my_print_variables(my_long_options);
}
-#include <help_end.h>
-
/*
Read arguments for embedded server and put them into
@@ -6125,7 +6118,7 @@ get_one_option(int optid, const struct my_option *, char *argument)
argument= (char*) ""; // Don't require password
if (argument)
{
- my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_pass);
opt_pass= my_strdup(argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
tty_password= 0;
@@ -6158,11 +6151,6 @@ get_one_option(int optid, const struct my_option *, char *argument)
case 'F':
read_embedded_server_arguments(argument);
break;
- case OPT_SKIP_SAFEMALLOC:
-#ifdef SAFEMALLOC
- sf_malloc_quick=1;
-#endif
- break;
case OPT_RESULT_FORMAT_VERSION:
set_result_format_version(opt_result_format_version);
break;
@@ -6321,12 +6309,12 @@ void init_win_path_patterns()
/* Don't insert zero length strings in patterns array */
if (strlen(p) == 0)
{
- my_free(p, MYF(0));
+ my_free(p);
continue;
}
if (insert_dynamic(&patterns, (uchar*) &p))
- die(NullS);
+ die("Out of memory");
DBUG_PRINT("info", ("p: %s", p));
while (*p)
@@ -6345,7 +6333,7 @@ void free_win_path_patterns()
for (i=0 ; i < patterns.elements ; i++)
{
const char** pattern= dynamic_element(&patterns, i, const char**);
- my_free((char*) *pattern, MYF(0));
+ my_free((void *) *pattern);
}
delete_dynamic(&patterns);
}
@@ -6538,12 +6526,12 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
for (i= 0; i < num_fields; i++)
{
/* Free data for output */
- my_free(my_bind[i].buffer, MYF(MY_WME | MY_FAE));
+ my_free(my_bind[i].buffer);
}
/* Free array with bind structs, lengths and NULL flags */
- my_free(my_bind , MYF(MY_WME | MY_FAE));
- my_free(length , MYF(MY_WME | MY_FAE));
- my_free(is_null , MYF(MY_WME | MY_FAE));
+ my_free(my_bind);
+ my_free(length);
+ my_free(is_null);
}
@@ -8489,11 +8477,11 @@ void do_get_replace_column(struct st_command *command)
if (!*from)
die("Wrong number of arguments to replace_column in '%s'", command->query);
to= get_string(&buff, &from, command);
- my_free(replace_column[column_number-1], MY_ALLOW_ZERO_PTR);
+ my_free(replace_column[column_number-1]);
replace_column[column_number-1]= my_strdup(to, MYF(MY_WME | MY_FAE));
set_if_bigger(max_replace_column, column_number);
}
- my_free(start, MYF(0));
+ my_free(start);
command->last_argument= command->end;
DBUG_VOID_RETURN;
@@ -8507,7 +8495,7 @@ void free_replace_column()
{
if (replace_column[i])
{
- my_free(replace_column[i], 0);
+ my_free(replace_column[i]);
replace_column[i]= 0;
}
}
@@ -8588,7 +8576,7 @@ void do_get_replace(struct st_command *command)
die("Can't initialize replace from '%s'", command->query);
free_pointer_array(&from_array);
free_pointer_array(&to_array);
- my_free(start, MYF(0));
+ my_free(start);
command->last_argument= command->end;
DBUG_VOID_RETURN;
}
@@ -8597,11 +8585,8 @@ void do_get_replace(struct st_command *command)
void free_replace()
{
DBUG_ENTER("free_replace");
- if (glob_replace)
- {
- my_free(glob_replace,MYF(0));
- glob_replace=0;
- }
+ my_free(glob_replace);
+ glob_replace= NULL;
DBUG_VOID_RETURN;
}
@@ -8821,7 +8806,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
return res;
err:
- my_free(res,0);
+ my_free(res);
die("Error parsing replace_regex \"%s\"", expr);
return 0;
}
@@ -8913,9 +8898,9 @@ void free_replace_regex()
if (glob_replace_regex)
{
delete_dynamic(&glob_replace_regex->regex_arr);
- my_free(glob_replace_regex->even_buf,MYF(MY_ALLOW_ZERO_PTR));
- my_free(glob_replace_regex->odd_buf,MYF(MY_ALLOW_ZERO_PTR));
- my_free(glob_replace_regex,MYF(0));
+ my_free(glob_replace_regex->even_buf);
+ my_free(glob_replace_regex->odd_buf);
+ my_free(glob_replace_regex);
glob_replace_regex=0;
}
}
@@ -9110,7 +9095,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
str_p= str_end;
}
}
- my_free(subs, MYF(0));
+ my_free(subs);
my_regfree(&r);
*res_p= 0;
*buf_p= buf;
@@ -9242,7 +9227,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
{
free_sets(&sets);
- my_free(found_set,MYF(0));
+ my_free(found_set);
DBUG_RETURN(0);
}
@@ -9421,8 +9406,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
- rep_str[i].found= !bcmp((const uchar*) pos,
- (const uchar*) "\\^", 3) ? 2 : 1;
+ rep_str[i].found= !memcmp(pos, "\\^", 3) ? 2 : 1;
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
@@ -9437,9 +9421,9 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1));
}
}
- my_free(follow,MYF(0));
+ my_free(follow);
free_sets(&sets);
- my_free(found_set,MYF(0));
+ my_free(found_set);
DBUG_PRINT("exit",("Replace table has %d states",sets.count));
DBUG_RETURN(replace);
}
@@ -9455,7 +9439,7 @@ int init_sets(REP_SETS *sets,uint states)
if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
SET_MALLOC_HUNC,MYF(MY_WME))))
{
- my_free(sets->set,MYF(0));
+ my_free(sets->set);
return 1;
}
return 0;
@@ -9516,8 +9500,8 @@ void free_last_set(REP_SETS *sets)
void free_sets(REP_SETS *sets)
{
- my_free(sets->set_buffer,MYF(0));
- my_free(sets->bit_buffer,MYF(0));
+ my_free(sets->set_buffer);
+ my_free(sets->bit_buffer);
return;
}
@@ -9550,8 +9534,8 @@ void copy_bits(REP_SET *to,REP_SET *from)
int cmp_bits(REP_SET *set1,REP_SET *set2)
{
- return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
- sizeof(uint) * set1->size_of_bits);
+ return memcmp(set1->bits, set2->bits,
+ sizeof(uint) * set1->size_of_bits);
}
@@ -9620,17 +9604,15 @@ int find_found(FOUND_SET *found_set,uint table_offset, int found_offset)
uint start_at_word(char * pos)
{
- return (((!bcmp((const uchar*) pos, (const uchar*) "\\b",2) && pos[2]) ||
- !bcmp((const uchar*) pos, (const uchar*) "\\^", 2)) ? 1 : 0);
+ return (((!memcmp(pos, "\\b",2) && pos[2]) ||
+ !memcmp(pos, "\\^", 2)) ? 1 : 0);
}
uint end_of_word(char * pos)
{
char * end=strend(pos);
- return ((end > pos+2 && !bcmp((const uchar*) end-2,
- (const uchar*) "\\b", 2)) ||
- (end >= pos+2 && !bcmp((const uchar*) end-2,
- (const uchar*) "\\$",2))) ? 1 : 0;
+ return ((end > pos+2 && !memcmp(end-2, "\\b", 2)) ||
+ (end >= pos+2 && !memcmp(end-2, "\\$",2))) ? 1 : 0;
}
/****************************************************************************
@@ -9657,7 +9639,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
MYF(MY_WME))))
{
- my_free((char*) pa->typelib.type_names,MYF(0));
+ my_free(pa->typelib.type_names);
DBUG_RETURN (-1);
}
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
@@ -9718,9 +9700,9 @@ void free_pointer_array(POINTER_ARRAY *pa)
if (pa->typelib.count)
{
pa->typelib.count=0;
- my_free((char*) pa->typelib.type_names,MYF(0));
+ my_free(pa->typelib.type_names);
pa->typelib.type_names=0;
- my_free(pa->str,MYF(0));
+ my_free(pa->str);
}
} /* free_pointer_array */
diff --git a/client/readline.cc b/client/readline.cc
index 73ce7c3b8c7..5c1a9951d9b 100644
--- a/client/readline.cc
+++ b/client/readline.cc
@@ -35,7 +35,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
return 0;
if (init_line_buffer(line_buff,my_fileno(file),IO_SIZE,max_size))
{
- my_free(line_buff,MYF(0));
+ my_free(line_buff);
return 0;
}
return line_buff;
@@ -63,8 +63,8 @@ void batch_readline_end(LINE_BUFFER *line_buff)
{
if (line_buff)
{
- my_free(line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR));
- my_free(line_buff,MYF(0));
+ my_free(line_buff->buffer);
+ my_free(line_buff);
}
}
@@ -77,7 +77,7 @@ LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, char * str)
return 0;
if (init_line_buffer_from_string(line_buff,str))
{
- my_free(line_buff,MYF(0));
+ my_free(line_buff);
return 0;
}
return line_buff;
diff --git a/client/sql_string.h b/client/sql_string.h
index 1a3ac5d33c5..bafc287c73e 100644
--- a/client/sql_string.h
+++ b/client/sql_string.h
@@ -175,7 +175,7 @@ public:
{
alloced=0;
Alloced_length=0;
- my_free(Ptr,MYF(0));
+ my_free(Ptr);
Ptr=0;
str_length=0; /* Safety */
}
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 97de0965f6b..9d010ef7f2a 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -15,6 +15,18 @@
# This file includes build settings used for MySQL release
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckLibraryExists)
+INCLUDE(CheckTypeSize)
+
+# XXX package_name.cmake uses this too, move it somewhere global
+CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
+IF(SIZEOF_VOIDP EQUAL 4)
+ SET(32BIT 1)
+ENDIF()
+IF(SIZEOF_VOIDP EQUAL 8)
+ SET(64BIT 1)
+ENDIF()
SET(FEATURE_SET "community" CACHE STRING
" Selection of features. Options are
@@ -76,15 +88,14 @@ IF(FEATURE_SET)
SET(WITH_${eng}_STORAGE_ENGINE OFF CACHE BOOL "")
ELSE()
SET(WITH_${eng}_STORAGE_ENGINE ON CACHE BOOL "")
- ENDIF()
+ ENDIF()
ENDFOREACH()
ENDIF()
-OPTION(ENABLE_LOCAL_INFILE "" ON)
+OPTION(ENABLED_LOCAL_INFILE "" ON)
SET(WITH_SSL bundled CACHE STRING "")
SET(WITH_ZLIB bundled CACHE STRING "")
-
IF(NOT COMPILATION_COMMENT)
SET(COMPILATION_COMMENT "MySQL Community Server (GPL)")
ENDIF()
@@ -103,46 +114,75 @@ IF(UNIX)
ENDIF()
OPTION(WITH_PIC "" ON) # Why?
-ENDIF()
+ # Ensure aio is available on Linux (required by InnoDB)
+ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
+ CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
+ IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO)
+ MESSAGE(FATAL_ERROR "aio is required on Linux")
+ ENDIF()
+ ENDIF()
+
+ENDIF()
# Compiler options
IF(UNIX)
+
# Default GCC flags
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer")
+ SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
+ ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3 -static-libgcc -fno-omit-frame-pointer")
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3 -static-libgcc -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti")
+ SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer")
+ SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
ENDIF()
-
# HPUX flags
IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
IF(CMAKE_C_COMPILER_ID MATCHES "HP")
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64")
- SET(CMAKE_C_FLAGS
- "${CMAKE_C_FLAGS} +DD64 +DSitanium2 -mt -AC99")
- SET(CMAKE_CXX_FLAGS
- "${CMAKE_CXX_FLAGS} +DD64 +DSitanium2 -mt -Aa")
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} +O2")
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} +O2")
+ SET(COMMON_C_FLAGS "+DSitanium2 -mt -AC99")
+ SET(COMMON_CXX_FLAGS "+DSitanium2 -mt -Aa")
+ SET(CMAKE_C_FLAGS_DEBUG "+O0 -g ${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "+O0 -g ${COMMON_CXX_FLAGS}")
+ # We have seen compiler bugs with optimisation and -g, so disabled for now
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "+O2 ${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "+O2 ${COMMON_CXX_FLAGS}")
ENDIF()
ENDIF()
- SET(WITH_SSL)
+ SET(WITH_SSL no)
ENDIF()
# Linux flags
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(CMAKE_C_COMPILER_ID MATCHES "Intel")
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-static-intel -static-libgcc -g -O3 -unroll2 -ip -mp -restrict -no-ftz -no-prefetch")
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-static-intel -static-libgcc -g -O3 -unroll2 -ip -mp -restrict -no-ftz -no-prefetch")
+ SET(COMMON_C_FLAGS "-static-intel -static-libgcc -g -mp -restrict")
+ SET(COMMON_CXX_FLAGS "-static-intel -static-libgcc -g -mp -restrict -fno-exceptions -fno-rtti")
+ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64")
+ SET(COMMON_C_FLAGS "${COMMON_C_FLAGS} -no-ftz -no-prefetch")
+ SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -no-ftz -no-prefetch")
+ ENDIF()
+ SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -unroll2 -ip ${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -unroll2 -ip ${COMMON_CXX_FLAGS}")
SET(WITH_SSL no)
ENDIF()
ENDIF()
# OSX flags
IF(APPLE)
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -Os -fno-common")
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -Os -felide-constructors -fno-common")
+ SET(COMMON_C_FLAGS "-g -fno-common")
+ # XXX: why are we using -felide-constructors on OSX?
+ SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors")
+ SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os ${COMMON_CXX_FLAGS}")
ENDIF()
# Solaris flags
@@ -153,37 +193,48 @@ IF(UNIX)
ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
- IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Solaris x86
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO
- "-g -xO2 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic")
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
- "-g0 -xO2 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic")
- ELSE()
- # Solaris x64
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO
- "-g -xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic")
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
- "-g0 -xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic")
- ENDIF()
- ELSE()
- IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Solaris sparc 32 bit
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -xO3 -Xa -xstrconst -mt -xarch=sparc")
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g0 -xO3 -noex -mt -xarch=sparc")
- ELSE()
- # Solaris sparc 64 bit
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -xO3 -Xa -xstrconst -mt")
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g0 -xO3 -noex -mt")
- ENDIF()
- ENDIF()
+ SET(COMMON_C_FLAGS "-g -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic")
+ SET(COMMON_CXX_FLAGS "-g0 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic")
+ SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}")
+ IF(32BIT)
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-xO2 ${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-xO2 ${COMMON_CXX_FLAGS}")
+ ELSEIF(64BIT)
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-xO3 ${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-xO3 ${COMMON_CXX_FLAGS}")
+ ENDIF()
+ ELSE()
+ # Assume !x86 is SPARC
+ SET(COMMON_C_FLAGS "-g -Xa -xstrconst -mt")
+ SET(COMMON_CXX_FLAGS "-g0 -noex -mt")
+ IF(32BIT)
+ SET(COMMON_C_FLAGS "${COMMON_C_FLAGS} -xarch=sparc")
+ SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -xarch=sparc")
+ ENDIF()
+ SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-xO3 ${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-xO3 ${COMMON_CXX_FLAGS}")
+ ENDIF()
ENDIF()
ENDIF()
+ IF(CMAKE_C_FLAGS_DEBUG)
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}"
+ CACHE STRING "Debug C compile flags")
+ ENDIF()
+ IF(CMAKE_CXX_FLAGS_DEBUG)
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}"
+ CACHE STRING "Debug C++ compile flags")
+ ENDIF()
+ IF(CMAKE_C_FLAGS_RELWITHDEBINFO)
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}"
+ CACHE STRING "RelWithDebInfo C compile flags")
+ ENDIF()
IF(CMAKE_CXX_FLAGS_RELWITHDEBINFO)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
- CACHE STRING "Compile flags")
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}"
- CACHE STRING "Compile flags")
+ CACHE STRING "RelWithDebInfo C++ compile flags")
ENDIF()
+
ENDIF()
diff --git a/cmake/configure.pl b/cmake/configure.pl
index fba417365fc..5be47ce5a31 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -184,6 +184,12 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1";
next;
}
+ if ($option =~ /mysql-maintainer-mode/)
+ {
+ $cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" .
+ ($option =~ /enable/ ? "1" : "0");
+ next;
+ }
$option = uc($option);
$option =~ s/-/_/g;
diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in
index 649d96a6627..881afe265ef 100644
--- a/cmake/create_initial_db.cmake.in
+++ b/cmake/create_initial_db.cmake.in
@@ -31,8 +31,7 @@ ENDIF()
# Create bootstrapper SQL script
FILE(WRITE bootstrap.sql "use mysql;\n" )
-FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql
- fill_help_tables.sql)
+FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql)
FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS)
FOREACH(STR ${CONTENTS})
IF(NOT STR MATCHES "@current_hostname")
@@ -40,6 +39,8 @@ FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql
ENDIF()
ENDFOREACH()
ENDFOREACH()
+FILE(READ ${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql CONTENTS)
+FILE(APPEND bootstrap.sql ${CONTENTS})
FILE(REMOVE_RECURSE mysql)
@@ -56,6 +57,7 @@ SET(BOOTSTRAP_COMMAND
--lc-messages-dir=${CMAKE_CURRENT_BINARY_DIR}/share
--basedir=.
--datadir=.
+ --default-storage-engine=MyISAM
--loose-skip-innodb
--loose-skip-ndbcluster
--max_allowed_packet=8M
@@ -78,4 +80,4 @@ EXECUTE_PROCESS (
IF(NOT RESULT EQUAL 0)
MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}")
ENDIF()
- \ No newline at end of file
+
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index ade6cdb747f..ade6cdb747f 100755..100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index f049776b8f4..56a540fde89 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -35,15 +35,84 @@ MACRO (INSTALL_DEBUG_SYMBOLS targets)
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location})
ENDIF()
- INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION})
+ IF(target STREQUAL "mysqld")
+ SET(comp Server)
+ ELSE()
+ SET(comp Debuginfo)
+ ENDIF()
+ INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp})
ENDFOREACH()
ENDIF()
ENDMACRO()
+# Installs manpage for given file (either script or executable)
+#
+FUNCTION(INSTALL_MANPAGE file)
+ IF(NOT UNIX)
+ RETURN()
+ ENDIF()
+ GET_FILENAME_COMPONENT(file_name "${file}" NAME)
+ SET(GLOB_EXPR
+ ${CMAKE_SOURCE_DIR}/man/*${file}man.1*
+ ${CMAKE_SOURCE_DIR}/man/*${file}man.8*
+ ${CMAKE_BINARY_DIR}/man/*${file}man.1*
+ ${CMAKE_BINARY_DIR}/man/*${file}man.8*
+ )
+ IF(MYSQL_DOC_DIR)
+ SET(GLOB_EXPR
+ ${MYSQL_DOC_DIR}/man/*${file}man.1*
+ ${MYSQL_DOC_DIR}/man/*${file}man.8*
+ ${MYSQL_DOC_DIR}/man/*${file}.1*
+ ${MYSQL_DOC_DIR}/man/*${file}.8*
+ ${GLOB_EXPR}
+ )
+ ENDIF()
+
+ FILE(GLOB_RECURSE MANPAGES ${GLOB_EXPR})
+ IF(MANPAGES)
+ LIST(GET MANPAGES 0 MANPAGE)
+ STRING(REPLACE "${file}man.1" "${file}.1" MANPAGE "${MANPAGE}")
+ STRING(REPLACE "${file}man.8" "${file}.8" MANPAGE "${MANPAGE}")
+ IF(MANPAGE MATCHES "${file}.1")
+ SET(SECTION man1)
+ ELSE()
+ SET(SECTION man8)
+ ENDIF()
+ INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}")
+ ENDIF()
+ENDFUNCTION()
+
+FUNCTION(INSTALL_SCRIPT)
+ CMAKE_PARSE_ARGUMENTS(ARG
+ "DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+
+ SET(script ${ARG_DEFAULT_ARGS})
+ IF(NOT ARG_DESTINATION)
+ SET(ARG_DESTINATION ${INSTALL_BINDIR})
+ ENDIF()
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ELSE()
+ SET(COMP)
+ ENDIF()
+
+ INSTALL(FILES
+ ${script}
+ DESTINATION ${ARG_DESTINATION}
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE ${COMP}
+ )
+ INSTALL_MANPAGE(${script})
+ENDFUNCTION()
+
# Install symbolic link to CMake target.
# the link is created in the same directory as target
# and extension will be the same as for target file.
-MACRO(INSTALL_SYMLINK linkname target destination)
+MACRO(INSTALL_SYMLINK linkname target destination component)
IF(UNIX)
GET_TARGET_PROPERTY(location ${target} LOCATION)
GET_FILENAME_COMPONENT(path ${location} PATH)
@@ -68,7 +137,12 @@ IF(UNIX)
STRING(REPLACE "${CMAKE_CFG_INTDIR}"
"\${CMAKE_INSTALL_CONFIG_NAME}" output ${output})
ENDIF()
- INSTALL(FILES ${output} DESTINATION ${destination})
+ IF(component)
+ SET(COMP COMPONENT ${component})
+ ELSE()
+ SET(COMP)
+ ENDIF()
+ INSTALL(FILES ${output} DESTINATION ${destination} ${COMP})
ENDIF()
ENDMACRO()
@@ -128,13 +202,11 @@ ENDMACRO()
# Installs targets, also installs pdbs on Windows.
#
-# More stuff can be added later, e.g signing
-# or pre-link custom targets (one example is creating
-# version resource for windows executables)
+#
FUNCTION(MYSQL_INSTALL_TARGETS)
CMAKE_PARSE_ARGUMENTS(ARG
- "DESTINATION"
+ "DESTINATION;COMPONENT"
""
${ARGN}
)
@@ -146,15 +218,24 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
MESSAGE(FATAL_ERROR "Need DESTINATION parameter for MYSQL_INSTALL_TARGETS")
ENDIF()
- # If signing is required, sign executables before installing
+
FOREACH(target ${TARGETS})
- IF(SIGNCODE AND SIGNCODE_ENABLED)
+ # If signing is required, sign executables before installing
+ IF(SIGNCODE AND SIGNCODE_ENABLED)
SIGN_TARGET(${target})
ENDIF()
+ # For Windows, add version info to executables
ADD_VERSION_INFO(${target})
+ # Install man pages on Unix
+ IF(UNIX)
+ GET_TARGET_PROPERTY(target_location ${target} LOCATION)
+ INSTALL_MANPAGE(${target_location})
+ ENDIF()
ENDFOREACH()
-
- INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION})
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ENDIF()
+ INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP})
SET(INSTALL_LOCATION ${ARG_DESTINATION} )
INSTALL_DEBUG_SYMBOLS("${TARGETS}")
SET(INSTALL_LOCATION)
@@ -169,7 +250,7 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug
FUNCTION(INSTALL_DEBUG_TARGET target)
CMAKE_PARSE_ARGUMENTS(ARG
- "DESTINATION;RENAME"
+ "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT"
""
${ARGN}
)
@@ -188,6 +269,9 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
ELSE()
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug" debug_target_location "${target_location}" )
ENDIF()
+ IF(NOT ARG_COMPONENT)
+ SET(ARG_COMPONENT DebugBinaries)
+ ENDIF()
# Define permissions
# For executable files
@@ -224,19 +308,26 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
${RENAME_PARAM}
${PERMISSIONS_${target_type}}
CONFIGURATIONS Release RelWithDebInfo
+ COMPONENT ${ARG_COMPONENT}
OPTIONAL)
IF(MSVC)
GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT)
STRING(REPLACE "${ext}" ".pdb" debug_pdb_target_location "${debug_target_location}" )
- IF(RENAME_PARAM)
- STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename)
- SET(PDB_RENAME_PARAM RENAME ${pdb_rename})
+ IF (RENAME_PARAM)
+ IF(NOT ARG_PDB_DESTINATION)
+ STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename)
+ SET(PDB_RENAME_PARAM RENAME "${pdb_rename}")
+ ENDIF()
+ ENDIF()
+ IF(NOT ARG_PDB_DESTINATION)
+ SET(ARG_PDB_DESTINATION "${ARG_DESTINATION}")
ENDIF()
INSTALL(FILES ${debug_pdb_target_location}
- DESTINATION ${ARG_DESTINATION}
- ${RPDB_RENAME_PARAM}
+ DESTINATION ${ARG_PDB_DESTINATION}
+ ${PDB_RENAME_PARAM}
CONFIGURATIONS Release RelWithDebInfo
+ COMPONENT ${ARG_COMPONENT}
OPTIONAL)
ENDIF()
ENDFUNCTION()
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 2263b146ed6..ba63df71428 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -214,7 +214,7 @@ ENDMACRO()
#)
MACRO(MERGE_LIBRARIES)
CMAKE_PARSE_ARGUMENTS(ARG
- "EXPORTS;OUTPUT_NAME"
+ "EXPORTS;OUTPUT_NAME;COMPONENT"
"STATIC;SHARED;MODULE;NOINSTALL"
${ARGN}
)
@@ -259,7 +259,10 @@ MACRO(MERGE_LIBRARIES)
MESSAGE(FATAL_ERROR "Unknown library type")
ENDIF()
IF(NOT ARG_NOINSTALL)
- MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION "${INSTALL_LIBDIR}")
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ENDIF()
+ MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION "${INSTALL_LIBDIR}" ${COMP})
ENDIF()
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_INTERFACE_LIBRARIES "")
ENDMACRO()
diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake
index 2157d03e6d1..86301c2eec8 100644
--- a/cmake/mysql_add_executable.cmake
+++ b/cmake/mysql_add_executable.cmake
@@ -29,7 +29,7 @@ INCLUDE(cmake_parse_arguments)
FUNCTION (MYSQL_ADD_EXECUTABLE)
# Pass-through arguments for ADD_EXECUTABLE
CMAKE_PARSE_ARGUMENTS(ARG
- "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION"
+ "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT"
""
${ARGN}
)
@@ -43,7 +43,14 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
IF(NOT ARG_EXCLUDE_FROM_ALL)
IF(NOT ARG_DESTINATION)
SET(ARG_DESTINATION ${INSTALL_BINDIR})
+ ENDIF()
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ELSEIF(MYSQL_INSTALL_COMPONENT)
+ SET(COMP COMPONENT ${MYSQL_INSTALL_COMPONENT})
+ ELSE()
+ SET(COMP COMPONENT Client)
ENDIF()
- MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION})
+ MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} ${COMP})
ENDIF()
-ENDFUNCTION() \ No newline at end of file
+ENDFUNCTION()
diff --git a/cmake/os/AIX.cmake b/cmake/os/AIX.cmake
index b1b2cebdd14..c08cbbdc0cf 100644
--- a/cmake/os/AIX.cmake
+++ b/cmake/os/AIX.cmake
@@ -28,6 +28,6 @@ INCLUDE(CheckCXXCompilerFlag)
# The following is required to export all symbols
# (also with leading underscore)
STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
- ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}")
+ "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}")
STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS
- "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}") \ No newline at end of file
+ "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}")
diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake
index be7af778e93..e09592942c1 100644
--- a/cmake/os/FreeBSD.cmake
+++ b/cmake/os/FreeBSD.cmake
@@ -20,4 +20,5 @@
# #Legacy option, maybe not needed anymore , taken as is from autotools build
# ADD_DEFINITIONS(-DNET_RETRY_COUNT=1000000)
-ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH)
+# The below was used for really old versions of FreeBSD, roughly: before 5.1.9
+# ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH)
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 3be739d3122..aac7e484f26 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -110,6 +110,10 @@ IF(MSVC)
ADD_DEFINITIONS(/wd4996)
ENDIF()
+ # Make class/struct definition mismatch an error (overseen too often,
+ # adds tons of new warnings)
+ ADD_DEFINITIONS(/we4099)
+
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
# _WIN64 is defined by the compiler itself.
# Yet, we define it here again to work around a bug with Intellisense
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 68b6f2a6ddf..81942a8c053 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -30,7 +30,6 @@ SET(HAVE_ASM_MSR_H CACHE INTERNAL "")
SET(HAVE_BACKTRACE CACHE INTERNAL "")
SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "")
SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "")
-SET(HAVE_BCMP CACHE INTERNAL "")
SET(HAVE_BFILL CACHE INTERNAL "")
SET(HAVE_BMOVE CACHE INTERNAL "")
SET(HAVE_BSD_SIGNALS CACHE INTERNAL "")
@@ -263,7 +262,6 @@ SET(HAVE_SYS_DIR_H CACHE INTERNAL "")
SET(HAVE_SYS_ERRLIST CACHE INTERNAL "")
SET(HAVE_SYS_FILE_H CACHE INTERNAL "")
SET(HAVE_SYS_FPU_H CACHE INTERNAL "")
-SET(HAVE_SYS_IOCTL CACHE INTERNAL "")
SET(HAVE_SYS_IOCTL_H CACHE INTERNAL "")
SET(HAVE_SYS_IPC_H CACHE INTERNAL "")
SET(HAVE_SYS_MALLOC_H CACHE INTERNAL "")
diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake
index d2998cfd795..b027ac3901f 100644
--- a/cmake/package_name.cmake
+++ b/cmake/package_name.cmake
@@ -15,6 +15,8 @@
# Produce meaningful package name for the binary package
# The logic is rather involved with special cases for different OSes
+INCLUDE(CheckTypeSize)
+CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
MACRO(GET_PACKAGE_FILE_NAME Var)
IF(NOT VERSION)
MESSAGE(FATAL_ERROR
@@ -24,10 +26,10 @@ IF(NOT VERSION)
SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 1)
SET(DEFAULT_PLATFORM ${CMAKE_SYSTEM_NAME})
SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
- IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ IF(SIZEOF_VOIDP EQUAL 8)
SET(64BIT 1)
ENDIF()
-
+
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0)
SET(DEFAULT_PLATFORM "win")
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 896624996d3..94edfb8741a 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -173,7 +173,7 @@ MACRO(MYSQL_ADD_PLUGIN)
SET_TARGET_PROPERTIES(${target} PROPERTIES
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
# Install dynamic library
- MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR})
+ MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server)
INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug)
ENDIF()
ENDMACRO()
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index b101c26e241..c5aa2de2721 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -25,18 +25,18 @@ MACRO (MYSQL_USE_BUNDLED_SSL)
SET(SSL_LIBRARIES yassl taocrypt)
SET(SSL_INCLUDE_DIRS ${INC_DIRS})
SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
- SET(SSL_DEFINES"-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DYASSL_THREAD_SAFE")
+ SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DYASSL_THREAD_SAFE")
CHANGE_SSL_SETTINGS("bundled")
#Remove -fno-implicit-templates
#(yassl sources cannot be compiled with it)
- SET(SAVE_CXX_FLAGS ${CXX_FLAGS})
+ SET(SAVE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
IF(CMAKE_CXX_FLAGS)
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
${CMAKE_CXX_FLAGS})
ENDIF()
ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
- SET(CXX_FLAGS ${SAVE_CXX_FLAGS})
+ SET(CMAKE_CXX_FLAGS ${SAVE_CXX_FLAGS})
GET_TARGET_PROPERTY(src yassl SOURCES)
FOREACH(file ${src})
SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/${file})
diff --git a/cmd-line-utils/readline/Makefile.am b/cmd-line-utils/readline/Makefile.am
index 40e74ccaf55..48d3af34412 100644
--- a/cmd-line-utils/readline/Makefile.am
+++ b/cmd-line-utils/readline/Makefile.am
@@ -31,4 +31,4 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \
EXTRA_DIST= emacs_keymap.c vi_keymap.c CMakeLists.txt
-DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR
+DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1
diff --git a/config.h.cmake b/config.h.cmake
index 3fa15a0706a..73cd94cace4 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -22,11 +22,14 @@
#cmakedefine HAVE_ALLOCA_H 1
#cmakedefine HAVE_AIO_H 1
#cmakedefine HAVE_ARPA_INET_H 1
+#cmakedefine HAVE_ASM_MSR_H 1
+#cmakedefine HAVE_ASM_TERMBITS_H 1
#cmakedefine HAVE_BSEARCH 1
#cmakedefine HAVE_CRYPT_H 1
#cmakedefine HAVE_CURSES_H 1
#cmakedefine HAVE_CXXABI_H 1
#cmakedefine HAVE_NCURSES_H 1
+#cmakedefine HAVE_NDIR_H 1
#cmakedefine HAVE_DIRENT_H 1
#cmakedefine HAVE_DLFCN_H 1
#cmakedefine HAVE_EXECINFO_H 1
@@ -70,6 +73,7 @@
#cmakedefine HAVE_SYS_IPC_H 1
#cmakedefine HAVE_SYS_MALLOC_H 1
#cmakedefine HAVE_SYS_MMAN_H 1
+#cmakedefine HAVE_SYS_NDIR_H 1
#cmakedefine HAVE_SYS_PTE_H 1
#cmakedefine HAVE_SYS_PTEM_H 1
#cmakedefine HAVE_SYS_PRCTL_H 1
@@ -81,13 +85,17 @@
#cmakedefine HAVE_SYS_STREAM_H 1
#cmakedefine HAVE_SYS_TERMCAP_H 1
#cmakedefine HAVE_SYS_TIMEB_H 1
+#cmakedefine HAVE_SYS_TIMES_H 1
+#cmakedefine HAVE_SYS_TIME_H 1
#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_SYS_UN_H 1
#cmakedefine HAVE_SYS_VADVISE_H 1
#cmakedefine HAVE_TERM_H 1
+#cmakedefine HAVE_TERMBITS_H 1
#cmakedefine HAVE_TERMIOS_H 1
#cmakedefine HAVE_TERMIO_H 1
#cmakedefine HAVE_TERMCAP_H 1
+#cmakedefine HAVE_TIME_H 1
#cmakedefine HAVE_UNISTD_H 1
#cmakedefine HAVE_UTIME_H 1
#cmakedefine HAVE_VARARGS_H 1
@@ -95,6 +103,7 @@
#cmakedefine HAVE_SYS_UTIME_H 1
#cmakedefine HAVE_SYS_WAIT_H 1
#cmakedefine HAVE_SYS_PARAM_H 1
+#cmakedefine HAVE_XFS_XFS_H 1
/* Libraries */
#cmakedefine HAVE_LIBPTHREAD 1
@@ -122,14 +131,15 @@
#cmakedefine HAVE_AIOWAIT 1
#cmakedefine HAVE_ALARM 1
#cmakedefine HAVE_ALLOCA 1
-#cmakedefine HAVE_BCMP 1
#cmakedefine HAVE_BFILL 1
#cmakedefine HAVE_BMOVE 1
#cmakedefine HAVE_BZERO 1
#cmakedefine HAVE_INDEX 1
+#cmakedefine HAVE_CHOWN 1
#cmakedefine HAVE_CLOCK_GETTIME 1
#cmakedefine HAVE_CRYPT 1
#cmakedefine HAVE_CUSERID 1
+#cmakedefine HAVE_CXX_NEW 1
#cmakedefine HAVE_DIRECTIO 1
#cmakedefine HAVE_DLERROR 1
#cmakedefine HAVE_DLOPEN 1
@@ -144,6 +154,7 @@
#cmakedefine HAVE_FPSETMASK 1
#cmakedefine HAVE_FSEEKO 1
#cmakedefine HAVE_FSYNC 1
+#cmakedefine HAVE_FTIME 1
#cmakedefine HAVE_GETADDRINFO 1
#cmakedefine HAVE_GETCWD 1
#cmakedefine HAVE_GETHOSTBYADDR_R 1
@@ -173,6 +184,8 @@
#cmakedefine HAVE_LOG2 1
#cmakedefine HAVE_LONGJMP 1
#cmakedefine HAVE_LSTAT 1
+#cmakedefine HAVE_MEMALIGN 1
+/* #cmakedefine HAVE_MLOCK 1 see Bug#54662 */
#cmakedefine HAVE_NPTL 1
#cmakedefine HAVE_NL_LANGINFO 1
#cmakedefine HAVE_MADVISE 1
@@ -193,6 +206,8 @@
#cmakedefine HAVE_PREAD 1
#cmakedefine HAVE_PAUSE_INSTRUCTION 1
#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1
+#cmakedefine HAVE_RDTSCLL 1
+#cmakedefine HAVE_READ_REAL_TIME 1
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
#cmakedefine HAVE_PTHREAD_ATTR_GETSTACKSIZE 1
#cmakedefine HAVE_PTHREAD_ATTR_SETPRIO 1
@@ -237,6 +252,15 @@
#cmakedefine HAVE_SIGWAIT 1
#cmakedefine HAVE_SLEEP 1
#cmakedefine HAVE_SNPRINTF 1
+/* Some that currently are not real defines, internal to CMake setup */
+/* #cmakedefine HAVE_FCNTL_NONBLOCK 1 */
+/* #cmakedefine HAVE_FINITE_IN_MATH_H 1 */
+/* #cmakedefine HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 */
+/* #cmakedefine HAVE_SOCKADDR_STORAGE___SS_FAMILY 1 */
+/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_int 1 */
+/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_size_t 1 */
+/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_socklen_t */
+/* #cmakedefine HAVE_SOCKET_TIMEOUT */
#cmakedefine HAVE_STPCPY 1
#cmakedefine HAVE_STRERROR 1
#cmakedefine HAVE_STRCOLL 1
@@ -261,6 +285,8 @@
#cmakedefine HAVE_TEMPNAM 1
#cmakedefine HAVE_THR_SETCONCURRENCY 1
#cmakedefine HAVE_THR_YIELD 1
+#cmakedefine HAVE_TIME 1
+#cmakedefine HAVE_TIMES 1
#cmakedefine HAVE_VALLOC 1
#define HAVE_VIO_READ_BUFF 1
#cmakedefine HAVE_VASPRINTF 1
@@ -295,11 +321,6 @@
#cmakedefine HAVE_VALGRIND
/* Types we may use */
-#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
-#if SIZEOF_CHAR
-# define HAVE_CHAR 1
-#endif
-
#ifdef __APPLE__
/*
Special handling required for OSX to support universal binaries that
@@ -310,127 +331,71 @@
#else
#define SIZEOF_LONG 4
#endif
+ #define SIZEOF_VOIDP SIZEOF_LONG
#define SIZEOF_CHARP SIZEOF_LONG
#define SIZEOF_SIZE_T SIZEOF_LONG
#else
- #cmakedefine SIZEOF_LONG @SIZEOF_LONG@
- #cmakedefine SIZEOF_CHARP @SIZEOF_CHARP@
- #cmakedefine SIZEOF_SIZE_T @SIZEOF_CHARP@
-#endif
-
-#if SIZEOF_LONG
-# define HAVE_LONG 1
-#endif
-
-
-#if SIZEOF_CHARP
-#define HAVE_CHARP 1
-#define SIZEOF_VOIDP SIZEOF_CHARP
+/* No indentation, to fetch the lines from verification scripts */
+#cmakedefine SIZEOF_LONG @SIZEOF_LONG@
+#cmakedefine SIZEOF_VOIDP @SIZEOF_VOIDP@
+#cmakedefine SIZEOF_CHARP @SIZEOF_CHARP@
+#cmakedefine SIZEOF_SIZE_T @SIZEOF_CHARP@
#endif
+#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
+#cmakedefine HAVE_CHAR 1
+#cmakedefine HAVE_LONG 1
+#cmakedefine HAVE_CHARP 1
#cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
-#if SIZEOF_SHORT
-# define HAVE_SHORT 1
-#endif
-
+#cmakedefine HAVE_SHORT 1
#cmakedefine SIZEOF_INT @SIZEOF_INT@
-#if SIZEOF_INT
-# define HAVE_INT 1
-#endif
-
-
+#cmakedefine HAVE_INT 1
#cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@
-#if SIZEOF_LONG_LONG
-# define HAVE_LONG_LONG 1
-#endif
-
+#cmakedefine HAVE_LONG_LONG 1
#cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@
-#if SIZEOF_OFF_T
-#define HAVE_OFF_T 1
-#endif
-
+#cmakedefine HAVE_OFF_T 1
#cmakedefine SIZEOF_SIGSET_T @SIZEOF_SIGSET_T@
-#if SIZEOF_SIGSET_T
-#define HAVE_SIGSET_T 1
-#endif
-
-#if SIZEOF_SIZE_T
-#define HAVE_SIZE_T 1
-#endif
-
+#cmakedefine HAVE_SIGSET_T 1
+#cmakedefine HAVE_SIZE_T 1
#cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
-#if SIZEOF_UCHAR
-#define HAVE_UCHAR 1
-#endif
-
+#cmakedefine HAVE_UCHAR 1
#cmakedefine SIZEOF_UINT @SIZEOF_UINT@
-#if SIZEOF_UINT
-#define HAVE_UINT 1
-#endif
-
+#cmakedefine HAVE_UINT 1
#cmakedefine SIZEOF_ULONG @SIZEOF_ULONG@
-#if SIZEOF_ULONG
-#define HAVE_ULONG 1
-#endif
-
+#cmakedefine HAVE_ULONG 1
#cmakedefine SIZEOF_INT8 @SIZEOF_INT8@
-#if SIZEOF_INT8
-#define HAVE_INT8 1
-#endif
+#cmakedefine HAVE_INT8 1
#cmakedefine SIZEOF_UINT8 @SIZEOF_UINT8@
-#if SIZEOF_UINT8
-#define HAVE_UINT8 1
-#endif
-
+#cmakedefine HAVE_UINT8 1
#cmakedefine SIZEOF_INT16 @SIZEOF_INT16@
-#if SIZEOF_INT16
-# define HAVE_INT16 1
-#endif
+#cmakedefine HAVE_INT16 1
#cmakedefine SIZEOF_UINT16 @SIZEOF_UINT16@
-#if SIZEOF_UINT16
-#define HAVE_UINT16 1
-#endif
-
+#cmakedefine HAVE_UINT16 1
#cmakedefine SIZEOF_INT32 @SIZEOF_INT32@
-#if SIZEOF_INT32
-#define HAVE_INT32 1
-#endif
+#cmakedefine HAVE_INT32 1
#cmakedefine SIZEOF_UINT32 @SIZEOF_UINT32@
-#if SIZEOF_UINT32
-#define HAVE_UINT32 1
-#endif
+#cmakedefine HAVE_UINT32 1
#cmakedefine SIZEOF_U_INT32_T @SIZEOF_U_INT32_T@
-#if SIZEOF_U_INT32_T
-#define HAVE_U_INT32_T 1
-#endif
-
+#cmakedefine HAVE_U_INT32_T 1
#cmakedefine SIZEOF_INT64 @SIZEOF_INT64@
-#if SIZEOF_INT64
-#define HAVE_INT64 1
-#endif
+#cmakedefine HAVE_INT64 1
#cmakedefine SIZEOF_UINT64 @SIZEOF_UINT64@
-#if SIZEOF_UINT64
-#define HAVE_UINT64 1
-#endif
+#cmakedefine HAVE_UINT64 1
+#cmakedefine SIZEOF_BOOL @SIZEOF_BOOL@
+#cmakedefine HAVE_BOOL 1
#cmakedefine SOCKET_SIZE_TYPE @SOCKET_SIZE_TYPE@
-#cmakedefine SIZEOF_BOOL @SIZEOF_BOOL@
-#if SIZEOF_BOOL
-#define HAVE_BOOL 1
-#endif
#cmakedefine HAVE_MBSTATE_T
#define MAX_INDEXES 64
#cmakedefine QSORT_TYPE_IS_VOID 1
-#define RETQSORTTYPE void
+#cmakedefine RETQSORTTYPE @RETQSORTTYPE@
#cmakedefine SIGNAL_RETURN_TYPE_IS_VOID 1
-#define RETSIGTYPE void
-#if SIGNAL_RETURN_TYPE_IS_VOID
-#define VOID_SIGHANDLER 1
-#endif
+#cmakedefine RETSIGTYPE @RETSIGTYPE@
+#cmakedefine VOID_SIGHANDLER 1
#define STRUCT_RLIMIT struct rlimit
#ifdef __APPLE__
@@ -547,7 +512,7 @@
#cmakedefine strtoull @strtoull@
#cmakedefine vsnprintf @vsnprintf@
#if (_MSC_VER > 1310)
-#define HAVE_SETENV
+# define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b)
#endif
@@ -575,7 +540,7 @@
#cmakedefine FN_NO_CASE_SENSE 1
#cmakedefine HAVE_CHARSET_armscii8 1
-#cmakedefine HAVE_CHARSET_ascii
+#cmakedefine HAVE_CHARSET_ascii 1
#cmakedefine HAVE_CHARSET_big5 1
#cmakedefine HAVE_CHARSET_cp1250 1
#cmakedefine HAVE_CHARSET_cp1251 1
@@ -616,6 +581,23 @@
#cmakedefine HAVE_UCA_COLLATIONS 1
#cmakedefine HAVE_COMPRESS 1
+/*
+ Hard coded platform settings
+*/
+
+/* This is ugly, but we need lots of tweaks for HP-UX */
+#cmakedefine HPUX11 1
+#cmakedefine DO_NOT_REMOVE_THREAD_WRAPPERS 1
+#cmakedefine HAVE_BROKEN_PREAD 1
+#cmakedefine HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT 1
+#cmakedefine SNPRINTF_RETURN_TRUNC 1
+#cmakedefine _INCLUDE_LONGLONG 1
+
+/* Mac OS X */
+#cmakedefine SIGNALS_DONT_BREAK_READ 1
+#cmakedefine IGNORE_SIGHUP_SIGQUIT 1
+#cmakedefine _P1003_1B_VISIBLE 1
+#cmakedefine DONT_DECLARE_CXA_PURE_VIRTUAL 1
/*
Stuff that always need to be defined (compile breaks without it)
@@ -637,7 +619,7 @@
#cmakedefine WITH_PERFSCHEMA_STORAGE_ENGINE 1
#cmakedefine WITH_NDBCLUSTER_STORAGE_ENGINE 1
#if (WITH_NDBCLUSTER_STORAGE_ENGINE) && !defined(EMBEDDED_LIBRARY)
-#define HAVE_NDB_BINLOG 1
+# define HAVE_NDB_BINLOG 1
#endif
#cmakedefine DEFAULT_MYSQL_HOME "@DEFAULT_MYSQL_HOME@"
diff --git a/config/ac-macros/maintainer.m4 b/config/ac-macros/maintainer.m4
new file mode 100644
index 00000000000..1b7df75d6f7
--- /dev/null
+++ b/config/ac-macros/maintainer.m4
@@ -0,0 +1,64 @@
+#
+# Control aspects of the development environment which are
+# specific to MySQL maintainers and developers.
+#
+AC_DEFUN([MY_MAINTAINER_MODE], [
+ AC_MSG_CHECKING([whether to enable the maintainer-specific development environment])
+ AC_ARG_ENABLE([mysql-maintainer-mode],
+ [AS_HELP_STRING([--enable-mysql-maintainer-mode],
+ [Enable a MySQL maintainer-specific development environment])],
+ [USE_MYSQL_MAINTAINER_MODE=$enableval],
+ [USE_MYSQL_MAINTAINER_MODE=no])
+ AC_MSG_RESULT([$USE_MYSQL_MAINTAINER_MODE])
+])
+
+# Set warning options required under maintainer mode.
+AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [
+ # Setup GCC warning options.
+ AS_IF([test "$GCC" = "yes"], [
+ C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror"
+ CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter"
+ ])
+
+ # Test whether the warning options work.
+ # Test C options
+ AS_IF([test -n "$C_WARNINGS"], [
+ save_CFLAGS="$CFLAGS"
+ AC_MSG_CHECKING([whether to use C warning options ${C_WARNINGS}])
+ AC_LANG_PUSH(C)
+ CFLAGS="$CFLAGS ${C_WARNINGS}"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_c_warning_flags=yes],
+ [myac_c_warning_flags=no])
+ AC_LANG_POP()
+ AC_MSG_RESULT([$myac_c_warning_flags])
+ CFLAGS="$save_CFLAGS"
+ ])
+
+ # Test C++ options
+ AS_IF([test -n "$CXX_WARNINGS"], [
+ save_CXXFLAGS="$CXXFLAGS"
+ AC_MSG_CHECKING([whether to use C++ warning options ${CXX_WARNINGS}])
+ AC_LANG_PUSH(C++)
+ CXXFLAGS="$CXXFLAGS ${CXX_WARNINGS}"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_cxx_warning_flags=yes],
+ [myac_cxx_warning_flags=no])
+ AC_LANG_POP()
+ AC_MSG_RESULT([$myac_cxx_warning_flags])
+ CXXFLAGS="$save_CXXFLAGS"
+ ])
+
+ # Set compile flag variables.
+ AS_IF([test "$myac_c_warning_flags" = "yes"], [
+ AM_CFLAGS="${AM_CFLAGS} ${C_WARNINGS}"
+ AC_SUBST([AM_CFLAGS])])
+ AS_IF([test "$myac_cxx_warning_flags" = "yes"], [
+ AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS}"
+ AC_SUBST([AM_CXXFLAGS])])
+])
+
+
+# Set compiler flags required under maintainer mode.
+AC_DEFUN([MY_MAINTAINER_MODE_SETUP], [
+ AS_IF([test "$USE_MYSQL_MAINTAINER_MODE" = "yes"],
+ [MY_MAINTAINER_MODE_WARNINGS])
+])
diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4
index 996ac62e025..89de1e5f8fa 100644
--- a/config/ac-macros/misc.m4
+++ b/config/ac-macros/misc.m4
@@ -617,25 +617,19 @@ fi
AC_DEFUN([MYSQL_CHECK_CXX_VERSION], [
-case $SYSTEM_TYPE in
- *netware*)
- CXX_VERSION=`$CXX -version | grep -i version`
- ;;
- *)
- CXX_VERSION=`$CXX --version | sed 1q`
- if test $? -ne "0" -o -z "$CXX_VERSION"
- then
- CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI
- fi
- if test $? -ne "0" -o -z "$CXX_VERSION"
- then
- CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha
- fi
- if test $? -ne "0" -o -z "$CXX_VERSION"
- then
- CXX_VERSION=""
- fi
-esac
+CXX_VERSION=`$CXX --version | sed 1q`
+if test $? -ne "0" -o -z "$CXX_VERSION"
+then
+ CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI
+fi
+if test $? -ne "0" -o -z "$CXX_VERSION"
+then
+ CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha
+fi
+if test $? -ne "0" -o -z "$CXX_VERSION"
+then
+ CXX_VERSION=""
+fi
if test "$CXX_VERSION"
then
AC_MSG_CHECKING("C++ compiler version")
diff --git a/configure.cmake b/configure.cmake
index 246133f1fbe..27950513b36 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -90,6 +90,21 @@ ENDIF(WITHOUT_DYNAMIC_PLUGINS)
# Large files, common flag
SET(_LARGEFILE_SOURCE 1)
+# If finds the size of a type, set SIZEOF_<type> and HAVE_<type>
+FUNCTION(MY_CHECK_TYPE_SIZE type defbase)
+ CHECK_TYPE_SIZE("${type}" SIZEOF_${defbase})
+ IF(SIZEOF_${defbase})
+ SET(HAVE_${defbase} 1 PARENT_SCOPE)
+ ENDIF()
+ENDFUNCTION()
+
+# Same for structs, setting HAVE_STRUCT_<name> instead
+FUNCTION(MY_CHECK_STRUCT_SIZE type defbase)
+ CHECK_TYPE_SIZE("struct ${type}" SIZEOF_${defbase})
+ IF(SIZEOF_${defbase})
+ SET(HAVE_STRUCT_${defbase} 1 PARENT_SCOPE)
+ ENDIF()
+ENDFUNCTION()
# Searches function in libraries
# if function is found, sets output parameter result to the name of the library
@@ -108,6 +123,7 @@ FUNCTION(MY_SEARCH_LIBS func libs result)
CHECK_LIBRARY_EXISTS(${lib} ${func} "" HAVE_${func}_IN_${lib})
IF(HAVE_${func}_IN_${lib})
SET(${result} ${lib} PARENT_SCOPE)
+ SET(HAVE_${result} 1 PARENT_SCOPE)
RETURN()
ENDIF()
ENDFOREACH()
@@ -169,6 +185,7 @@ CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H)
CHECK_INCLUDE_FILES (aio.h HAVE_AIO_H)
CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES (crypt.h HAVE_CRYPT_H)
+CHECK_INCLUDE_FILES (cxxabi.h HAVE_CXXABI_H)
CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H)
@@ -185,6 +202,7 @@ CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
CHECK_INCLUDE_FILES (locale.h HAVE_LOCALE_H)
CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H)
+CHECK_INCLUDE_FILES (ndir.h HAVE_NDIR_H)
CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILES (paths.h HAVE_PATHS_H)
CHECK_INCLUDE_FILES (port.h HAVE_PORT_H)
@@ -193,9 +211,9 @@ CHECK_INCLUDE_FILES (pwd.h HAVE_PWD_H)
CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H)
CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
CHECK_INCLUDE_FILES (semaphore.h HAVE_SEMAPHORE_H)
-CHECK_INCLUDE_FILES (sys/dir.h HAVE_SYS_DIR_H)
+CHECK_INCLUDE_FILES ("sys/types.h;sys/dir.h" HAVE_SYS_DIR_H)
+CHECK_INCLUDE_FILES (sys/ndir.h HAVE_SYS_NDIR_H)
CHECK_INCLUDE_FILES (sys/pte.h HAVE_SYS_PTE_H)
-CHECK_INCLUDE_FILES (sys/ptem.h HAVE_SYS_PTEM_H)
CHECK_INCLUDE_FILES (stddef.h HAVE_STDDEF_H)
CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H)
@@ -220,6 +238,8 @@ CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
CHECK_INCLUDE_FILES ("time.h;sys/timeb.h" HAVE_SYS_TIMEB_H)
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
+CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)
+CHECK_INCLUDE_FILES (termbits.h HAVE_TERMBITS_H)
CHECK_INCLUDE_FILES (termios.h HAVE_TERMIOS_H)
CHECK_INCLUDE_FILES (termio.h HAVE_TERMIO_H)
CHECK_INCLUDE_FILES (termcap.h HAVE_TERMCAP_H)
@@ -233,7 +253,18 @@ CHECK_INCLUDE_FILES (sys/param.h HAVE_SYS_PARAM_H)
CHECK_INCLUDE_FILES (sys/vadvise.h HAVE_SYS_VADVISE_H)
CHECK_INCLUDE_FILES (fnmatch.h HAVE_FNMATCH_H)
CHECK_INCLUDE_FILES (stdarg.h HAVE_STDARG_H)
-CHECK_INCLUDE_FILES("stdlib.h;sys/un.h" HAVE_SYS_UN_H)
+CHECK_INCLUDE_FILES ("stdlib.h;sys/un.h" HAVE_SYS_UN_H)
+CHECK_INCLUDE_FILES (vis.h HAVE_VIS_H)
+CHECK_INCLUDE_FILES (wchar.h HAVE_WCHAR_H)
+CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
+CHECK_INCLUDE_FILES (xfs/xfs.h HAVE_XFS_XFS_H)
+
+IF(HAVE_SYS_STREAM_H)
+ # Needs sys/stream.h on Solaris
+ CHECK_INCLUDE_FILES ("sys/stream.h;sys/ptem.h" HAVE_SYS_PTEM_H)
+ELSE()
+ CHECK_INCLUDE_FILES (sys/ptem.h HAVE_SYS_PTEM_H)
+ENDIF()
# Figure out threading library
#
@@ -250,7 +281,6 @@ CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE)
CHECK_FUNCTION_EXISTS (backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
CHECK_FUNCTION_EXISTS (backtrace_symbols_fd HAVE_BACKTRACE_SYMBOLS_FD)
CHECK_FUNCTION_EXISTS (printstack HAVE_PRINTSTACK)
-CHECK_FUNCTION_EXISTS (bcmp HAVE_BCMP)
CHECK_FUNCTION_EXISTS (bfill HAVE_BFILL)
CHECK_FUNCTION_EXISTS (bmove HAVE_BMOVE)
CHECK_FUNCTION_EXISTS (bsearch HAVE_BSEARCH)
@@ -458,14 +488,11 @@ set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
-D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
SET(CMAKE_EXTRA_INCLUDE_FILES signal.h)
-CHECK_TYPE_SIZE(sigset_t SIZEOF_SIGSET_T)
-IF(SIZEOF_SIGSET_T)
- SET(HAVE_SIGSET_T 1)
-ENDIF()
+MY_CHECK_TYPE_SIZE(sigset_t SIGSET_T)
IF(NOT SIZEOF_SIGSET_T)
SET(sigset_t int)
ENDIF()
-CHECK_TYPE_SIZE(mode_t SIZEOF_MODE_T)
+MY_CHECK_TYPE_SIZE(mode_t MODE_T)
IF(NOT SIZEOF_MODE_T)
SET(mode_t int)
ENDIF()
@@ -475,46 +502,45 @@ IF(HAVE_STDINT_H)
SET(CMAKE_EXTRA_INCLUDE_FILES stdint.h)
ENDIF(HAVE_STDINT_H)
-IF(NOT APPLE)
- # Prevent some checks on OSX, they return ambigious results
- # on universal 32/64 bit binariess
- CHECK_TYPE_SIZE("char *" SIZEOF_CHARP)
- CHECK_TYPE_SIZE(long SIZEOF_LONG)
- CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T)
-ENDIF()
-CHECK_TYPE_SIZE(char SIZEOF_CHAR)
-CHECK_TYPE_SIZE(short SIZEOF_SHORT)
-CHECK_TYPE_SIZE(int SIZEOF_INT)
-CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
+# These first four SIZE_* values are not really used on Mac OS X,
+# as we only know at comile time what architecture to build for,
+# see "config.h.cmake". But as same macro MY_CHECK_TYPE_SIZE also
+# sets HAVE_* macros, we run the check here, doesn't hurt.
+MY_CHECK_TYPE_SIZE("void *" VOIDP)
+MY_CHECK_TYPE_SIZE("char *" CHARP)
+MY_CHECK_TYPE_SIZE(long LONG)
+MY_CHECK_TYPE_SIZE(size_t SIZE_T)
+
+MY_CHECK_TYPE_SIZE(char CHAR)
+MY_CHECK_TYPE_SIZE(short SHORT)
+MY_CHECK_TYPE_SIZE(int INT)
+MY_CHECK_TYPE_SIZE("long long" LONG_LONG)
SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h sys/types.h)
-CHECK_TYPE_SIZE(off_t SIZEOF_OFF_T)
-CHECK_TYPE_SIZE(uchar SIZEOF_UCHAR)
-CHECK_TYPE_SIZE(uint SIZEOF_UINT)
-CHECK_TYPE_SIZE(ulong SIZEOF_ULONG)
-CHECK_TYPE_SIZE(int8 SIZEOF_INT8)
-CHECK_TYPE_SIZE(uint8 SIZEOF_UINT8)
-CHECK_TYPE_SIZE(int16 SIZEOF_INT16)
-CHECK_TYPE_SIZE(uint16 SIZEOF_UINT16)
-CHECK_TYPE_SIZE(int32 SIZEOF_INT32)
-CHECK_TYPE_SIZE(uint32 SIZEOF_UINT32)
-CHECK_TYPE_SIZE(u_int32_t SIZEOF_U_INT32_T)
-CHECK_TYPE_SIZE(int64 SIZEOF_INT64)
-CHECK_TYPE_SIZE(uint64 SIZEOF_UINT64)
+MY_CHECK_TYPE_SIZE(off_t OFF_T)
+MY_CHECK_TYPE_SIZE(uchar UCHAR)
+MY_CHECK_TYPE_SIZE(uint UINT)
+MY_CHECK_TYPE_SIZE(ulong ULONG)
+MY_CHECK_TYPE_SIZE(int8 INT8)
+MY_CHECK_TYPE_SIZE(uint8 UINT8)
+MY_CHECK_TYPE_SIZE(int16 INT16)
+MY_CHECK_TYPE_SIZE(uint16 UINT16)
+MY_CHECK_TYPE_SIZE(int32 INT32)
+MY_CHECK_TYPE_SIZE(uint32 UINT32)
+MY_CHECK_TYPE_SIZE(u_int32_t U_INT32_T)
+MY_CHECK_TYPE_SIZE(int64 INT64)
+MY_CHECK_TYPE_SIZE(uint64 UINT64)
SET (CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
-CHECK_TYPE_SIZE(bool SIZEOF_BOOL)
+MY_CHECK_TYPE_SIZE(bool BOOL)
SET(CMAKE_EXTRA_INCLUDE_FILES)
IF(HAVE_SYS_SOCKET_H)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
ENDIF(HAVE_SYS_SOCKET_H)
-CHECK_TYPE_SIZE(socklen_t SIZEOF_SOCKLEN_T)
+MY_CHECK_TYPE_SIZE(socklen_t SOCKLEN_T)
SET(CMAKE_EXTRA_INCLUDE_FILES)
IF(HAVE_IEEEFP_H)
SET(CMAKE_EXTRA_INCLUDE_FILES ieeefp.h)
- CHECK_TYPE_SIZE(fp_except SIZEOF_FP_EXCEPT)
- IF(SIZEOF_FP_EXCEPT)
- SET(HAVE_FP_EXCEPT TRUE)
- ENDIF()
+ MY_CHECK_TYPE_SIZE(fp_except FP_EXCEPT)
ENDIF()
@@ -678,6 +704,7 @@ int main(int ac, char **av) {}
" SIGNAL_RETURN_TYPE_IS_VOID)
IF(SIGNAL_RETURN_TYPE_IS_VOID)
SET(RETSIGTYPE void)
+ SET(VOID_SIGHANDLER 1)
ELSE(SIGNAL_RETURN_TYPE_IS_VOID)
SET(RETSIGTYPE int)
ENDIF(SIGNAL_RETURN_TYPE_IS_VOID)
@@ -731,7 +758,6 @@ IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
ENDIF()
CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1)
-CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL 1)
#
# Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
@@ -777,7 +803,7 @@ ENDIF(NOT HAVE_POSIX_SIGNALS)
# Assume regular sprintf
SET(SPRINTFS_RETURNS_INT 1)
-IF(CMAKE_COMPILER_IS_GNUCXX)
+IF(CMAKE_COMPILER_IS_GNUCXX AND HAVE_CXXABI_H)
CHECK_CXX_SOURCE_COMPILES("
#include <cxxabi.h>
int main(int argc, char **argv)
@@ -787,9 +813,6 @@ CHECK_CXX_SOURCE_COMPILES("
return 0;
}"
HAVE_ABI_CXA_DEMANGLE)
-IF(HAVE_ABI_CXA_DEMANGLE)
- SET(HAVE_CXXABI_H 1)
-ENDIF()
ENDIF()
CHECK_C_SOURCE_COMPILES("
@@ -991,14 +1014,8 @@ ELSEIF(WIN32)
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} winsock2.h ws2ipdef.h)
ENDIF()
-CHECK_TYPE_SIZE("struct sockaddr_in6" SIZEOF_SOCKADDR_IN6)
-CHECK_TYPE_SIZE("struct in6_addr" SIZEOF_IN6_ADDR)
-IF(SIZEOF_SOCKADDR_IN6)
- SET(HAVE_STRUCT_SOCKADDR_IN6 1)
-ENDIF()
-IF(SIZEOF_IN6_ADDR)
- SET(HAVE_STRUCT_IN6_ADDR 1)
-ENDIF()
+MY_CHECK_STRUCT_SIZE("sockaddr_in6" SOCKADDR_IN6)
+MY_CHECK_STRUCT_SIZE("in6_addr" IN6_ADDR)
IF(HAVE_STRUCT_SOCKADDR_IN6 OR HAVE_STRUCT_IN6_ADDR)
SET(HAVE_IPV6 TRUE CACHE INTERNAL "")
@@ -1038,3 +1055,25 @@ CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_IN
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN)
SET(SPRINTF_RETURNS_INT 1)
+#--------------------------------------------------------------------
+# Hard coded platform settings
+#--------------------------------------------------------------------
+
+# This is ugly, but we need lots of tweaks for HP-UX
+IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
+ SET(HPUX11 1)
+ SET(DO_NOT_REMOVE_THREAD_WRAPPERS 1)
+ SET(HAVE_BROKEN_PREAD 1)
+ SET(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT 1)
+ SET(NO_FCNTL_NONBLOCK 1) # Set conditionally in code above
+ SET(SNPRINTF_RETURN_TRUNC 1)
+ SET(_INCLUDE_LONGLONG 1)
+ENDIF()
+
+IF(APPLE)
+ SET(DONT_DECLARE_CXA_PURE_VIRTUAL 1)
+ SET(IGNORE_SIGHUP_SIGQUIT 1)
+ SET(SIGNALS_DONT_BREAK_READ 1)
+ SET(SIGNAL_WITH_VIO_CLOSE 1) # FIXME better handled in mysql-trunk
+ SET(_P1003_1B_VISIBLE 1)
+ENDIF()
diff --git a/configure.in b/configure.in
index 5de43fc7951..a2f0c432681 100644
--- a/configure.in
+++ b/configure.in
@@ -27,7 +27,7 @@ dnl
dnl When changing the major version number please also check the switch
dnl statement in mysqlbinlog::check_master_version(). You may also need
dnl to update version.c in ndb.
-AC_INIT([MySQL Server], [5.5.5-m3], [], [mysql])
+AC_INIT([MySQL Server], [5.5.6-m3], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM
@@ -80,6 +80,7 @@ MYSQL_TCP_PORT_DEFAULT=3306
MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock"
dnl Include m4
+sinclude(config/ac-macros/maintainer.m4)
sinclude(config/ac-macros/alloca.m4)
sinclude(config/ac-macros/check_cpu.m4)
sinclude(config/ac-macros/character_sets.m4)
@@ -118,6 +119,8 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION)
AC_SUBST(SHARED_LIB_VERSION)
AC_SUBST(AVAILABLE_LANGUAGES)
+# Whether the maintainer mode should be enabled.
+MY_MAINTAINER_MODE
# Canonicalize the configuration name.
@@ -226,14 +229,7 @@ AC_PROG_CXX
AC_PROG_CPP
# Print version of CC and CXX compiler (if they support --version)
-case $SYSTEM_TYPE in
- *netware*)
-CC_VERSION=`$CC -version | grep -i version`
- ;;
- *)
CC_VERSION=`$CC --version | sed 1q`
- ;;
-esac
if test $? -eq "0"
then
AC_MSG_CHECKING("C Compiler version")
@@ -291,40 +287,6 @@ AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
AC_CHECK_PROG(DVIS, tex, manual.dvi)
-#check the return type of sprintf
-AC_MSG_CHECKING("return type of sprintf")
-AC_TRY_RUN([
- int main()
- {
- char* s = "hello";
- char buf[6];
- if((int)sprintf(buf, s) == strlen(s))
- return 0;
-
- return -1;
- }
- ],
- [AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
- AC_MSG_RESULT("int")],
- [AC_TRY_RUN([
- int main()
- {
- char* s = "hello";
- char buf[6];
- if((char*)sprintf(buf,s) == buf + strlen(s))
- return 0;
- return -1;
- } ],
- [AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf])
- AC_MSG_RESULT("ptr")],
- [AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf])
- AC_MSG_RESULT("garbage")]
- )],
- # Cross compile, assume POSIX
- [AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
- AC_MSG_RESULT("int (we assume)")]
-)
-
AC_PATH_PROG(uname_prog, uname, no)
# We should go through this and put all the explictly system dependent
@@ -458,15 +420,10 @@ dnl Find paths to some shell programs
AC_PATH_PROG(LN, ln, ln)
# This must be able to take a -f flag like normal unix ln.
AC_PATH_PROG(LN_CP_F, ln, ln)
-case $SYSTEM_TYPE in
- *netware*) ;;
- *)
- # If ln -f does not exists use -s (AFS systems)
- if test -n "$LN_CP_F"; then
- LN_CP_F="$LN_CP_F -s"
- fi
- ;;
-esac
+# If ln -f does not exists use -s (AFS systems)
+if test -n "$LN_CP_F"; then
+ LN_CP_F="$LN_CP_F -s"
+fi
AC_PATH_PROG(MV, mv, mv)
AC_PATH_PROG(RM, rm, rm)
@@ -506,7 +463,16 @@ if test "$GCC" != "yes" || expr "$CC" : ".*icc.*"
then
ABI_CHECK=""
else
- ABI_CHECK="abi_check"
+ # 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
fi
AC_SUBST(ABI_CHECK)
@@ -550,9 +516,6 @@ else
*cygwin*)
FIND_PROC="$PS -e | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
;;
- *netware*)
- FIND_PROC=
- ;;
*)
AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual.])
esac
@@ -1301,9 +1264,7 @@ case $SYSTEM_TYPE in
if test "$OSVERSION" -gt "600000"
then
# Post user-level threads, MYSQLD_NET_RETRY_COUNT is not needed any more
- AC_MSG_WARN([Adding fix for broken realpath])
- CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
- CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_REALPATH"
+ :
elif test "$OSVERSION" -gt "480100" && \
test "$OSVERSION" -lt "500000" || \
test "$OSVERSION" -gt "500109"
@@ -1356,98 +1317,6 @@ dnl Is this the right match for DEC OSF on alpha?
# fix to handle include of <stdint.h> correctly on OSF1 with cxx compiler
CXXFLAGS="$CXXFLAGS -I/usr/include/cxx -I/usr/include/cxx_cname -I/usr/include -I/usr/include.dtk"
;;
- *netware*)
- # No need for curses library so set it to null
- with_named_curses=""
-
- # No thread library - in LibC
- with_named_thread=""
-
- #
- # Edit Makefile.in files.
- #
- echo -n "configuring Makefile.in files for NetWare... "
- for file in sql/Makefile.in extra/Makefile.in client/Makefile.in
- do
- # echo "#### $file ####"
- filedir="`dirname $file`"
- filebase="`basename $file`"
- filesed=$filedir/$filebase.sed
- #
- # Backup and always use original file
- #
- if test -f $file.bk
- then
- cp -fp $file.bk $file
- else
- cp -fp $file $file.bk
- fi
- case $file in
- sql/Makefile.in)
- # Use gen_lex_hash.linux instead of gen_lex_hash
- # Add library dependencies to mysqld_DEPENDENCIES
- lib_DEPENDENCIES="\$(pstack_libs) \$(openssl_libs) \$(yassl_libs)"
- cat > $filesed << EOF
-s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,
-s%\(mysqld_DEPENDENCIES = \)%\1$lib_DEPENDENCIES %
-EOF
- ;;
- extra/Makefile.in)
- cat > $filesed << EOF
-s,\(extra/comp_err\)\$(EXEEXT),\1.linux,
-EOF
- ;;
- libmysql/Makefile.in)
- cat > $filesed << EOF
-s,libyassl.la,.libs/libyassl.a,
-s,libtaocrypt.la,.libs/libtaocrypt.a,
-EOF
- ;;
- libmysql_r/Makefile.in)
- cat > $filesed << EOF
-s,libyassl.la,.libs/libyassl.a,
-s,libtaocrypt.la,.libs/libtaocrypt.a,
-EOF
- ;;
- client/Makefile.in)
- #
- cat > $filesed << EOF
-s,libmysqlclient.la,.libs/libmysqlclient.a,
-EOF
- ;;
- esac
- if `sed -f $filesed $file > $file.nw`;\
- then
- mv -f $file.nw $file
- rm -f $filesed
- else
- exit 1
- fi
- # wait for file system changes to complete
- sleep 1
- done
- echo "done"
-
- #
- # Make sure the following files are writable.
- #
- # When the files are retrieved from some source code control systems they are read-only.
- #
- echo -n "making sure specific build files are writable... "
- for file in \
- Docs/manual.chm \
- Docs/mysql.info \
- Docs/INSTALL-BINARY \
- INSTALL-SOURCE \
- COPYING
- do
- if test -e $file; then
- chmod +w $file
- fi
- done
- echo "done"
-
- ;;
esac
@@ -1820,12 +1689,7 @@ esac
# System characteristics
-case $SYSTEM_TYPE in
- *netware*) ;;
- *)
AC_SYS_RESTARTABLE_SYSCALLS
- ;;
-esac
# Build optimized or debug version ?
# First check for gcc and g++
@@ -1865,17 +1729,6 @@ else
esac
fi
-case $SYSTEM_TYPE in
- *netware*)
- DEBUG_CFLAGS="-g -DDEBUG -sym internal,codeview4"
- DEBUG_CXXFLAGS="-g -DDEBUG -sym internal,codeview4"
- DEBUG_OPTIMIZE_CC="-DDEBUG"
- DEBUG_OPTIMIZE_CXX="-DDEBUG"
- OPTIMIZE_CFLAGS="-O3 -DNDEBUG"
- OPTIMIZE_CXXFLAGS="-O3 -DNDEBUG"
- ;;
-esac
-
# If the user specified CFLAGS, we won't add any optimizations
if test -n "$SAVE_CFLAGS"
then
@@ -1904,8 +1757,8 @@ 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 -DSAFEMALLOC $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
+ 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])
@@ -2223,18 +2076,13 @@ MYSQL_TZNAME
# Do the c++ compiler have a bool type
MYSQL_CXX_BOOL
# Check some common bugs with gcc 2.8.# on sparc
-case $SYSTEM_TYPE in
- *netware*) ;;
- *)
- MYSQL_CHECK_LONGLONG_TO_FLOAT
- if test "$ac_cv_conv_longlong_to_float" != "yes"
- then
- AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float!
- If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try
- again])
- fi
- ;;
-esac
+MYSQL_CHECK_LONGLONG_TO_FLOAT
+if test "$ac_cv_conv_longlong_to_float" != "yes"
+then
+ AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float!
+ If you are using gcc 2.8.# you should upgrade to egcs 1.0.3
+ or newer and try again])
+fi
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
AC_CHECK_TYPES([u_int32_t])
@@ -2342,7 +2190,7 @@ MYSQL_TYPE_QSORT
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
+AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \
chsize cuserid fchmod fcntl \
fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
@@ -2932,66 +2780,58 @@ readline_h_ln_cmd=""
readline_link=""
want_to_use_readline="no"
-case $SYSTEM_TYPE in
- *netware*)
- # For NetWare, do not need readline
- echo "Skipping readline"
- ;;
- *)
- if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"]
+if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"]
+then
+ readline_topdir="cmd-line-utils"
+ readline_basedir="libedit"
+ readline_dir="$readline_topdir/$readline_basedir"
+ readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a"
+ readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline"
+ compile_libedit=yes
+ AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1)
+ AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1)
+elif test "$with_readline" = "yes"
+then
+ readline_topdir="cmd-line-utils"
+ readline_basedir="readline"
+ readline_dir="$readline_topdir/$readline_basedir"
+ readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
+ readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline"
+ compile_readline=yes
+ want_to_use_readline="yes"
+ AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
+else
+ # Use system readline library
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ MYSQL_CHECK_LIBEDIT_INTERFACE
+ MYSQL_CHECK_NEW_RL_INTERFACE
+ MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
+ AC_LANG_RESTORE
+ if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "$srcdir/cmd-line-utils/readline"]
then
- readline_topdir="cmd-line-utils"
- readline_basedir="libedit"
- readline_dir="$readline_topdir/$readline_basedir"
- readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a"
- readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline"
- compile_libedit=yes
- AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1)
- AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1)
- elif test "$with_readline" = "yes"
+ # Use the new readline interface, but only if the package includes a bundled libreadline
+ # this way we avoid linking commercial source with GPL readline
+ readline_link="-lreadline"
+ want_to_use_readline="yes"
+ elif [test "$mysql_cv_libedit_interface" = "yes"]
then
- readline_topdir="cmd-line-utils"
- readline_basedir="readline"
- readline_dir="$readline_topdir/$readline_basedir"
- readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
- readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline"
- compile_readline=yes
- want_to_use_readline="yes"
- AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
+ # Use libedit
+ readline_link="-ledit"
else
- # Use system readline library
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- MYSQL_CHECK_LIBEDIT_INTERFACE
- MYSQL_CHECK_NEW_RL_INTERFACE
- MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
- AC_LANG_RESTORE
- if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "$srcdir/cmd-line-utils/readline"]
- then
- # Use the new readline interface, but only if the package includes a bundled libreadline
- # this way we avoid linking commercial source with GPL readline
- readline_link="-lreadline"
- want_to_use_readline="yes"
- elif [test "$mysql_cv_libedit_interface" = "yes"]
- then
- # Use libedit
- readline_link="-ledit"
- else
- AC_MSG_ERROR([Could not find system readline or libedit libraries
- Use --with-readline or --with-libedit to use the bundled
- versions of libedit or readline])
- fi
+ AC_MSG_ERROR([Could not find system readline or libedit libraries
+ Use --with-readline or --with-libedit to use the bundled
+ versions of libedit or readline])
fi
+fi
- # if there is no readline, but we want to build with readline, we fail
- if [test "$want_to_use_readline" = "yes"] && [test ! -d "$srcdir/cmd-line-utils/readline"]
- then
- AC_MSG_ERROR([This commercially licensed MySQL source package can't
- be built with libreadline. Please use --with-libedit to use
- the bundled version of libedit instead.])
- fi
- ;;
-esac
+# if there is no readline, but we want to build with readline, we fail
+if [test "$want_to_use_readline" = "yes"] && [test ! -d "$srcdir/cmd-line-utils/readline"]
+then
+ AC_MSG_ERROR([This commercially licensed MySQL source package can't
+ be built with libreadline. Please use --with-libedit to use
+ the bundled version of libedit instead.])
+fi
AC_SUBST(readline_dir)
AC_SUBST(readline_topdir)
@@ -3081,15 +2921,6 @@ AC_SUBST(NON_THREADED_LIBS)
AC_SUBST(STATIC_NSS_FLAGS)
AC_SUBST(sql_client_dirs)
-# If configuring for NetWare, build the netware directory
-netware_dir=
-if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null
-then
- netware_dir="netware"
-fi
-AC_SUBST(netware_dir)
-AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
-
if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"
then
AC_DEFINE([THREAD], [1],
@@ -3142,19 +2973,17 @@ do
done
AC_SUBST(sql_union_dirs)
+#
+# Setup maintainer mode options by the end to not disturb
+# system and other checks.
+#
+MY_MAINTAINER_MODE_SETUP
+
# Some usefull subst
AC_SUBST(CC)
AC_SUBST(GXX)
# Set configuration options for make_binary_distribution
-case $SYSTEM_TYPE in
- *netware*)
- MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
- ;;
- *)
- : # no change for other platforms yet
- ;;
-esac
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
#--------------------------------------------------------------------
@@ -3227,8 +3056,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
cmd-line-utils/Makefile cmd-line-utils/libedit/Makefile dnl
libmysqld/Makefile libmysqld/examples/Makefile dnl
mysql-test/Makefile mysql-test/lib/My/SafeProcess/Makefile dnl
- netware/Makefile sql-bench/Makefile dnl
- include/mysql_version.h plugin/Makefile win/Makefile
+ sql-bench/Makefile include/mysql_version.h plugin/Makefile win/Makefile dnl
cmake/Makefile
)
diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt
index 16e130fa28a..4cf6dd88cb7 100755..100644
--- a/dbug/CMakeLists.txt
+++ b/dbug/CMakeLists.txt
@@ -17,6 +17,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/dbug
${CMAKE_SOURCE_DIR}/include
)
-SET(DBUG_SOURCES dbug.c sanity.c)
+SET(DBUG_SOURCES dbug.c)
ADD_CONVENIENCE_LIBRARY(dbug ${DBUG_SOURCES})
TARGET_LINK_LIBRARIES(dbug mysys)
diff --git a/dbug/Makefile.am b/dbug/Makefile.am
index 4091858a1af..3581b3597ee 100644
--- a/dbug/Makefile.am
+++ b/dbug/Makefile.am
@@ -19,7 +19,7 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a
pkglib_LIBRARIES = libdbug.a
noinst_HEADERS = dbug_long.h
-libdbug_a_SOURCES = dbug.c sanity.c
+libdbug_a_SOURCES = dbug.c
EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \
user.r monty.doc dbug_add_tags.pl \
my_main.c main.c factorial.c dbug_analyze.c \
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 0355d553cff..fd87669b8ca 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -95,7 +95,7 @@
#define fnmatch(A,B,C) strcmp(A,B)
#endif
-#if defined(MSDOS) || defined(__WIN__)
+#if defined(__WIN__)
#include <process.h>
#endif
@@ -128,9 +128,8 @@
#define PROFILE_ON (1 << 7) /* Print out profiling code */
#define PID_ON (1 << 8) /* Identify each line with process id */
#define TIMESTAMP_ON (1 << 9) /* timestamp every line of output */
-#define SANITY_CHECK_ON (1 << 10) /* Check safemalloc on DBUG_ENTER */
-#define FLUSH_ON_WRITE (1 << 11) /* Flush on every write */
-#define OPEN_APPEND (1 << 12) /* Open for append */
+#define FLUSH_ON_WRITE (1 << 10) /* Flush on every write */
+#define OPEN_APPEND (1 << 11) /* Open for append */
#define TRACE_ON ((uint)1 << 31) /* Trace enabled. MUST be the highest bit!*/
#define TRACING (cs->stack->flags & TRACE_ON)
@@ -184,12 +183,6 @@
static void perror(); /* Fake system/library error print routine */
#endif
-#ifdef SAFEMALLOC
-IMPORT int _sanity(const char *file,uint line); /* safemalloc sanity checker */
-#else
-#define _sanity(X,Y) (1)
-#endif
-
/*
* The user may specify a list of functions to trace or
* debug. These lists are kept in a linear linked list,
@@ -309,7 +302,7 @@ static int DoTrace(CODE_STATE *cs);
#define DISABLE_TRACE 4
/* Test to see if file is writable */
-#if defined(HAVE_ACCESS) && !defined(MSDOS)
+#if defined(HAVE_ACCESS)
static BOOLEAN Writable(const char *pathname);
/* Change file owner and group */
static void ChangeOwner(CODE_STATE *cs, char *pathname);
@@ -343,23 +336,19 @@ static unsigned long Clock(void);
#define ERR_OPEN "%s: can't open debug output stream \"%s\": "
#define ERR_CLOSE "%s: can't close debug file: "
#define ERR_ABORT "%s: debugger aborting because %s\n"
-#define ERR_CHOWN "%s: can't change owner/group of \"%s\": "
/*
* Macros and defines for testing file accessibility under UNIX and MSDOS.
*/
#undef EXISTS
-#if !defined(HAVE_ACCESS) || defined(MSDOS)
+#if !defined(HAVE_ACCESS)
#define EXISTS(pathname) (FALSE) /* Assume no existance */
#define Writable(name) (TRUE)
#else
#define EXISTS(pathname) (access(pathname, F_OK) == 0)
#define WRITABLE(pathname) (access(pathname, W_OK) == 0)
#endif
-#ifndef MSDOS
-#define ChangeOwner(cs,name)
-#endif
/*
@@ -705,12 +694,6 @@ int DbugParse(CODE_STATE *cs, const char *control)
else
stack->flags |= TIMESTAMP_ON;
break;
- case 'S':
- if (sign < 0)
- stack->flags &= ~SANITY_CHECK_ON;
- else
- stack->flags |= SANITY_CHECK_ON;
- break;
}
if (!*end)
break;
@@ -1069,7 +1052,6 @@ int _db_explain_ (CODE_STATE *cs, char *buf, size_t len)
op_bool_to_buf('r', cs->stack->sub_level != 0);
op_intf_to_buf('t', cs->stack->maxdepth, MAXDEPTH, TRACING);
op_bool_to_buf('T', cs->stack->flags & TIMESTAMP_ON);
- op_bool_to_buf('S', cs->stack->flags & SANITY_CHECK_ON);
*buf= '\0';
return 0;
@@ -1187,8 +1169,6 @@ void _db_enter_(const char *_func_, const char *_file_,
if (!TRACING) break;
/* fall through */
case DO_TRACE:
- if ((cs->stack->flags & SANITY_CHECK_ON) && _sanity(_file_,_line_))
- cs->stack->flags &= ~SANITY_CHECK_ON;
if (TRACING)
{
if (!cs->locked)
@@ -1247,9 +1227,6 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_)
#endif
if (DoTrace(cs) & DO_TRACE)
{
- if ((cs->stack->flags & SANITY_CHECK_ON) &&
- _sanity(_stack_frame_->file,_line_))
- cs->stack->flags &= ~SANITY_CHECK_ON;
if (TRACING)
{
if (!cs->locked)
@@ -2027,10 +2004,6 @@ static void DBUGOpenFile(CODE_STATE *cs,
else
{
cs->stack->out_file= fp;
- if (newfile)
- {
- ChangeOwner(cs, name);
- }
}
}
}
@@ -2088,10 +2061,6 @@ static FILE *OpenProfile(CODE_STATE *cs, const char *name)
else
{
cs->stack->prof_file= fp;
- if (newfile)
- {
- ChangeOwner(cs, name);
- }
}
}
return fp;
@@ -2285,42 +2254,6 @@ static BOOLEAN Writable(const char *pathname)
/*
* FUNCTION
*
- * ChangeOwner change owner to real user for suid programs
- *
- * SYNOPSIS
- *
- * static VOID ChangeOwner(pathname)
- *
- * DESCRIPTION
- *
- * For unix systems, change the owner of the newly created debug
- * file to the real owner. This is strictly for the benefit of
- * programs that are running with the set-user-id bit set.
- *
- * Note that at this point, the fact that pathname represents
- * a newly created file has already been established. If the
- * program that the debugger is linked to is not running with
- * the suid bit set, then this operation is redundant (but
- * harmless).
- *
- */
-
-#ifndef ChangeOwner
-static void ChangeOwner(CODE_STATE *cs, char *pathname)
-{
- if (chown(pathname, getuid(), getgid()) == -1)
- {
- (void) fprintf(stderr, ERR_CHOWN, cs->process, pathname);
- perror("");
- (void) fflush(stderr);
- }
-}
-#endif
-
-
-/*
- * FUNCTION
- *
* _db_setjmp_ save debugger environment
*
* SYNOPSIS
@@ -2489,7 +2422,7 @@ static unsigned long Clock()
return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000;
}
-#elif defined(MSDOS) || defined(__WIN__)
+#elif defined(__WIN__)
static ulong Clock()
{
@@ -2538,37 +2471,6 @@ static unsigned long Clock()
#endif /* RUSAGE */
#endif /* THREADS */
-#ifdef NO_VARARGS
-
-/*
- * Fake vfprintf for systems that don't support it. If this
- * doesn't work, you are probably SOL...
- */
-
-static int vfprintf(stream, format, ap)
-FILE *stream;
-char *format;
-va_list ap;
-{
- int rtnval;
- ARGS_DCL;
-
- ARG0= va_arg(ap, ARGS_TYPE);
- ARG1= va_arg(ap, ARGS_TYPE);
- ARG2= va_arg(ap, ARGS_TYPE);
- ARG3= va_arg(ap, ARGS_TYPE);
- ARG4= va_arg(ap, ARGS_TYPE);
- ARG5= va_arg(ap, ARGS_TYPE);
- ARG6= va_arg(ap, ARGS_TYPE);
- ARG7= va_arg(ap, ARGS_TYPE);
- ARG8= va_arg(ap, ARGS_TYPE);
- ARG9= va_arg(ap, ARGS_TYPE);
- rtnval= fprintf(stream, format, ARGS_LIST);
- return rtnval;
-}
-
-#endif /* NO_VARARGS */
-
#else
/*
diff --git a/dbug/dbug_analyze.c b/dbug/dbug_analyze.c
index 3263b2ccc59..1ebe8bfd77e 100644
--- a/dbug/dbug_analyze.c
+++ b/dbug/dbug_analyze.c
@@ -561,9 +561,6 @@ FILE *outf;
#define usage() fprintf (DBUG_FILE,"Usage: %s [-v] [prof-file]\n",my_name)
-#ifdef MSDOS
-extern int getopt(int argc, char **argv, char *opts);
-#endif
extern int optind;
extern char *optarg;
@@ -609,118 +606,5 @@ int main (int argc, char **argv)
process (infile);
output (outfile);
DBUG_RETURN (EX_OK);
+ }
}
-}
-
-#ifdef MSDOS
-
-/*
- * From std-unix@ut-sally.UUCP (Moderator, John Quarterman) Sun Nov 3 14:34:15 1985
- * Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gatech.CSNET
- * Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP
- * Path: gatech!akgua!mhuxv!mhuxt!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!ut-sally!std-unix
- * From: std-unix@ut-sally.UUCP (Moderator, John Quarterman)
- * Newsgroups: mod.std.unix
- * Subject: public domain AT&T getopt source
- * Message-ID: <3352@ut-sally.UUCP>
- * Date: 3 Nov 85 19:34:15 GMT
- * Date-Received: 4 Nov 85 12:25:09 GMT
- * Organization: IEEE/P1003 Portable Operating System Environment Committee
- * Lines: 91
- * Approved: jsq@ut-sally.UUCP
- *
- * Here's something you've all been waiting for: the AT&T public domain
- * source for getopt(3). It is the code which was given out at the 1985
- * UNIFORUM conference in Dallas. I obtained it by electronic mail
- * directly from AT&T. The people there assure me that it is indeed
- * in the public domain.
- *
- * There is no manual page. That is because the one they gave out at
- * UNIFORUM was slightly different from the current System V Release 2
- * manual page. The difference apparently involved a note about the
- * famous rules 5 and 6, recommending using white space between an option
- * and its first argument, and not grouping options that have arguments.
- * Getopt itself is currently lenient about both of these things White
- * space is allowed, but not mandatory, and the last option in a group can
- * have an argument. That particular version of the man page evidently
- * has no official existence, and my source at AT&T did not send a copy.
- * The current SVR2 man page reflects the actual behavor of this getopt.
- * However, I am not about to post a copy of anything licensed by AT&T.
- *
- * I will submit this source to Berkeley as a bug fix.
- *
- * I, personally, make no claims or guarantees of any kind about the
- * following source. I did compile it to get some confidence that
- * it arrived whole, but beyond that you're on your own.
- *
- */
-
-/*LINTLIBRARY*/
-
-int opterr = 1;
-int optind = 1;
-int optopt;
-char *optarg;
-
-static void _ERR(s,c,argv)
-char *s;
-int c;
-char *argv[];
-{
- char errbuf[3];
-
- if (opterr) {
- errbuf[0] = c;
- errbuf[1] = '\n';
- (void) fprintf(stderr, "%s", argv[0]);
- (void) fprintf(stderr, "%s", s);
- (void) fprintf(stderr, "%s", errbuf);
- }
-}
-
-int getopt(argc, argv, opts)
-int argc;
-char **argv, *opts;
-{
- static int sp = 1;
- register int c;
- register char *cp;
-
- if(sp == 1)
- if(optind >= argc ||
- argv[optind][0] != '-' || argv[optind][1] == '\0')
- return(EOF);
- else if(strcmp(argv[optind], "--") == 0) {
- optind++;
- return(EOF);
- }
- optopt = c = argv[optind][sp];
- if(c == ':' || (cp=strchr(opts, c)) == NULL) {
- _ERR(": illegal option -- ", c, argv);
- if(argv[optind][++sp] == '\0') {
- optind++;
- sp = 1;
- }
- return('?');
- }
- if(*++cp == ':') {
- if(argv[optind][sp+1] != '\0')
- optarg = &argv[optind++][sp+1];
- else if(++optind >= argc) {
- _ERR(": option requires an argument -- ", c, argv);
- sp = 1;
- return('?');
- } else
- optarg = argv[optind++];
- sp = 1;
- } else {
- if(argv[optind][++sp] == '\0') {
- sp = 1;
- optind++;
- }
- optarg = NULL;
- }
- return(c);
-}
-
-#endif /* !unix && !xenix */
diff --git a/dbug/sanity.c b/dbug/sanity.c
deleted file mode 100644
index df43fc14ba9..00000000000
--- a/dbug/sanity.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Declarate _sanity() if not declared in main program */
-
-#include <my_global.h>
-
-extern int _sanity(const char *file,uint line);
-
-#if defined(SAFEMALLOC) && !defined(MASTER) /* Avoid errors in MySQL */
-int _sanity(const char * file __attribute__((unused)),
- uint line __attribute__((unused)))
-{
- return 0;
-}
-#endif
diff --git a/dbug/user.r b/dbug/user.r
index 847ad80b30f..5628f5a4fa1 100644
--- a/dbug/user.r
+++ b/dbug/user.r
@@ -1019,14 +1019,6 @@ Most useful with
.B DBUG_PUSH
macros used to temporarily alter the
debugger state.
-.LI S
-When compiled with
-.I safemalloc
-this flag forces "sanity" memory checks (for overwrites/underwrites)
-on each
-.B DBUG_ENTER
-and
-.B DBUG_RETURN.
.LI t[,N]
Enable function control flow tracing.
The maximum nesting depth is specified by N, and defaults to
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
index 862635c25dc..27fc31cbdde 100755..100644
--- a/extra/CMakeLists.txt
+++ b/extra/CMakeLists.txt
@@ -24,6 +24,8 @@ ${CMAKE_SOURCE_DIR}/storage/ndb/include/ndbapi
${CMAKE_SOURCE_DIR}/storage/ndb/include/portlib
${CMAKE_SOURCE_DIR}/storage/ndb/include/mgmapi)
+# Default install component for the files is Server here
+SET(MYSQL_INSTALL_COMPONENT Server)
IF(NOT CMAKE_CROSSCOMPILING)
ADD_EXECUTABLE(comp_err comp_err.c)
diff --git a/extra/comp_err.c b/extra/comp_err.c
index 53d8c18262b..3c56770650f 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -387,15 +387,15 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
struct errors *tmp_error, *next_error;
uint count, i;
- my_free((uchar*) default_language, MYF(0));
+ my_free((void*) default_language);
for (tmp_lang= lang_head; tmp_lang; tmp_lang= next_language)
{
next_language= tmp_lang->next_lang;
- my_free(tmp_lang->lang_short_name, MYF(0));
- my_free(tmp_lang->lang_long_name, MYF(0));
- my_free(tmp_lang->charset, MYF(0));
- my_free((uchar*) tmp_lang, MYF(0));
+ my_free(tmp_lang->lang_short_name);
+ my_free(tmp_lang->lang_long_name);
+ my_free(tmp_lang->charset);
+ my_free(tmp_lang);
}
for (tmp_error= error_head; tmp_error; tmp_error= next_error)
@@ -406,17 +406,17 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
{
struct message *tmp;
tmp= dynamic_element(&tmp_error->msg, i, struct message*);
- my_free((uchar*) tmp->lang_short_name, MYF(0));
- my_free((uchar*) tmp->text, MYF(0));
+ my_free(tmp->lang_short_name);
+ my_free(tmp->text);
}
delete_dynamic(&tmp_error->msg);
if (tmp_error->sql_code1[0])
- my_free((uchar*) tmp_error->sql_code1, MYF(0));
+ my_free((void*) tmp_error->sql_code1);
if (tmp_error->sql_code2[0])
- my_free((uchar*) tmp_error->sql_code2, MYF(0));
- my_free((uchar*) tmp_error->er_name, MYF(0));
- my_free((uchar*) tmp_error, MYF(0));
+ my_free((void*) tmp_error->sql_code2);
+ my_free((void*) tmp_error->er_name);
+ my_free(tmp_error);
}
}
@@ -559,7 +559,7 @@ static uint parse_error_offset(char *str)
end= 0;
ioffset= (uint) my_strtoll10(soffset, &end, &error);
- my_free((uchar*) soffset, MYF(0));
+ my_free(soffset);
DBUG_RETURN(ioffset);
}
@@ -665,9 +665,9 @@ static struct message *find_message(struct errors *err, const char *lang,
static ha_checksum checksum_format_specifier(const char* msg)
{
ha_checksum chksum= 0;
- const char* p= msg;
- const char* start= 0;
- int num_format_specifiers= 0;
+ const uchar* p= (const uchar*) msg;
+ const uchar* start= NULL;
+ uint32 num_format_specifiers= 0;
while (*p)
{
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 9595e1b2df8..89fd4104c6f 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -89,9 +89,6 @@ static struct my_option my_long_options[] =
};
-
-#include <help_start.h>
-
static void usage(my_bool version)
{
printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE,
@@ -107,8 +104,6 @@ static void usage(my_bool version)
printf("\nExample usage:\n%s --defaults-file=example.cnf client mysql\n", my_progname);
}
-#include <help_end.h>
-
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
@@ -200,7 +195,7 @@ int main(int argc, char **argv)
for (argument= arguments+1 ; *argument ; argument++)
if (*argument != args_separator) /* skip arguments separator */
puts(*argument);
- my_free((char*) load_default_groups,MYF(0));
+ my_free(load_default_groups);
free_defaults(arguments);
exit(0);
diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c
index e5c06ac9857..d5c9f2f42ae 100644
--- a/extra/mysql_waitpid.c
+++ b/extra/mysql_waitpid.c
@@ -15,8 +15,6 @@
/* Wait until a program dies */
-#ifndef __NETWARE__
-
#include <my_global.h>
#include <m_string.h>
#include <my_sys.h>
@@ -103,15 +101,3 @@ void usage(void)
my_print_help(my_long_options);
exit(-1);
}
-
-#else
-
-#include <stdio.h>
-
-main()
-{
- fprintf(stderr,"This tool has not been ported to NetWare\n");
- return 0;
-}
-
-#endif /* __NETWARE__ */
diff --git a/extra/perror.c b/extra/perror.c
index be9a47d63a4..382805c5dfd 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -102,8 +102,6 @@ static HA_ERRORS ha_errlist[]=
};
-#include <help_start.h>
-
static void print_version(void)
{
printf("%s Ver %s, for %s (%s)\n",my_progname,PERROR_VERSION,
@@ -122,8 +120,6 @@ static void usage(void)
my_print_variables(my_long_options);
}
-#include <help_end.h>
-
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
@@ -281,7 +277,7 @@ int main(int argc,char *argv[])
#endif
{
/*
- On some system, like NETWARE, strerror(unknown_error) returns a
+ On some system, like Linux, strerror(unknown_error) returns a
string 'Unknown Error'. To avoid printing it we try to find the
error string by asking for an impossible big error message.
diff --git a/extra/replace.c b/extra/replace.c
index 3f07183807c..bbe70ba586e 100644
--- a/extra/replace.c
+++ b/extra/replace.c
@@ -262,7 +262,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
MYF(MY_WME))))
{
- my_free((uchar*) pa->typelib.type_names,MYF(0));
+ my_free(pa->typelib.type_names);
DBUG_RETURN (-1);
}
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
@@ -324,9 +324,9 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa)
if (pa->typelib.count)
{
pa->typelib.count=0;
- my_free((uchar*) pa->typelib.type_names,MYF(0));
+ my_free(pa->typelib.type_names);
pa->typelib.type_names=0;
- my_free((uchar*) pa->str,MYF(0));
+ my_free(pa->str);
}
return;
} /* free_pointer_array */
@@ -441,7 +441,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
{
free_sets(&sets);
- my_free((uchar*) found_set,MYF(0));
+ my_free(found_set);
DBUG_RETURN(0);
}
@@ -648,7 +648,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
- rep_str[i].found= (my_bool) (!bcmp(pos,"\\^",3) ? 2 : 1);
+ rep_str[i].found= (my_bool) (!memcmp(pos,"\\^",3) ? 2 : 1);
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
@@ -663,9 +663,9 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1));
}
}
- my_free((uchar*) follow,MYF(0));
+ my_free(follow);
free_sets(&sets);
- my_free((uchar*) found_set,MYF(0));
+ my_free(found_set);
DBUG_PRINT("exit",("Replace table has %d states",sets.count));
DBUG_RETURN(replace);
}
@@ -681,7 +681,7 @@ static int init_sets(REP_SETS *sets,uint states)
if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
SET_MALLOC_HUNC,MYF(MY_WME))))
{
- my_free((uchar*) sets->set,MYF(0));
+ my_free(sets->set);
return 1;
}
return 0;
@@ -742,8 +742,8 @@ static void free_last_set(REP_SETS *sets)
static void free_sets(REP_SETS *sets)
{
- my_free((uchar*)sets->set_buffer,MYF(0));
- my_free((uchar*)sets->bit_buffer,MYF(0));
+ my_free(sets->set_buffer);
+ my_free(sets->bit_buffer);
return;
}
@@ -776,8 +776,8 @@ static void copy_bits(REP_SET *to,REP_SET *from)
static int cmp_bits(REP_SET *set1,REP_SET *set2)
{
- return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
- sizeof(uint) * set1->size_of_bits);
+ return memcmp(set1->bits, set2->bits,
+ sizeof(uint) * set1->size_of_bits);
}
@@ -849,14 +849,14 @@ static short find_found(FOUND_SET *found_set,uint table_offset,
static uint start_at_word(char * pos)
{
- return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0);
+ return (((!memcmp(pos,"\\b",2) && pos[2]) || !memcmp(pos,"\\^",2)) ? 1 : 0);
}
static uint end_of_word(char * pos)
{
char * end=strend(pos);
- return ((end > pos+2 && !bcmp(end-2,"\\b",2)) ||
- (end >= pos+2 && !bcmp(end-2,"\\$",2))) ?
+ return ((end > pos+2 && !memcmp(end-2,"\\b",2)) ||
+ (end >= pos+2 && !memcmp(end-2,"\\$",2))) ?
1 : 0;
}
@@ -950,8 +950,8 @@ static void reset_buffer()
static void free_buffer()
{
- my_free(buffer,MYF(MY_WME));
- my_free(out_buff,MYF(MY_WME));
+ my_free(buffer);
+ my_free(out_buff);
}
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index 4faca1653b2..432a207f424 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -65,8 +65,6 @@ static struct my_option my_long_options[] =
static void verify_sort();
-#include <help_start.h>
-
static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION,
@@ -90,8 +88,6 @@ The numeric-dump-file should contain a numeric stack trace from mysqld.\n\
If the numeric-dump-file is not given, the stack trace is read from stdin.\n");
}
-#include <help_end.h>
-
static void die(const char* fmt, ...)
{
diff --git a/extra/resolveip.c b/extra/resolveip.c
index 90fda977848..094dfecae59 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -155,11 +155,8 @@ int main(int argc, char **argv)
else
{
printf ("Host name of %s is %s", ip,hpaddr->h_name);
-#ifndef __NETWARE__
- /* this information is not available on NetWare */
for (q = hpaddr->h_aliases; *q != 0; q++)
(void) printf(", %s", *q);
-#endif /* __NETWARE__ */
puts("");
}
}
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt
index 82d7e5b7581..63eabb45824 100755..100644
--- a/extra/yassl/CMakeLists.txt
+++ b/extra/yassl/CMakeLists.txt
@@ -28,7 +28,7 @@ ${CMAKE_CXX_FLAGS})
ENDIF()
SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
- src/yassl_imp.cpp src/yassl_int.cpp)
+ src/yassl_imp.cpp src/yassl_int.cpp src/template_instnt.cpp)
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
RESTRICT_SYMBOL_EXPORTS(yassl)
diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp
index 1e761f559e2..1cc4200d10c 100644
--- a/extra/yassl/include/yassl_int.hpp
+++ b/extra/yassl/include/yassl_int.hpp
@@ -34,9 +34,8 @@
#include "openssl/ssl.h" // ASN1_STRING and DH
// Check if _POSIX_THREADS should be forced
-#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux))
+#if !defined(_POSIX_THREADS) && defined(__hpux)
// HPUX does not define _POSIX_THREADS as it's not _fully_ implemented
-// Netware supports pthreads but does not announce it
#define _POSIX_THREADS
#endif
diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp
index 28d7f1b5693..b968ec1e6c3 100644
--- a/extra/yassl/src/crypto_wrapper.cpp
+++ b/extra/yassl/src/crypto_wrapper.cpp
@@ -953,8 +953,9 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info)
info->set = true;
}
}
- fgets(line,sizeof(line), file); // get blank line
- begin = ftell(file);
+ // get blank line
+ if (fgets(line, sizeof(line), file))
+ begin = ftell(file);
}
}
diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp
index eee5d47377f..cebbd9c5529 100644
--- a/extra/yassl/src/socket_wrapper.cpp
+++ b/extra/yassl/src/socket_wrapper.cpp
@@ -37,7 +37,7 @@
#include <fcntl.h>
#endif // _WIN32
-#if defined(__sun) || defined(__SCO_VERSION__) || defined(__NETWARE__)
+#if defined(__sun) || defined(__SCO_VERSION__)
#include <sys/filio.h>
#endif
diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt
index 2c43756b6f4..9417dda4095 100755..100644
--- a/extra/yassl/taocrypt/CMakeLists.txt
+++ b/extra/yassl/taocrypt/CMakeLists.txt
@@ -21,6 +21,7 @@ ADD_DEFINITIONS(${SSL_DEFINES})
SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
+ src/template_instnt.cpp
include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp
include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp
include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp
diff --git a/extra/yassl/taocrypt/include/blowfish.hpp b/extra/yassl/taocrypt/include/blowfish.hpp
index 90d2c014b4c..94bbab7aea8 100644
--- a/extra/yassl/taocrypt/include/blowfish.hpp
+++ b/extra/yassl/taocrypt/include/blowfish.hpp
@@ -51,7 +51,7 @@ public:
enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 };
Blowfish(CipherDir DIR, Mode MODE)
- : Mode_BASE(BLOCK_SIZE, DIR, MODE) {}
+ : Mode_BASE(BLOCK_SIZE, DIR, MODE), sbox_(pbox_ + ROUNDS + 2) {}
#ifdef DO_BLOWFISH_ASM
void Process(byte*, const byte*, word32);
@@ -62,8 +62,8 @@ private:
static const word32 p_init_[ROUNDS + 2];
static const word32 s_init_[4 * 256];
- word32 pbox_[ROUNDS + 2];
- word32 sbox_[4 * 256];
+ word32 pbox_[ROUNDS + 2 + 4 * 256];
+ word32* sbox_;
void crypt_block(const word32 in[2], word32 out[2]) const;
void AsmProcess(const byte* in, byte* out) const;
diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp
index 96648a39aa1..431316b84d1 100644
--- a/extra/yassl/taocrypt/include/misc.hpp
+++ b/extra/yassl/taocrypt/include/misc.hpp
@@ -125,7 +125,7 @@ void CleanUp();
// no gas on these systems ?, disable for now
-#if defined(__sun__) || defined (__QNX__) || defined (__APPLE__)
+#if defined(__sun__) || defined (__APPLE__)
#define TAOCRYPT_DISABLE_X86ASM
#endif
diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp
index b59f61a1cde..9d12b253dd6 100644
--- a/extra/yassl/taocrypt/include/runtime.hpp
+++ b/extra/yassl/taocrypt/include/runtime.hpp
@@ -35,10 +35,7 @@
// Handler for pure virtual functions
namespace __Crun {
- static void pure_error(void)
- {
- assert("Pure virtual method called." == "Aborted");
- }
+ void pure_error(void);
} // namespace __Crun
#endif // __sun
@@ -54,16 +51,7 @@ extern "C" {
#else
#include "kernelc.hpp"
#endif
-
-/* Disallow inline __cxa_pure_virtual() */
-static int __cxa_pure_virtual() __attribute__((noinline, used));
-static int __cxa_pure_virtual()
-{
- // oops, pure virtual called!
- assert(!"Pure virtual method called. Aborted");
- return 0;
-}
-
+ int __cxa_pure_virtual () __attribute__ ((weak));
} // extern "C"
#endif // __GNUC__ > 2
diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp
index b2b42d3dcf0..63eff1d91fc 100644
--- a/extra/yassl/taocrypt/src/aes.cpp
+++ b/extra/yassl/taocrypt/src/aes.cpp
@@ -51,7 +51,7 @@ void AES::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
- else if (mode_ == CBC)
+ else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
@@ -78,6 +78,7 @@ void AES::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
+ }
}
#endif // DO_AES_ASM
diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp
index c221ce3d6cb..47a660d5c96 100644
--- a/extra/yassl/taocrypt/src/algebra.cpp
+++ b/extra/yassl/taocrypt/src/algebra.cpp
@@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
struct WindowSlider
{
- WindowSlider(const Integer &exp, bool fastNegate,
+ WindowSlider(const Integer &expIn, bool fastNegateIn,
unsigned int windowSizeIn=0)
- : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn),
- windowBegin(0), fastNegate(fastNegate), firstTime(true),
+ : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn),
+ windowBegin(0), fastNegate(fastNegateIn), firstTime(true),
finished(false)
{
if (windowSize == 0)
diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp
index 66ff4d829d7..2097b045278 100644
--- a/extra/yassl/taocrypt/src/blowfish.cpp
+++ b/extra/yassl/taocrypt/src/blowfish.cpp
@@ -53,7 +53,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
- else if (mode_ == CBC)
+ else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
@@ -78,6 +78,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
+ }
}
#endif // DO_BLOWFISH_ASM
diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp
index 85733b88aa9..b054e98bef4 100644
--- a/extra/yassl/taocrypt/src/integer.cpp
+++ b/extra/yassl/taocrypt/src/integer.cpp
@@ -283,21 +283,23 @@ DWord() {}
word GetHighHalfAsBorrow() const {return 0-halfs_.high;}
private:
+ struct dword_struct
+ {
+ #ifdef LITTLE_ENDIAN_ORDER
+ word low;
+ word high;
+ #else
+ word high;
+ word low;
+ #endif
+ };
+
union
{
#ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE
dword whole_;
#endif
- struct
- {
- #ifdef LITTLE_ENDIAN_ORDER
- word low;
- word high;
- #else
- word high;
- word low;
- #endif
- } halfs_;
+ struct dword_struct halfs_;
};
};
@@ -1214,20 +1216,24 @@ public:
#define AS1(x) #x ";"
#define AS2(x, y) #x ", " #y ";"
#define AddPrologue \
+ word res; \
__asm__ __volatile__ \
( \
"push %%ebx;" /* save this manually, in case of -fPIC */ \
- "mov %2, %%ebx;" \
+ "mov %3, %%ebx;" \
".intel_syntax noprefix;" \
"push ebp;"
#define AddEpilogue \
"pop ebp;" \
".att_syntax prefix;" \
"pop %%ebx;" \
- : \
+ "mov %%eax, %0;" \
+ : "=g" (res) \
: "c" (C), "d" (A), "m" (B), "S" (N) \
: "%edi", "memory", "cc" \
- );
+ ); \
+ return res;
+
#define MulPrologue \
__asm__ __volatile__ \
( \
diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp
index 402645c93fd..11dd4dc6d66 100644
--- a/extra/yassl/taocrypt/src/misc.cpp
+++ b/extra/yassl/taocrypt/src/misc.cpp
@@ -84,12 +84,23 @@ namespace STL = STL_NAMESPACE;
}
-#if defined(__ICC) || defined(__INTEL_COMPILER)
+#ifdef __sun
+
+// Handler for pure virtual functions
+namespace __Crun {
+ void pure_error() {
+ assert(!"Aborted: pure virtual method called.");
+ }
+}
+
+#endif
+
+#if defined(__ICC) || defined(__INTEL_COMPILER) || (__GNUC__ > 2)
extern "C" {
int __cxa_pure_virtual() {
- assert("Pure virtual method called." == "Aborted");
+ assert(!"Aborted: pure virtual method called.");
return 0;
}
@@ -166,14 +177,6 @@ word Crop(word value, unsigned int size)
#ifdef TAOCRYPT_X86ASM_AVAILABLE
-#ifndef _MSC_VER
- static jmp_buf s_env;
- static void SigIllHandler(int)
- {
- longjmp(s_env, 1);
- }
-#endif
-
bool HaveCpuId()
{
diff --git a/extra/yassl/taocrypt/src/random.cpp b/extra/yassl/taocrypt/src/random.cpp
index 2bbc0a85e8b..729421fc71d 100644
--- a/extra/yassl/taocrypt/src/random.cpp
+++ b/extra/yassl/taocrypt/src/random.cpp
@@ -92,67 +92,6 @@ void OS_Seed::GenerateSeed(byte* output, word32 sz)
}
-#elif defined(__NETWARE__)
-
-/* The OS_Seed implementation for Netware */
-
-#include <nks/thread.h>
-#include <nks/plat.h>
-
-// Loop on high resulution Read Time Stamp Counter
-static void NetwareSeed(byte* output, word32 sz)
-{
- word32 tscResult;
-
- for (word32 i = 0; i < sz; i += sizeof(tscResult)) {
- #if defined(__GNUC__)
- asm volatile("rdtsc" : "=A" (tscResult));
- #else
- #ifdef __MWERKS__
- asm {
- #else
- __asm {
- #endif
- rdtsc
- mov tscResult, eax
- }
- #endif
-
- memcpy(output, &tscResult, sizeof(tscResult));
- output += sizeof(tscResult);
-
- NXThreadYield(); // induce more variance
- }
-}
-
-
-OS_Seed::OS_Seed()
-{
-}
-
-
-OS_Seed::~OS_Seed()
-{
-}
-
-
-void OS_Seed::GenerateSeed(byte* output, word32 sz)
-{
- /*
- Try to use NXSeedRandom as it will generate a strong
- seed using the onboard 82802 chip
-
- As it's not always supported, fallback to default
- implementation if an error is returned
- */
-
- if (NXSeedRandom(sz, output) != 0)
- {
- NetwareSeed(output, sz);
- }
-}
-
-
#else
/* The default OS_Seed implementation */
diff --git a/extra/yassl/taocrypt/src/twofish.cpp b/extra/yassl/taocrypt/src/twofish.cpp
index 84dd35f9191..71601c08162 100644
--- a/extra/yassl/taocrypt/src/twofish.cpp
+++ b/extra/yassl/taocrypt/src/twofish.cpp
@@ -54,7 +54,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
- else if (mode_ == CBC)
+ else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
@@ -82,6 +82,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
+ }
}
#endif // DO_TWOFISH_ASM
diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp
index c921f8f9c69..283c929a2e1 100644
--- a/extra/yassl/testsuite/test.hpp
+++ b/extra/yassl/testsuite/test.hpp
@@ -32,8 +32,7 @@
#endif /* _WIN32 */
-#if !defined(_SOCKLEN_T) && \
- (defined(_WIN32) || defined(__NETWARE__) || defined(__APPLE__))
+#if !defined(_SOCKLEN_T) && (defined(_WIN32) || defined(__APPLE__))
typedef int socklen_t;
#endif
@@ -42,18 +41,14 @@
#if defined(__hpux)
// HPUX uses int* for third parameter to accept
typedef int* ACCEPT_THIRD_T;
-#elif defined(__NETWARE__)
-// NetWare uses size_t* for third parameter to accept
- typedef size_t* ACCEPT_THIRD_T;
#else
typedef socklen_t* ACCEPT_THIRD_T;
#endif
// Check if _POSIX_THREADS should be forced
-#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux))
+#if !defined(_POSIX_THREADS) && defined(__hpux)
// HPUX does not define _POSIX_THREADS as it's not _fully_ implemented
-// Netware supports pthreads but does not announce it
#define _POSIX_THREADS
#endif
@@ -160,6 +155,11 @@ inline void err_sys(const char* msg)
}
+extern "C" {
+ static int PasswordCallBack(char*, int, int, void*);
+}
+
+
static int PasswordCallBack(char* passwd, int sz, int rw, void* userdata)
{
strncpy(passwd, "12345678", sz);
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index e2ef01b3b4c..c3922231047 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -57,7 +57,7 @@ SET(HEADERS
${HEADERS_GEN_CONFIGURE}
)
-INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR})
-INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")
+INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)
+INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development FILES_MATCHING PATTERN "*.h" )
diff --git a/include/Makefile.am b/include/Makefile.am
index e610a8e325c..ad023083829 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc
+# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -15,6 +15,8 @@
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
+pkgpsiincludedir = $(pkgincludedir)/psi
+
BUILT_SOURCES = $(HEADERS_GEN_MAKE) link_sources probes_mysql_nodtrace.h
HEADERS_GEN_CONFIGURE = mysql_version.h
HEADERS_GEN_MAKE = my_config.h
@@ -25,18 +27,16 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
my_xml.h mysql_embed.h mysql/services.h \
mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
my_pthread.h my_no_pthread.h \
- mysql/psi/psi.h mysql/psi/mysql_thread.h \
- mysql/psi/mysql_file.h \
decimal.h errmsg.h my_global.h my_net.h \
my_getopt.h sslopt-longopts.h my_dir.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \
$(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h
-noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
+noinst_HEADERS = config-win.h lf.h my_bit.h \
heap.h my_bitmap.h my_uctype.h password.h \
myisam.h myisampack.h myisammrg.h ft_global.h\
- mysys_err.h my_base.h help_start.h help_end.h \
+ mysys_err.h my_base.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
@@ -45,7 +45,10 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
my_vle.h my_user.h my_atomic.h atomic/nolock.h \
atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
- atomic/solaris.h mysql/innodb_priv.h
+ atomic/solaris.h mysql/innodb_priv.h my_compiler.h
+
+pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \
+ mysql/psi/mysql_file.h
EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base \
CMakeLists.txt \
diff --git a/include/config-netware.h b/include/config-netware.h
deleted file mode 100644
index a4465ea177a..00000000000
--- a/include/config-netware.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Header for NetWare compatible with MySQL */
-
-#ifndef _config_netware_h
-#define _config_netware_h
-
-#define __event_h__
-#define _EVENT_H_
-/*
- These two #define(s) are needed as both libc of NetWare and MySQL have
- files named event.h which causes compilation errors.
-*/
-
-
-/* required headers */
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <screen.h>
-#include <limits.h>
-#include <signal.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <time.h>
-#include <sys/time.h>
-#include <pthread.h>
-#include <termios.h>
-
-#undef _EVENT_H_
-/*
- This #undef exists here because both libc of NetWare and MySQL have
- files named event.h which causes compilation errors.
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* required adjustments */
-#undef HAVE_READDIR_R
-#undef HAVE_RWLOCK_INIT
-#undef HAVE_SCHED_H
-#undef HAVE_SYS_MMAN_H
-#undef HAVE_SYNCH_H
-#undef HAVE_MMAP
-#undef HAVE_RINT
-
-#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
-#define HAVE_PTHREAD_SIGMASK 1
-#define HAVE_PTHREAD_YIELD_ZERO_ARG 1
-#define HAVE_BROKEN_REALPATH 1
-
-/* changes made to make use of LibC-June-2004 for building purpose */
-#undef HAVE_POSIX_SIGNALS
-#undef HAVE_PTHREAD_ATTR_SETSCOPE
-#undef HAVE_ALLOC_A
-#undef HAVE_FINITE
-#undef HAVE_GETPWNAM
-#undef HAVE_GETPWUID
-#undef HAVE_READLINK
-#undef HAVE_STPCPY
-/* changes end */
-
-/* Changes made to make use of LibC-June-2005 for building purpose */
-#undef HAVE_GETPASS
-#undef HAVE_GETRLIMIT
-#undef HAVE_GETRUSAGE
-#undef HAVE_INITGROUPS
-/* Changes end - LibC-June-2005 */
-
-/* no libc crypt() function */
-#ifdef HAVE_OPENSSL
- #define HAVE_CRYPT 1
-#else
- #undef HAVE_CRYPT
-#endif /* HAVE_OPENSSL */
-
-/* Netware has an ancient zlib */
-#undef HAVE_COMPRESS
-#define HAVE_COMPRESS
-#undef HAVE_ARCHIVE_DB
-
-/* include the old function apis */
-#define USE_OLD_FUNCTIONS 1
-
-/* no case sensitivity */
-#define FN_NO_CASE_SENSE 1
-
-/* the thread alarm is not used */
-#define DONT_USE_THR_ALARM 1
-
-/* signals do not interrupt sockets */
-#define SIGNALS_DONT_BREAK_READ 1
-
-/* signal by closing the sockets */
-#define SIGNAL_WITH_VIO_CLOSE 1
-
-/* On NetWare, stack grows towards lower address */
-#define STACK_DIRECTION -1
-
-/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */
-#define NW_THD_STACKSIZE 65536
-
-/* On NetWare, to fix the problem with the deletion of open files */
-#define CANT_DELETE_OPEN_FILES 1
-
-#define FN_LIBCHAR '\\'
-#define FN_ROOTDIR "\\"
-#define FN_DEVCHAR ':'
-
-/* default directory information */
-#define DEFAULT_MYSQL_HOME "sys:/mysql"
-#define PACKAGE "mysql"
-#define DEFAULT_BASEDIR "sys:/"
-#define SHAREDIR "share/"
-#define DEFAULT_CHARSET_HOME "sys:/mysql/"
-#define MYSQL_DATADIR "data/"
-
-/* 64-bit file system calls */
-#define SIZEOF_OFF_T 8
-#define off_t off64_t
-#define chsize chsize64
-#define ftruncate ftruncate64
-#define lseek lseek64
-#define pread pread64
-#define pwrite pwrite64
-#define tell tell64
-
-/* do not use the extended time in LibC sys\stat.h */
-#define _POSIX_SOURCE
-
-/* Some macros for portability */
-
-#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time(NULL)+(SEC); (ABSTIME).tv_nsec=0; }
-
-/* extra protection against CPU Hogs on NetWare */
-#define NETWARE_YIELD pthread_yield()
-/* Screen mode for help texts */
-#define NETWARE_SET_SCREEN_MODE(A) setscreenmode(A)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _config_netware_h */
diff --git a/include/config-win.h b/include/config-win.h
index 269ec0e925a..9e8bb19c12d 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -185,7 +185,6 @@ typedef SSIZE_T ssize_t;
#define SOCKET_SIZE_TYPE int
#define my_socket_defined
#define byte_defined
-#define HUGE_PTR
#define STDCALL __stdcall /* Used by libmysql.dll */
#define isnan(X) _isnan(X)
#define finite(X) _finite(X)
diff --git a/include/hash.h b/include/hash.h
index 7b4ec1b4685..d390cb7d4e6 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -64,14 +64,14 @@ typedef struct st_hash {
typedef uint HASH_SEARCH_STATE;
#define my_hash_init(A,B,C,D,E,F,G,H) \
- _my_hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO)
+ _my_hash_init(A,0,B,C,D,E,F,G,H)
#define my_hash_init2(A,B,C,D,E,F,G,H,I) \
- _my_hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO)
+ _my_hash_init(A,B,C,D,E,F,G,H,I)
my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
ulong default_array_elements, size_t key_offset,
size_t key_length, my_hash_get_key get_key,
void (*free_element)(void*),
- uint flags CALLER_INFO_PROTO);
+ uint flags);
void my_hash_free(HASH *tree);
void my_hash_reset(HASH *hash);
uchar *my_hash_element(HASH *hash, ulong idx);
@@ -100,7 +100,7 @@ my_bool my_hash_check(HASH *hash); /* Only in debug library */
#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H)))
#define my_hash_inited(H) ((H)->blength != 0)
#define my_hash_init_opt(A,B,C,D,E,F,G,H) \
- (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO))
+ (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G,H))
#ifdef __cplusplus
}
diff --git a/include/heap.h b/include/heap.h
index 27aefb5beda..a585371e18f 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -184,12 +184,22 @@ typedef struct st_heap_info
typedef struct st_heap_create_info
{
+ HP_KEYDEF *keydef;
+ ulong max_records;
+ ulong min_records;
uint auto_key; /* keynr [1 - maxkey] for auto key */
uint auto_key_type;
+ uint keys;
+ uint reclength;
ulonglong max_table_size;
ulonglong auto_increment;
my_bool with_auto_increment;
my_bool internal_table;
+ /*
+ TRUE if heap_create should 'pin' the created share by setting
+ open_count to 1. Is only looked at if not internal_table.
+ */
+ my_bool pin_share;
} HP_CREATE_INFO;
/* Prototypes for heap-functions */
@@ -197,6 +207,7 @@ typedef struct st_heap_create_info
extern HP_INFO *heap_open(const char *name, int mode);
extern HP_INFO *heap_open_from_share(HP_SHARE *share, int mode);
extern HP_INFO *heap_open_from_share_and_register(HP_SHARE *share, int mode);
+extern void heap_release_share(HP_SHARE *share, my_bool internal_table);
extern int heap_close(HP_INFO *info);
extern int heap_write(HP_INFO *info,const uchar *buff);
extern int heap_update(HP_INFO *info,const uchar *old,const uchar *newdata);
@@ -205,9 +216,9 @@ extern int heap_scan_init(HP_INFO *info);
extern int heap_scan(register HP_INFO *info, uchar *record);
extern int heap_delete(HP_INFO *info,const uchar *buff);
extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag);
-extern int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
- uint reclength, ulong max_records, ulong min_records,
- HP_CREATE_INFO *create_info, HP_SHARE **share);
+extern int heap_create(const char *name,
+ HP_CREATE_INFO *create_info, HP_SHARE **share,
+ my_bool *created_new_share);
extern int heap_delete_table(const char *name);
extern void heap_drop_table(HP_INFO *info);
extern int heap_extra(HP_INFO *info,enum ha_extra_function function);
diff --git a/include/help_start.h b/include/help_start.h
deleted file mode 100644
index 414f7ec93a0..00000000000
--- a/include/help_start.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef HELP_START_INCLUDED
-#define HELP_START_INCLUDED
-
-/* Copyright (C) 2004-2005 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- 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 */
-
-/* Divert all help information on NetWare to logger screen. */
-
-#ifdef __NETWARE__
-#define printf consoleprintf
-#define puts(s) consoleprintf("%s\n",s)
-#define fputs(s,f) puts(s)
-#define fputc(s,f) consoleprintf("%c", s)
-#define putchar(s) consoleprintf("%c", s)
-#endif
-#endif /* HELP_START_INCLUDED */
diff --git a/include/lf.h b/include/lf.h
index 7e8f05f4ada..d1f592d1047 100644
--- a/include/lf.h
+++ b/include/lf.h
@@ -204,7 +204,7 @@ uint lf_alloc_pool_count(LF_ALLOCATOR *allocator);
#define lf_alloc_get_pins(A) lf_pinbox_get_pins(&(A)->pinbox)
#define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS)
#define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS)
-#define lf_alloc_direct_free(ALLOC, ADDR) my_free((uchar*)(ADDR), MYF(0))
+#define lf_alloc_direct_free(ALLOC, ADDR) my_free((ADDR))
lock_wrap(lf_alloc_new, void *,
(LF_PINS *pins),
diff --git a/include/m_string.h b/include/m_string.h
index 1a2a508edfb..c2779c63941 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -36,10 +36,6 @@
/* need by my_vsnprintf */
#include <stdarg.h>
-#ifdef _AIX
-#undef HAVE_BCMP
-#endif
-
/* This is needed for the definitions of bzero... on solaris */
#if defined(HAVE_STRINGS_H)
#include <strings.h>
@@ -63,14 +59,10 @@
/* Unixware 7 */
#if !defined(HAVE_BFILL)
# define bfill(A,B,C) memset((A),(C),(B))
-# define bmove_align(A,B,C) memcpy((A),(B),(C))
#endif
-#if !defined(HAVE_BCMP)
-# define bcopy(s, d, n) memcpy((d), (s), (n))
-# define bcmp(A,B,C) memcmp((A),(B),(C))
-# define bzero(A,B) memset((A),0,(B))
-# define bmove_align(A,B,C) memcpy((A),(B),(C))
+#if !defined(bzero) && !defined(HAVE_BZERO)
+# define bzero(A,B) memset((A),0,(B))
#endif
#if defined(__cplusplus)
@@ -92,8 +84,8 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
#endif
/* Declared in int2str() */
-extern char NEAR _dig_vec_upper[];
-extern char NEAR _dig_vec_lower[];
+extern char _dig_vec_upper[];
+extern char _dig_vec_lower[];
#ifndef strmov
#define strmov_overlapp(A,B) strmov(A,B)
@@ -116,19 +108,6 @@ extern char NEAR _dig_vec_lower[];
extern void bfill(uchar *dst,size_t len,pchar fill);
#endif
-#if !defined(bzero) && !defined(HAVE_BZERO)
-extern void bzero(uchar * dst,size_t len);
-#endif
-
-#if !defined(bcmp) && !defined(HAVE_BCMP)
-extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
-#endif
-#ifdef HAVE_purify
-extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
-#undef bcmp
-#define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#endif /* HAVE_purify */
-
#ifndef bmove512
extern void bmove512(uchar *dst,const uchar *src,size_t len);
#endif
@@ -156,15 +135,15 @@ extern char *strmov(char *dst,const char *src);
#else
extern char *strmov_overlapp(char *dst,const char *src);
#endif
-extern char *strnmov(char *dst,const char *src,size_t n);
-extern char *strsuff(const char *src,const char *suffix);
-extern char *strcont(const char *src,const char *set);
-extern char *strxcat _VARARGS((char *dst,const char *src, ...));
-extern char *strxmov _VARARGS((char *dst,const char *src, ...));
-extern char *strxcpy _VARARGS((char *dst,const char *src, ...));
-extern char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...));
-extern char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...));
-extern char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...));
+extern char *strnmov(char *dst, const char *src, size_t n);
+extern char *strsuff(const char *src, const char *suffix);
+extern char *strcont(const char *src, const char *set);
+extern char *strxcat(char *dst, const char *src, ...);
+extern char *strxmov(char *dst, const char *src, ...);
+extern char *strxcpy(char *dst, const char *src, ...);
+extern char *strxncat(char *dst, size_t len, const char *src, ...);
+extern char *strxnmov(char *dst, size_t len, const char *src, ...);
+extern char *strxncpy(char *dst, size_t len, const char *src, ...);
/* Prototypes of normal stringfunctions (with may ours) */
diff --git a/include/my_alarm.h b/include/my_alarm.h
index dd2d5642f5f..fa396cf02f9 100644
--- a/include/my_alarm.h
+++ b/include/my_alarm.h
@@ -36,14 +36,14 @@ extern ulong my_time_to_wait_for_lock;
#define ALARM_END (void) signal(SIGALRM,alarm_signal); \
(void) alarm(alarm_old);
#define ALARM_TEST my_have_got_alarm
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
#define ALARM_REINIT (void) alarm(MY_HOW_OFTEN_TO_ALARM); \
(void) signal(SIGALRM,my_set_alarm_variable);\
my_have_got_alarm=0;
#else
#define ALARM_REINIT (void) alarm((uint) MY_HOW_OFTEN_TO_ALARM); \
my_have_got_alarm=0;
-#endif /* DONT_REMEMBER_SIGNAL */
+#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */
#else
#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
#define ALARM_INIT
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index 314dac983b0..0caf2da12d0 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -159,22 +159,6 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
#define bitmap_set_all(MAP) \
(memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
-/**
- check, set and clear a bit of interest of an integer.
-
- If the bit is out of range @retval -1. Otherwise
- bit_is_set @return 0 or 1 reflecting the bit is set or not;
- bit_do_set @return 1 (bit is set 1)
- bit_do_clear @return 0 (bit is cleared to 0)
-*/
-
-#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1)
-#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- ((I) |= (ULL(1) << (B)), 1) : -1)
-#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- ((I) &= ~(ULL(1) << (B)), 0) : -1)
-
#ifdef __cplusplus
}
#endif
diff --git a/include/my_compiler.h b/include/my_compiler.h
new file mode 100644
index 00000000000..1cd46ff4260
--- /dev/null
+++ b/include/my_compiler.h
@@ -0,0 +1,129 @@
+#ifndef MY_COMPILER_INCLUDED
+#define MY_COMPILER_INCLUDED
+
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ Header for compiler-dependent features.
+
+ Intended to contain a set of reusable wrappers for preprocessor
+ macros, attributes, pragmas, and any other features that are
+ specific to a target compiler.
+*/
+
+#include <my_global.h> /* stddef.h offsetof */
+
+/**
+ Compiler-dependent internal convenience macros.
+*/
+
+/* GNU C/C++ */
+#if defined __GNUC__
+/* Any after 2.95... */
+# define MY_ALIGN_EXT
+
+/* Microsoft Visual C++ */
+#elif defined _MSC_VER
+# define MY_ALIGNOF(type) __alignof(type)
+# define MY_ALIGNED(n) __declspec(align(n))
+
+/* Oracle Solaris Studio */
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# if __SUNPRO_C >= 0x590
+# define MY_ALIGN_EXT
+# endif
+
+/* IBM XL C/C++ */
+#elif defined __xlC__
+# if __xlC__ >= 0x0600
+# define MY_ALIGN_EXT
+# endif
+
+/* HP aCC */
+#elif defined(__HP_aCC) || defined(__HP_cc)
+# if (__HP_aCC >= 60000) || (__HP_cc >= 60000)
+# define MY_ALIGN_EXT
+# endif
+#endif
+
+#ifdef MY_ALIGN_EXT
+/** Specifies the minimum alignment of a type. */
+# define MY_ALIGNOF(type) __alignof__(type)
+/** Determine the alignment requirement of a type. */
+# define MY_ALIGNED(n) __attribute__((__aligned__((n))))
+#endif
+
+/**
+ Generic compiler-dependent features.
+*/
+#ifndef MY_ALIGNOF
+# ifdef __cplusplus
+ template<typename type> struct my_alignof_helper { char m1; type m2; };
+ /* Invalid for non-POD types, but most compilers give the right answer. */
+# define MY_ALIGNOF(type) offsetof(my_alignof_helper<type>, m2)
+# else
+# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2)
+# endif
+#endif
+
+/**
+ C++ Type Traits
+*/
+
+#ifdef __cplusplus
+
+/**
+ Opaque storage with a particular alignment.
+*/
+# if defined(MY_ALIGNED)
+/* Partial specialization used due to MSVC++. */
+template<size_t alignment> struct my_alignment_imp;
+template<> struct MY_ALIGNED(1) my_alignment_imp<1> {};
+template<> struct MY_ALIGNED(2) my_alignment_imp<2> {};
+template<> struct MY_ALIGNED(4) my_alignment_imp<4> {};
+template<> struct MY_ALIGNED(8) my_alignment_imp<8> {};
+template<> struct MY_ALIGNED(16) my_alignment_imp<16> {};
+/* ... expand as necessary. */
+# else
+template<size_t alignment>
+struct my_alignment_imp { double m1; };
+# endif
+
+/**
+ A POD type with a given size and alignment.
+
+ @remark If the compiler does not support a alignment attribute
+ (MY_ALIGN macro), the default alignment of a double is
+ used instead.
+
+ @tparam size The minimum size.
+ @tparam alignment The desired alignment: 1, 2, 4, 8 or 16.
+*/
+template <size_t size, size_t alignment>
+struct my_aligned_storage
+{
+ union
+ {
+ char data[size];
+ my_alignment_imp<alignment> align;
+ };
+};
+
+#endif /* __cplusplus */
+
+#include <my_attribute.h>
+
+#endif /* MY_COMPILER_INCLUDED */
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 34681fbc633..19570ac2a67 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -45,7 +45,7 @@ extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
struct _db_stack_frame_ *_stack_frame_);
extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
extern void _db_pargs_(uint _line_,const char *keyword);
-extern void _db_doprnt_ _VARARGS((const char *format,...))
+extern void _db_doprnt_(const char *format,...)
ATTRIBUTE_FORMAT(printf, 1, 2);
extern void _db_dump_(uint _line_,const char *keyword,
const unsigned char *memory, size_t length);
diff --git a/include/my_global.h b/include/my_global.h
index 7b9c34cd724..b0db017c565 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -46,15 +46,6 @@
#define HAVE_ERRNO_AS_DEFINE
#endif /* __CYGWIN__ */
-#if defined(__QNXNTO__) && !defined(FD_SETSIZE)
-#define FD_SETSIZE 1024 /* Max number of file descriptor bits in
- fd_set, used when calling 'select'
- Must be defined before including
- "sys/select.h" and "sys/time.h"
- */
-#endif
-
-
/* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */
#ifdef USE_PRAGMA_IMPLEMENTATION
#define USE_PRAGMA_INTERFACE
@@ -82,20 +73,7 @@
#define CPP_UNNAMED_NS_END }
#endif
-#if defined(_WIN32)
-#include <my_config.h>
-#elif defined(__NETWARE__)
-#include <my_config.h>
-#include <config-netware.h>
-#if defined(__cplusplus) && defined(inline)
-#undef inline /* fix configure problem */
-#endif
-#else
#include <my_config.h>
-#if defined(__cplusplus) && defined(inline)
-#undef inline /* fix configure problem */
-#endif
-#endif /* _WIN32... */
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#define HAVE_PSI_INTERFACE
@@ -108,12 +86,6 @@
#define IF_WIN(A,B) B
#endif
-#ifdef __NETWARE__
-#define IF_NETWARE(A,B) A
-#else
-#define IF_NETWARE(A,B) B
-#endif
-
#ifndef DBUG_OFF
#define IF_DBUG(A,B) A
#else
@@ -143,12 +115,6 @@
#define HAVE_EXTERNAL_CLIENT
#endif
-/* Some defines to avoid ifdefs in the code */
-#ifndef NETWARE_YIELD
-#define NETWARE_YIELD
-#define NETWARE_SET_SCREEN_MODE(A)
-#endif
-
#if defined (_WIN32)
/*
off_t is 32 bit long. We do not use C runtime functions
@@ -591,22 +557,6 @@ C_MODE_END
extern "C" int madvise(void *addr, size_t len, int behav);
#endif
-#ifdef __QNXNTO__
-/* This has to be after include limits.h */
-#define HAVE_ERRNO_AS_DEFINE
-#define HAVE_FCNTL_LOCK
-#undef HAVE_FINITE
-#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */
-#undef LONGLONG_MAX /* standard system library 'limits.h' */
-#ifdef __cplusplus
-#ifndef HAVE_RINT
-#define HAVE_RINT
-#endif /* rint() and isnan() functions are not */
-#define rint(a) std::rint(a) /* visible in C++ scope due to an error */
-#define isnan(a) std::isnan(a) /* in the usr/include/math.h on QNX */
-#endif
-#endif
-
/* We can not live without the following defines */
#define USE_MYFUNC 1 /* Must use syscall indirection */
@@ -627,26 +577,34 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#endif
/* Does the system remember a signal handler after a signal ? */
-#ifndef HAVE_BSD_SIGNALS
-#define DONT_REMEMBER_SIGNAL
+#if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION)
+#define SIGNAL_HANDLER_RESET_ON_DELIVERY
#endif
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
-#define LINT_INIT(var) var=0 /* No uninitialize-warning */
+/*
+ Deprecated workaround for false-positive uninitialized variables
+ warnings. Those should be silenced using tool-specific heuristics.
+
+ Enabled by default for g++ due to the bug referenced below.
+*/
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+ (defined(__GNUC__) && defined(__cplusplus))
+#define LINT_INIT(var) var= 0
#else
#define LINT_INIT(var)
#endif
-/*
+/*
Suppress uninitialized variable warning without generating code.
The _cplusplus is a temporary workaround for C++ code pending a fix
- for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
+ for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
*/
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
- !defined(__GNUC__)
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+ defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else
+/* GCC specific self-initialization which inhibits the warning. */
#define UNINIT_VAR(x) x= x
#endif
@@ -670,7 +628,6 @@ typedef unsigned short ushort;
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
#define test_all_bits(a,b) (((a) & (b)) == (b))
-#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
/* Define some general constants */
@@ -691,7 +648,7 @@ typedef unsigned short ushort;
#define my_const_cast(A) (A)
#endif
-#include <my_attribute.h>
+#include <my_compiler.h>
/*
Wen using the embedded library, users might run into link problems,
@@ -704,16 +661,6 @@ int __cxa_pure_virtual () __attribute__ ((weak));
C_MODE_END
#endif
-/* From old s-system.h */
-
-/*
- Support macros for non ansi & other old compilers. Since such
- things are no longer supported we do nothing. We keep then since
- some of our code may still be needed to upgrade old customers.
-*/
-#define _VARARGS(X) X
-#define _STATIC_VARARGS(X) X
-
/* The DBUG_ON flag always takes precedence over default DBUG_OFF */
#if defined(DBUG_ON) && defined(DBUG_OFF)
#undef DBUG_OFF
@@ -729,7 +676,6 @@ C_MODE_END
#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
#define ASCII_BITS_USED 8 /* Bit char used */
-#define NEAR_F /* No near function handling */
/* Some types that is different between systems */
@@ -889,11 +835,8 @@ typedef SOCKET_SIZE_TYPE size_socket;
How much overhead does malloc have. The code often allocates
something like 1024-MALLOC_OVERHEAD bytes
*/
-#ifdef SAFEMALLOC
-#define MALLOC_OVERHEAD (8+24+4)
-#else
#define MALLOC_OVERHEAD 8
-#endif
+
/* get memory in huncs */
#define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD)
/* Typical record cash */
@@ -1076,20 +1019,6 @@ typedef long long my_ptrdiff_t;
#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))
-#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
-#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
-
-#ifdef __cplusplus
-template <size_t sz> struct Aligned_char_array
-{
- union {
- void *v; // Ensures alignment.
- char arr[sz]; // The actual buffer.
- } u;
- void* arr() { return &u.arr[0]; }
-};
-#endif /* __cplusplus */
-
/*
Custom version of standard offsetof() macro which can be used to get
offsets of members in class for non-POD types (according to the current
@@ -1106,14 +1035,6 @@ template <size_t sz> struct Aligned_char_array
((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10))
#define NullS (char *) 0
-/* Nowdays we do not support MessyDos */
-#ifndef NEAR
-#define NEAR /* Who needs segments ? */
-#define FAR /* On a good machine */
-#ifndef HUGE_PTR
-#define HUGE_PTR
-#endif
-#endif
#ifdef STDCALL
#undef STDCALL
@@ -1625,17 +1546,6 @@ do { doubleget_union _tmp; \
#endif /* WORDS_BIGENDIAN */
-/* sprintf does not always return the number of bytes :- */
-#ifdef SPRINTF_RETURNS_INT
-#define my_sprintf(buff,args) sprintf args
-#else
-#ifdef SPRINTF_RETURNS_PTR
-#define my_sprintf(buff,args) ((int)(sprintf args - buff))
-#else
-#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff))
-#endif
-#endif
-
#ifndef THREAD
#define thread_safe_increment(V,L) (V)++
#define thread_safe_decrement(V,L) (V)--
@@ -1680,25 +1590,12 @@ do { doubleget_union _tmp; \
#endif
-#ifndef __NETWARE__
/*
* Include standard definitions of operator new and delete.
*/
#ifdef __cplusplus
#include <new>
#endif
-#else
-/*
- * Define placement versions of operator new and operator delete since
- * we don't have <new> when building for Netware.
- */
-#ifdef __cplusplus
-inline void *operator new(size_t, void *ptr) { return ptr; }
-inline void *operator new[](size_t, void *ptr) { return ptr; }
-inline void operator delete(void*, void*) { /* Do nothing */ }
-inline void operator delete[](void*, void*) { /* Do nothing */ }
-#endif
-#endif
/* Length of decimal number represented by INT32. */
#define MY_INT32_NUM_DECIMAL_DIGITS 11
@@ -1712,11 +1609,6 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
-#define x_free(A) \
- do { my_free((uchar*)(A), MYF(MY_WME|MY_FAE|MY_ALLOW_ZERO_PTR)); } while (0)
-#define safeFree(X) \
- do { if (X) { my_free((uchar*)(X), MYF(0)); (X) = NULL; } } while (0)
-
/*
Only Linux is known to need an explicit sync of the directory to make sure a
file creation/deletion/renaming in(from,to) this directory durable.
diff --git a/include/my_list.h b/include/my_list.h
index 775b56587b8..ff086e1725b 100644
--- a/include/my_list.h
+++ b/include/my_list.h
@@ -37,7 +37,7 @@ extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
#define list_rest(a) ((a)->next)
#define list_push(a,b) (a)=list_cons((b),(a))
-#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((unsigned char *) old,MYF(MY_FAE)); }
+#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); }
#ifdef __cplusplus
}
diff --git a/include/my_net.h b/include/my_net.h
index 8617f180431..1b8425984ae 100644
--- a/include/my_net.h
+++ b/include/my_net.h
@@ -46,7 +46,7 @@ C_MODE_START
#include <sys/ioctl.h>
#endif
-#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__NETWARE__)
+#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES)
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
diff --git a/include/my_nosys.h b/include/my_nosys.h
index df5639b81e2..ecb60333830 100644
--- a/include/my_nosys.h
+++ b/include/my_nosys.h
@@ -39,7 +39,7 @@ extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,
myf myFlags);
extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count);
-#if !defined(SAFEMALLOC) && defined(USE_HALLOC)
+#if defined(USE_HALLOC)
#define my_malloc(a,b) halloc(a,1)
#define my_no_flags_free(a) hfree(a)
#endif
diff --git a/include/my_pthread.h b/include/my_pthread.h
index ea37f6e6b92..e5ffa0db3bb 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -195,11 +195,6 @@ int pthread_cancel(pthread_t thread);
#include <synch.h>
#endif
-#ifdef __NETWARE__
-void my_pthread_exit(void *status);
-#define pthread_exit(A) my_pthread_exit(A)
-#endif
-
#define pthread_key(T,V) pthread_key_t V
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
@@ -356,7 +351,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
-#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
+#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
#define HAVE_PTHREAD_KILL
#endif
@@ -461,10 +456,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
/* safe_mutex adds checking to mutex for easier debugging */
-#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY)
-#define SAFE_MUTEX_DETECT_DESTROY
-#endif
-
typedef struct st_safe_mutex_t
{
pthread_mutex_t global,mutex;
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index 9250fd4579e..78e3dbca577 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -32,9 +32,7 @@
#define HAVE_STACKTRACE 1
#endif
-#if !defined(__NETWARE__)
#define HAVE_WRITE_CORE
-#endif
#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \
HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \
diff --git a/include/my_sys.h b/include/my_sys.h
index 29c78289a1b..c5702ec7395 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -42,7 +42,7 @@ typedef struct my_aio_result {
#endif /* HAVE_VALGRIND */
#ifndef THREAD
-extern int NEAR my_errno; /* Last error in mysys */
+extern int my_errno; /* Last error in mysys */
#else
#include <my_pthread.h>
#endif
@@ -158,46 +158,15 @@ extern int NEAR my_errno; /* Last error in mysys */
#define GETDATE_FIXEDLENGTH 16
/* defines when allocating data */
-#ifdef SAFEMALLOC
-#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG )
-#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG )
-#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG )
-#define my_checkmalloc() _sanity( __FILE__, __LINE__ )
-#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG)
-#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
-#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
-#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C)
-#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0)
-#define QUICK_SAFEMALLOC sf_malloc_quick=1
-#define NORMAL_SAFEMALLOC sf_malloc_quick=0
-extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
-extern ulonglong sf_malloc_mem_limit;
-
-#define CALLER_INFO_PROTO , const char *sFile, uint uLine
-#define CALLER_INFO , __FILE__, __LINE__
-#define ORIG_CALLER_INFO , sFile, uLine
-#else
-#define my_checkmalloc()
-#undef TERMINATE
-#define TERMINATE(A,B) {}
-#define QUICK_SAFEMALLOC
-#define NORMAL_SAFEMALLOC
extern void *my_malloc(size_t Size,myf MyFlags);
-#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG )
+extern void *my_multi_malloc(myf MyFlags, ...);
extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags);
-extern void my_no_flags_free(void *ptr);
+extern void my_free(void *ptr);
extern void *my_memdup(const void *from,size_t length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags);
extern char *my_strndup(const char *from, size_t length,
myf MyFlags);
-/* we do use FG (as a no-op) in below so that a typo on FG is caught */
-#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
-#define CALLER_INFO_PROTO /* nothing */
-#define CALLER_INFO /* nothing */
-#define ORIG_CALLER_INFO /* nothing */
#define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0)
-#endif
-
#if defined(ENABLED_DEBUG_SYNC)
extern void (*debug_sync_C_callback_ptr)(const char *, size_t);
#define DEBUG_SYNC_C(_sync_point_name_) do { \
@@ -211,11 +180,11 @@ extern void (*debug_sync_C_callback_ptr)(const char *, size_t);
#ifdef HAVE_LARGE_PAGES
extern uint my_get_large_page_size(void);
extern uchar * my_large_malloc(size_t size, myf my_flags);
-extern void my_large_free(uchar * ptr, myf my_flags);
+extern void my_large_free(uchar *ptr);
#else
#define my_get_large_page_size() (0)
#define my_large_malloc(A,B) my_malloc_lock((A),(B))
-#define my_large_free(A,B) my_free_lock((A),(B))
+#define my_large_free(A) my_free_lock((A))
#endif /* HAVE_LARGE_PAGES */
#ifdef HAVE_ALLOCA
@@ -233,7 +202,7 @@ extern void my_large_free(uchar * ptr, myf my_flags);
#define my_afree(PTR) {}
#else
#define my_alloca(SZ) my_malloc(SZ,MYF(0))
-#define my_afree(PTR) my_free(PTR,MYF(MY_WME))
+#define my_afree(PTR) my_free(PTR)
#endif /* HAVE_ALLOCA */
#ifndef errno /* did we already get it? */
@@ -245,7 +214,7 @@ extern int errno; /* declare errno */
#endif /* #ifndef errno */
extern char *home_dir; /* Home directory for user */
extern const char *my_progname; /* program-name (printed in errors) */
-extern char NEAR curr_dir[]; /* Current directory for user */
+extern char curr_dir[]; /* Current directory for user */
extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
myf MyFlags);
@@ -278,17 +247,16 @@ extern void (*my_sigtstp_cleanup)(void),
(*my_sigtstp_restart)(void),
(*my_abort_hook)(int);
/* Executed when comming from shell */
-extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation mask */
-extern int NEAR my_umask_dir,
- NEAR my_recived_signals, /* Signals we have got */
- NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
- NEAR my_dont_interrupt; /* call remember_intr when set */
-extern my_bool NEAR my_use_symdir;
-extern size_t sf_malloc_cur_memory, sf_malloc_max_memory;
+extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */
+extern int my_umask_dir,
+ my_recived_signals, /* Signals we have got */
+ my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
+ my_dont_interrupt; /* call remember_intr when set */
+extern my_bool my_use_symdir;
extern ulong my_default_record_cache_size;
-extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
- NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks;
+extern my_bool my_disable_locking, my_disable_async_io,
+ my_disable_flush_key_blocks, my_disable_symlinks;
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
/* from default.c */
@@ -642,20 +610,6 @@ extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count,
myf MyFlags);
extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
extern my_off_t my_ftell(FILE *stream,myf MyFlags);
-extern void *_mymalloc(size_t uSize,const char *sFile,
- uint uLine, myf MyFlag);
-extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile,
- uint uLine, myf MyFlag);
-extern void * my_multi_malloc _VARARGS((myf MyFlags, ...));
-extern void _myfree(void *pPtr,const char *sFile,uint uLine, myf MyFlag);
-extern int _sanity(const char *sFile, uint uLine);
-extern void *_my_memdup(const void *from, size_t length,
- const char *sFile, uint uLine,myf MyFlag);
-extern char * _my_strdup(const char *from, const char *sFile, uint uLine,
- myf MyFlag);
-extern char *_my_strndup(const char *from, size_t length,
- const char *sFile, uint uLine,
- myf MyFlag);
/* implemented in my_memmem.c */
extern void *my_memmem(const void *haystack, size_t haystacklen,
@@ -684,9 +638,6 @@ extern HANDLE my_get_osfhandle(File fd);
extern void my_osmaperr(unsigned long last_error);
#endif
-#ifndef TERMINATE
-extern void TERMINATE(FILE *file, uint flag);
-#endif
extern void init_glob_errs(void);
extern const char** get_global_errmsgs();
extern void wait_for_free_space(const char *filename, int errors);
@@ -698,10 +649,10 @@ extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_sync(File fd, myf my_flags);
extern int my_sync_dir(const char *dir_name, myf my_flags);
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
-extern void my_error _VARARGS((int nr,myf MyFlags, ...));
-extern void my_printf_error _VARARGS((uint my_err, const char *format,
- myf MyFlags, ...))
- ATTRIBUTE_FORMAT(printf, 2, 4);
+extern void my_error(int nr,myf MyFlags, ...);
+extern void my_printf_error(uint my_err, const char *format,
+ myf MyFlags, ...)
+ ATTRIBUTE_FORMAT(printf, 2, 4);
extern void my_printv_error(uint error, const char *format, myf MyFlags,
va_list ap);
extern int my_error_register(const char** (*get_errmsgs) (),
@@ -835,18 +786,16 @@ extern my_bool real_open_cached_file(IO_CACHE *cache);
extern void close_cached_file(IO_CACHE *cache);
File create_temp_file(char *to, const char *dir, const char *pfx,
int mode, myf MyFlags);
-#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D CALLER_INFO)
-#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D ORIG_CALLER_INFO)
-#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CALLER_INFO)
-#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E ORIG_CALLER_INFO)
-extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size,
- void *init_buffer, uint init_alloc,
- uint alloc_increment
- CALLER_INFO_PROTO);
+#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
+#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
+#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
+#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
+extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
+ void *init_buffer, uint init_alloc,
+ uint alloc_increment);
/* init_dynamic_array() function is deprecated */
-extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
- uint init_alloc,uint alloc_increment
- CALLER_INFO_PROTO);
+extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
+ uint init_alloc, uint alloc_increment);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element);
extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array);
extern uchar *pop_dynamic(DYNAMIC_ARRAY*);
@@ -876,10 +825,10 @@ extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
extern void dynstr_free(DYNAMIC_STRING *str);
#ifdef HAVE_MLOCK
extern void *my_malloc_lock(size_t length,myf flags);
-extern void my_free_lock(void *ptr,myf flags);
+extern void my_free_lock(void *ptr);
#else
#define my_malloc_lock(A,B) my_malloc((A),(B))
-#define my_free_lock(A,B) my_free((A),(B))
+#define my_free_lock(A) my_free((A))
#endif
#define alloc_root_inited(A) ((A)->min_malloc != 0)
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
@@ -963,10 +912,7 @@ extern int my_getncpus();
#define MAP_FAILED ((void *)-1)
#define MS_SYNC 0x0000
-#ifndef __NETWARE__
#define HAVE_MMAP
-#endif
-
void *my_mmap(void *, size_t, int, int, int, my_off_t);
int my_munmap(void *, size_t);
#endif
@@ -1031,10 +977,6 @@ void my_security_attr_free(SECURITY_ATTRIBUTES *sa);
char* my_cgets(char *string, size_t clen, size_t* plen);
#endif
-#ifdef __NETWARE__
-void netware_reg_user(const char *ip, const char *user,
- const char *application);
-#endif
#include <mysql/psi/psi.h>
diff --git a/include/my_time.h b/include/my_time.h
index 829cb706bb6..fdfe130c45f 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -35,8 +35,6 @@ extern uchar days_in_month[];
Using the system built in time_t is not an option as
we rely on the above requirements in the time functions
-
- For example QNX has an unsigned time_t type
*/
typedef long my_time_t;
diff --git a/include/myisam.h b/include/myisam.h
index d590a29c1b3..7547f6b475e 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -55,8 +55,6 @@ extern "C" {
#define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
#define MI_NAME_IEXT ".MYI"
#define MI_NAME_DEXT ".MYD"
-/* Max extra space to use when sorting keys */
-#define MI_MAX_TEMP_LENGTH 2*1024L*1024L*1024L
/* Possible values for myisam_block_size (must be power of 2) */
#define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */
diff --git a/include/mysql.h b/include/mysql.h
index 452b4374cf7..7eef91cf55a 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -79,10 +79,6 @@ extern char *mysql_unix_port;
#define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */
#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */
-#ifdef __NETWARE__
-#pragma pack(push, 8) /* 8 byte alignment */
-#endif
-
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG)
@@ -746,10 +742,6 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
(*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, 1, stmt)
-#ifdef __NETWARE__
-#pragma pack(pop) /* restore alignment */
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index 4fef9e9ec0b..bc5d611ec84 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -233,10 +233,10 @@ extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
extern TYPELIB sql_protocol_typelib;
-my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
+my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
my_ulonglong cur_set, my_ulonglong default_set,
- const char *str, uint length,
- char **err_pos, uint *err_len);
+ const char *str, unsigned int length,
+ char **err_pos, unsigned int *err_len);
typedef struct st_mysql_rows {
struct st_mysql_rows *next;
MYSQL_ROW data;
diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h
index 0a998aaa76c..de145f642e1 100644
--- a/include/mysql/psi/mysql_file.h
+++ b/include/mysql/psi/mysql_file.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef MYSQL_FILE_H
#define MYSQL_FILE_H
@@ -506,9 +506,10 @@ inline_mysql_file_fgets(
char *result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) size, src_file, src_line);
@@ -532,9 +533,10 @@ inline_mysql_file_fgetc(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line);
@@ -558,10 +560,11 @@ inline_mysql_file_fputs(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
size_t bytes= 0;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
{
@@ -588,9 +591,10 @@ inline_mysql_file_fputc(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line);
@@ -614,9 +618,10 @@ inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...)
va_list args;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, __FILE__, __LINE__);
@@ -642,9 +647,10 @@ inline_mysql_file_vfprintf(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -668,9 +674,10 @@ inline_mysql_file_fflush(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_FLUSH);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -700,9 +707,10 @@ inline_mysql_file_fstat(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(filenr,
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, filenr,
PSI_FILE_FSTAT);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -726,9 +734,11 @@ inline_mysql_file_stat(
MY_STAT *result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_STAT,
+ locker= PSI_server->get_thread_file_name_locker(&state,
+ key, PSI_FILE_STAT,
path, &locker);
if (likely(locker != NULL))
PSI_server->start_file_open_wait(locker, src_file, src_line);
@@ -752,9 +762,10 @@ inline_mysql_file_chsize(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(file,
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_CHSIZE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) newlength, src_file,
@@ -784,10 +795,11 @@ inline_mysql_file_fopen(
{
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker
- (key, PSI_FILE_STREAM_OPEN, filename, that);
+ (&state, key, PSI_FILE_STREAM_OPEN, filename, that);
if (likely(locker != NULL))
that->m_psi= PSI_server->start_file_open_wait(locker, src_file,
src_line);
@@ -800,7 +812,7 @@ inline_mysql_file_fopen(
#endif
if (unlikely(that->m_file == NULL))
{
- my_free(that, MYF(0));
+ my_free(that);
return NULL;
}
}
@@ -820,10 +832,11 @@ inline_mysql_file_fclose(
{
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
DBUG_ASSERT(file != NULL);
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_STREAM_CLOSE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -834,7 +847,7 @@ inline_mysql_file_fclose(
if (likely(locker != NULL))
PSI_server->end_file_wait(locker, (size_t) 0);
#endif
- my_free(file, MYF(0));
+ my_free(file);
}
return result;
}
@@ -849,9 +862,10 @@ inline_mysql_file_fread(
size_t result= 0;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
@@ -882,9 +896,10 @@ inline_mysql_file_fwrite(
size_t result= 0;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
@@ -915,9 +930,10 @@ inline_mysql_file_fseek(
my_off_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_SEEK);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -941,9 +957,10 @@ inline_mysql_file_ftell(
my_off_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
- locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
+ locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_TELL);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -967,9 +984,10 @@ inline_mysql_file_create(
File file;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_CREATE,
+ locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE,
filename, &locker);
if (likely(locker != NULL))
PSI_server->start_file_open_wait(locker, src_file, src_line);
@@ -1014,9 +1032,10 @@ inline_mysql_file_open(
File file;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_OPEN,
+ locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_OPEN,
filename, &locker);
if (likely(locker != NULL))
PSI_server->start_file_open_wait(locker, src_file, src_line);
@@ -1040,9 +1059,10 @@ inline_mysql_file_close(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(file,
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_CLOSE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -1066,9 +1086,10 @@ inline_mysql_file_read(
size_t result= 0;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(file,
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
@@ -1099,9 +1120,10 @@ inline_mysql_file_write(
size_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(file,
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
@@ -1132,9 +1154,10 @@ inline_mysql_file_pread(
size_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_READ);
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
}
@@ -1164,9 +1187,10 @@ inline_mysql_file_pwrite(
size_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(file,
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
@@ -1197,9 +1221,10 @@ inline_mysql_file_seek(
my_off_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_SEEK);
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_SEEK);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
}
@@ -1222,9 +1247,10 @@ inline_mysql_file_tell(
my_off_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_TELL);
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_TELL);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
}
@@ -1247,9 +1273,10 @@ inline_mysql_file_delete(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_DELETE,
+ locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE,
name, &locker);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -1273,9 +1300,10 @@ inline_mysql_file_rename(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_RENAME,
+ locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME,
to, &locker);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -1300,9 +1328,10 @@ inline_mysql_file_create_with_symlink(
File file;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_CREATE,
+ locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE,
filename, &locker);
if (likely(locker != NULL))
PSI_server->start_file_open_wait(locker, src_file, src_line);
@@ -1327,9 +1356,10 @@ inline_mysql_file_delete_with_symlink(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_DELETE,
+ locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE,
name, &locker);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -1353,9 +1383,10 @@ inline_mysql_file_rename_with_symlink(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_RENAME,
+ locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME,
to, &locker);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
@@ -1379,9 +1410,10 @@ inline_mysql_file_sync(
int result= 0;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
+ PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
- locker= PSI_server->get_thread_file_descriptor_locker(fd, PSI_FILE_SYNC);
+ locker= PSI_server->get_thread_file_descriptor_locker(&state, fd, PSI_FILE_SYNC);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
}
diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h
index 4e839c7cf6a..d133f2655fb 100644
--- a/include/mysql/psi/mysql_thread.h
+++ b/include/mysql/psi/mysql_thread.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef MYSQL_THREAD_H
#define MYSQL_THREAD_H
@@ -625,9 +625,10 @@ static inline int inline_mysql_mutex_lock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_mutex_locker *locker= NULL;
+ PSI_mutex_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_LOCK);
+ locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_LOCK);
if (likely(locker != NULL))
PSI_server->start_mutex_wait(locker, src_file, src_line);
}
@@ -654,9 +655,10 @@ static inline int inline_mysql_mutex_trylock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_mutex_locker *locker= NULL;
+ PSI_mutex_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_TRYLOCK);
+ locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_TRYLOCK);
if (likely(locker != NULL))
PSI_server->start_mutex_wait(locker, src_file, src_line);
}
@@ -682,13 +684,8 @@ static inline int inline_mysql_mutex_unlock(
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
- {
- thread= PSI_server->get_thread();
- if (likely(thread != NULL))
- PSI_server->unlock_mutex(thread, that->m_psi);
- }
+ PSI_server->unlock_mutex(that->m_psi);
#endif
#ifdef SAFE_MUTEX
result= safe_mutex_unlock(&that->m_mutex, src_file, src_line);
@@ -771,9 +768,10 @@ static inline int inline_mysql_rwlock_rdlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
+ PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
+ locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_READLOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
@@ -798,9 +796,10 @@ static inline int inline_mysql_prlock_rdlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
+ PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
+ locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_READLOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
@@ -825,9 +824,10 @@ static inline int inline_mysql_rwlock_wrlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
+ PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
+ locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_WRITELOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
@@ -852,9 +852,10 @@ static inline int inline_mysql_prlock_wrlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
+ PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
+ locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_WRITELOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
@@ -879,9 +880,10 @@ static inline int inline_mysql_rwlock_tryrdlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
+ PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
+ locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_TRYREADLOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
@@ -906,9 +908,10 @@ static inline int inline_mysql_prlock_tryrdlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
+ PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
+ locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_TRYREADLOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
@@ -933,9 +936,10 @@ static inline int inline_mysql_rwlock_trywrlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
+ PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
+ locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_TRYWRITELOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
@@ -960,9 +964,10 @@ static inline int inline_mysql_prlock_trywrlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
+ PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
+ locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_TRYWRITELOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
@@ -982,13 +987,8 @@ static inline int inline_mysql_rwlock_unlock(
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
- {
- thread= PSI_server->get_thread();
- if (likely(thread != NULL))
- PSI_server->unlock_rwlock(thread, that->m_psi);
- }
+ PSI_server->unlock_rwlock(that->m_psi);
#endif
result= rw_unlock(&that->m_rwlock);
return result;
@@ -1000,13 +1000,8 @@ static inline int inline_mysql_prlock_unlock(
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
- {
- thread= PSI_server->get_thread();
- if (likely(thread != NULL))
- PSI_server->unlock_rwlock(thread, that->m_psi);
- }
+ PSI_server->unlock_rwlock(that->m_psi);
#endif
result= rw_pr_unlock(&that->m_prlock);
return result;
@@ -1053,9 +1048,10 @@ static inline int inline_mysql_cond_wait(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_cond_locker *locker= NULL;
+ PSI_cond_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi,
+ locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi,
PSI_COND_WAIT);
if (likely(locker != NULL))
PSI_server->start_cond_wait(locker, src_file, src_line);
@@ -1081,9 +1077,10 @@ static inline int inline_mysql_cond_timedwait(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_cond_locker *locker= NULL;
+ PSI_cond_locker_state state;
if (likely(PSI_server && that->m_psi))
{
- locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi,
+ locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi,
PSI_COND_TIMEDWAIT);
if (likely(locker != NULL))
PSI_server->start_cond_wait(locker, src_file, src_line);
@@ -1102,13 +1099,8 @@ static inline int inline_mysql_cond_signal(
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
- {
- thread= PSI_server->get_thread();
- if (likely(thread != NULL))
- PSI_server->signal_cond(thread, that->m_psi);
- }
+ PSI_server->signal_cond(that->m_psi);
#endif
result= pthread_cond_signal(&that->m_cond);
return result;
@@ -1119,13 +1111,8 @@ static inline int inline_mysql_cond_broadcast(
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
- {
- thread= PSI_server->get_thread();
- if (likely(thread != NULL))
- PSI_server->broadcast_cond(thread, that->m_psi);
- }
+ PSI_server->broadcast_cond(that->m_psi);
#endif
result= pthread_cond_broadcast(&that->m_cond);
return result;
diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h
index 51446fa83a5..562e4a80fd5 100644
--- a/include/mysql/psi/psi.h
+++ b/include/mysql/psi/psi.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
#define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
@@ -422,6 +422,175 @@ struct PSI_file_info_v1
int m_flags;
};
+/**
+ State data storage for @c get_thread_mutex_locker_v1_t.
+ This structure provide temporary storage to a mutex locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_mutex_locker_v1_t
+*/
+struct PSI_mutex_locker_state_v1
+{
+ /** Internal state. */
+ uint m_flags;
+ /** Current mutex. */
+ struct PSI_mutex *m_mutex;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ ulonglong m_timer_start;
+ /** Timer function. */
+ ulonglong (*m_timer)(void);
+ /** Current operation. */
+ enum PSI_mutex_operation m_operation;
+ /** Source file. */
+ const char* m_src_file;
+ /** Source line number. */
+ int m_src_line;
+ /** Internal data. */
+ void *m_wait;
+};
+
+/**
+ State data storage for @c get_thread_rwlock_locker_v1_t.
+ This structure provide temporary storage to a rwlock locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_rwlock_locker_v1_t
+*/
+struct PSI_rwlock_locker_state_v1
+{
+ /** Internal state. */
+ uint m_flags;
+ /** Current rwlock. */
+ struct PSI_rwlock *m_rwlock;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ ulonglong m_timer_start;
+ /** Timer function. */
+ ulonglong (*m_timer)(void);
+ /** Current operation. */
+ enum PSI_rwlock_operation m_operation;
+ /** Source file. */
+ const char* m_src_file;
+ /** Source line number. */
+ int m_src_line;
+ /** Internal data. */
+ void *m_wait;
+};
+
+/**
+ State data storage for @c get_thread_cond_locker_v1_t.
+ This structure provide temporary storage to a condition locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_cond_locker_v1_t
+*/
+struct PSI_cond_locker_state_v1
+{
+ /** Internal state. */
+ uint m_flags;
+ /** Current condition. */
+ struct PSI_cond *m_cond;
+ /** Current mutex. */
+ struct PSI_mutex *m_mutex;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ ulonglong m_timer_start;
+ /** Timer function. */
+ ulonglong (*m_timer)(void);
+ /** Current operation. */
+ enum PSI_cond_operation m_operation;
+ /** Source file. */
+ const char* m_src_file;
+ /** Source line number. */
+ int m_src_line;
+ /** Internal data. */
+ void *m_wait;
+};
+
+/**
+ State data storage for @c get_thread_file_name_locker_v1_t.
+ This structure provide temporary storage to a file locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_file_name_locker_v1_t
+ @sa get_thread_file_stream_locker_v1_t
+ @sa get_thread_file_descriptor_locker_v1_t
+*/
+struct PSI_file_locker_state_v1
+{
+ /** Internal state. */
+ uint m_flags;
+ /** Current file. */
+ struct PSI_file *m_file;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Operation number of bytes. */
+ size_t m_number_of_bytes;
+ /** Timer start. */
+ ulonglong m_timer_start;
+ /** Timer function. */
+ ulonglong (*m_timer)(void);
+ /** Current operation. */
+ enum PSI_file_operation m_operation;
+ /** Source file. */
+ const char* m_src_file;
+ /** Source line number. */
+ int m_src_line;
+ /** Internal data. */
+ void *m_wait;
+};
+
+/**
+ State data storage for @c get_thread_table_locker_v1_t.
+ This structure provide temporary storage to a table locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_table_locker_v1_t
+*/
+struct PSI_table_locker_state_v1
+{
+ /** Internal state. */
+ uint m_flags;
+ /** Current table handle. */
+ struct PSI_table *m_table;
+ /** Current table share. */
+ struct PSI_table_share *m_table_share;
+ /** Instrumentation class. */
+ void *m_class;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ ulonglong m_timer_start;
+ /** Timer function. */
+ ulonglong (*m_timer)(void);
+ /* Current operation (waiting for WL#4895). */
+ /* enum PSI_table_operation m_operation; */
+ /** Current table io index. */
+ uint m_index;
+ /** Current table lock index. */
+ uint m_lock_index;
+ /** Source file. */
+ const char* m_src_file;
+ /** Source line number. */
+ int m_src_line;
+ /** Internal data. */
+ void *m_wait;
+};
+
/* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */
/**
@@ -619,40 +788,51 @@ typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
/**
Get a mutex instrumentation locker.
+ @param state data storage for the locker
@param mutex the instrumented mutex to lock
@return a mutex locker, or NULL
*/
typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t)
- (struct PSI_mutex *mutex, enum PSI_mutex_operation op);
+ (struct PSI_mutex_locker_state_v1 *state,
+ struct PSI_mutex *mutex,
+ enum PSI_mutex_operation op);
/**
Get a rwlock instrumentation locker.
+ @param state data storage for the locker
@param rwlock the instrumented rwlock to lock
@return a rwlock locker, or NULL
*/
typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t)
- (struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op);
+ (struct PSI_rwlock_locker_state_v1 *state,
+ struct PSI_rwlock *rwlock,
+ enum PSI_rwlock_operation op);
/**
Get a cond instrumentation locker.
+ @param state data storage for the locker
@param cond the instrumented condition to wait on
@param mutex the instrumented mutex associated with the condition
@return a condition locker, or NULL
*/
typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t)
- (struct PSI_cond *cond, struct PSI_mutex *mutex,
+ (struct PSI_cond_locker_state_v1 *state,
+ struct PSI_cond *cond, struct PSI_mutex *mutex,
enum PSI_cond_operation op);
/**
Get a table instrumentation locker.
+ @param state data storage for the locker
@param table the instrumented table to lock
@return a table locker, or NULL
*/
typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t)
- (struct PSI_table *table);
+ (struct PSI_table_locker_state_v1 *state,
+ struct PSI_table *table);
/**
Get a file instrumentation locker, for opening or creating a file.
+ @param state data storage for the locker
@param key the file instrumentation key
@param op the operation to perform
@param name the file name
@@ -660,58 +840,59 @@ typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t)
@return a file locker, or NULL
*/
typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t)
- (PSI_file_key key, enum PSI_file_operation op, const char *name,
+ (struct PSI_file_locker_state_v1 *state,
+ PSI_file_key key, enum PSI_file_operation op, const char *name,
const void *identity);
/**
Get a file stream instrumentation locker.
+ @param state data storage for the locker
@param file the file stream to access
@param op the operation to perform
@return a file locker, or NULL
*/
typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t)
- (struct PSI_file *file, enum PSI_file_operation op);
+ (struct PSI_file_locker_state_v1 *state,
+ struct PSI_file *file, enum PSI_file_operation op);
/**
Get a file instrumentation locker.
+ @param state data storage for the locker
@param file the file descriptor to access
@param op the operation to perform
@return a file locker, or NULL
*/
typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t)
- (File file, enum PSI_file_operation op);
+ (struct PSI_file_locker_state_v1 *state,
+ File file, enum PSI_file_operation op);
/**
Record a mutex instrumentation unlock event.
- @param thread the running thread instrumentation
@param mutex the mutex instrumentation
*/
typedef void (*unlock_mutex_v1_t)
- (struct PSI_thread *thread, struct PSI_mutex *mutex);
+ (struct PSI_mutex *mutex);
/**
Record a rwlock instrumentation unlock event.
- @param thread the running thread instrumentation
@param rwlock the rwlock instrumentation
*/
typedef void (*unlock_rwlock_v1_t)
- (struct PSI_thread *thread, struct PSI_rwlock *rwlock);
+ (struct PSI_rwlock *rwlock);
/**
Record a condition instrumentation signal event.
- @param thread the running thread instrumentation
@param cond the cond instrumentation
*/
typedef void (*signal_cond_v1_t)
- (struct PSI_thread *thread, struct PSI_cond *cond);
+ (struct PSI_cond *cond);
/**
Record a condition instrumentation broadcast event.
- @param thread the running thread instrumentation
@param cond the cond instrumentation
*/
typedef void (*broadcast_cond_v1_t)
- (struct PSI_thread *thread, struct PSI_cond *cond);
+ (struct PSI_cond *cond);
/**
Record a mutex instrumentation wait start event.
@@ -1013,6 +1194,36 @@ struct PSI_file_info_v2
int placeholder;
};
+struct PSI_mutex_locker_state_v2
+{
+ /** Placeholder */
+ int placeholder;
+};
+
+struct PSI_rwlock_locker_state_v2
+{
+ /** Placeholder */
+ int placeholder;
+};
+
+struct PSI_cond_locker_state_v2
+{
+ /** Placeholder */
+ int placeholder;
+};
+
+struct PSI_file_locker_state_v2
+{
+ /** Placeholder */
+ int placeholder;
+};
+
+struct PSI_table_locker_state_v2
+{
+ /** Placeholder */
+ int placeholder;
+};
+
/** @} (end of group Group_PSI_v2) */
#endif /* HAVE_PSI_2 */
@@ -1056,6 +1267,11 @@ typedef struct PSI_rwlock_info_v1 PSI_rwlock_info;
typedef struct PSI_cond_info_v1 PSI_cond_info;
typedef struct PSI_thread_info_v1 PSI_thread_info;
typedef struct PSI_file_info_v1 PSI_file_info;
+typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
+typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
+typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
+typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
+typedef struct PSI_table_locker_state_v1 PSI_table_locker_state;
#endif
#ifdef USE_PSI_2
@@ -1065,6 +1281,11 @@ typedef struct PSI_rwlock_info_v2 PSI_rwlock_info;
typedef struct PSI_cond_info_v2 PSI_cond_info;
typedef struct PSI_thread_info_v2 PSI_thread_info;
typedef struct PSI_file_info_v2 PSI_file_info;
+typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state;
+typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state;
+typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state;
+typedef struct PSI_file_locker_state_v2 PSI_file_locker_state;
+typedef struct PSI_table_locker_state_v2 PSI_table_locker_state;
#endif
#else /* HAVE_PSI_INTERFACE */
diff --git a/include/mysql/psi/psi_abi_v1.h b/include/mysql/psi/psi_abi_v1.h
index c9dfd031668..0f62291696f 100644
--- a/include/mysql/psi/psi_abi_v1.h
+++ b/include/mysql/psi/psi_abi_v1.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
/**
@file mysql/psi/psi_abi_v1.h
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index 6ecd0f3098d..adb3010469b 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -88,6 +88,71 @@ struct PSI_file_info_v1
const char *m_name;
int m_flags;
};
+struct PSI_mutex_locker_state_v1
+{
+ uint m_flags;
+ struct PSI_mutex *m_mutex;
+ struct PSI_thread *m_thread;
+ ulonglong m_timer_start;
+ ulonglong (*m_timer)(void);
+ enum PSI_mutex_operation m_operation;
+ const char* m_src_file;
+ int m_src_line;
+ void *m_wait;
+};
+struct PSI_rwlock_locker_state_v1
+{
+ uint m_flags;
+ struct PSI_rwlock *m_rwlock;
+ struct PSI_thread *m_thread;
+ ulonglong m_timer_start;
+ ulonglong (*m_timer)(void);
+ enum PSI_rwlock_operation m_operation;
+ const char* m_src_file;
+ int m_src_line;
+ void *m_wait;
+};
+struct PSI_cond_locker_state_v1
+{
+ uint m_flags;
+ struct PSI_cond *m_cond;
+ struct PSI_mutex *m_mutex;
+ struct PSI_thread *m_thread;
+ ulonglong m_timer_start;
+ ulonglong (*m_timer)(void);
+ enum PSI_cond_operation m_operation;
+ const char* m_src_file;
+ int m_src_line;
+ void *m_wait;
+};
+struct PSI_file_locker_state_v1
+{
+ uint m_flags;
+ struct PSI_file *m_file;
+ struct PSI_thread *m_thread;
+ size_t m_number_of_bytes;
+ ulonglong m_timer_start;
+ ulonglong (*m_timer)(void);
+ enum PSI_file_operation m_operation;
+ const char* m_src_file;
+ int m_src_line;
+ void *m_wait;
+};
+struct PSI_table_locker_state_v1
+{
+ uint m_flags;
+ struct PSI_table *m_table;
+ struct PSI_table_share *m_table_share;
+ void *m_class;
+ struct PSI_thread *m_thread;
+ ulonglong m_timer_start;
+ ulonglong (*m_timer)(void);
+ uint m_index;
+ uint m_lock_index;
+ const char* m_src_file;
+ int m_src_line;
+ void *m_wait;
+};
typedef void (*register_mutex_v1_t)
(const char *category, struct PSI_mutex_info_v1 *info, int count);
typedef void (*register_rwlock_v1_t)
@@ -129,29 +194,38 @@ typedef void (*set_thread_v1_t)(struct PSI_thread *thread);
typedef void (*delete_current_thread_v1_t)(void);
typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t)
- (struct PSI_mutex *mutex, enum PSI_mutex_operation op);
+ (struct PSI_mutex_locker_state_v1 *state,
+ struct PSI_mutex *mutex,
+ enum PSI_mutex_operation op);
typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t)
- (struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op);
+ (struct PSI_rwlock_locker_state_v1 *state,
+ struct PSI_rwlock *rwlock,
+ enum PSI_rwlock_operation op);
typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t)
- (struct PSI_cond *cond, struct PSI_mutex *mutex,
+ (struct PSI_cond_locker_state_v1 *state,
+ struct PSI_cond *cond, struct PSI_mutex *mutex,
enum PSI_cond_operation op);
typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t)
- (struct PSI_table *table);
+ (struct PSI_table_locker_state_v1 *state,
+ struct PSI_table *table);
typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t)
- (PSI_file_key key, enum PSI_file_operation op, const char *name,
+ (struct PSI_file_locker_state_v1 *state,
+ PSI_file_key key, enum PSI_file_operation op, const char *name,
const void *identity);
typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t)
- (struct PSI_file *file, enum PSI_file_operation op);
+ (struct PSI_file_locker_state_v1 *state,
+ struct PSI_file *file, enum PSI_file_operation op);
typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t)
- (File file, enum PSI_file_operation op);
+ (struct PSI_file_locker_state_v1 *state,
+ File file, enum PSI_file_operation op);
typedef void (*unlock_mutex_v1_t)
- (struct PSI_thread *thread, struct PSI_mutex *mutex);
+ (struct PSI_mutex *mutex);
typedef void (*unlock_rwlock_v1_t)
- (struct PSI_thread *thread, struct PSI_rwlock *rwlock);
+ (struct PSI_rwlock *rwlock);
typedef void (*signal_cond_v1_t)
- (struct PSI_thread *thread, struct PSI_cond *cond);
+ (struct PSI_cond *cond);
typedef void (*broadcast_cond_v1_t)
- (struct PSI_thread *thread, struct PSI_cond *cond);
+ (struct PSI_cond *cond);
typedef void (*start_mutex_wait_v1_t)
(struct PSI_mutex_locker *locker, const char *src_file, uint src_line);
typedef void (*end_mutex_wait_v1_t)
@@ -240,5 +314,10 @@ typedef struct PSI_rwlock_info_v1 PSI_rwlock_info;
typedef struct PSI_cond_info_v1 PSI_cond_info;
typedef struct PSI_thread_info_v1 PSI_thread_info;
typedef struct PSI_file_info_v1 PSI_file_info;
+typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
+typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
+typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
+typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
+typedef struct PSI_table_locker_state_v1 PSI_table_locker_state;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
diff --git a/include/mysql/psi/psi_abi_v2.h b/include/mysql/psi/psi_abi_v2.h
index e720c4c2b7c..08bca609b41 100644
--- a/include/mysql/psi/psi_abi_v2.h
+++ b/include/mysql/psi/psi_abi_v2.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
/**
@file mysql/psi/psi_abi_v1.h
diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp
index b32415a59b4..63f8c52c50a 100644
--- a/include/mysql/psi/psi_abi_v2.h.pp
+++ b/include/mysql/psi/psi_abi_v2.h.pp
@@ -82,11 +82,36 @@ struct PSI_file_info_v2
{
int placeholder;
};
+struct PSI_mutex_locker_state_v2
+{
+ int placeholder;
+};
+struct PSI_rwlock_locker_state_v2
+{
+ int placeholder;
+};
+struct PSI_cond_locker_state_v2
+{
+ int placeholder;
+};
+struct PSI_file_locker_state_v2
+{
+ int placeholder;
+};
+struct PSI_table_locker_state_v2
+{
+ int placeholder;
+};
typedef struct PSI_v2 PSI;
typedef struct PSI_mutex_info_v2 PSI_mutex_info;
typedef struct PSI_rwlock_info_v2 PSI_rwlock_info;
typedef struct PSI_cond_info_v2 PSI_cond_info;
typedef struct PSI_thread_info_v2 PSI_thread_info;
typedef struct PSI_file_info_v2 PSI_file_info;
+typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state;
+typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state;
+typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state;
+typedef struct PSI_file_locker_state_v2 PSI_file_locker_state;
+typedef struct PSI_table_locker_state_v2 PSI_table_locker_state;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
diff --git a/include/mysys_err.h b/include/mysys_err.h
index 6c18055b31b..9629dfec014 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -15,17 +15,15 @@
#ifndef _mysys_err_h
#define _mysys_err_h
-#ifdef __cplusplus
-
-#include "my_global.h" /* NEAR */
+#ifdef __cplusplus
extern "C" {
#endif
#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */
#define EE(X) (globerrs[(X) - EE_ERROR_FIRST])
-extern const char * NEAR globerrs[]; /* my_error_messages is here */
+extern const char *globerrs[]; /* my_error_messages is here */
/* Error message numbers in global map */
/*
diff --git a/include/thr_lock.h b/include/thr_lock.h
index 1f4072ca0c5..37dc37f8017 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -54,12 +54,6 @@ enum thr_lock_type { TL_IGNORE=-1,
*/
TL_WRITE_ALLOW_WRITE,
/*
- Write lock, but allow other threads to read.
- Used by ALTER TABLE in MySQL to allow readers
- to use the table until ALTER TABLE is finished.
- */
- TL_WRITE_ALLOW_READ,
- /*
WRITE lock used by concurrent insert. Will allow
READ, if one could use concurrent insert on table.
*/
diff --git a/include/typelib.h b/include/typelib.h
index c6a7f7a42e9..3badb14c96e 100644
--- a/include/typelib.h
+++ b/include/typelib.h
@@ -36,9 +36,9 @@ extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
extern TYPELIB sql_protocol_typelib;
-my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
+my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
my_ulonglong cur_set, my_ulonglong default_set,
- const char *str, uint length,
- char **err_pos, uint *err_len);
+ const char *str, unsigned int length,
+ char **err_pos, unsigned int *err_len);
#endif /* _typelib_h */
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index cd23f825b9e..2ae09c1707a 100755..100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -152,7 +152,7 @@ SET(LIBS clientlib dbug strings vio mysys ${ZLIB_LIBRARY} ${SSL_LIBRARIES})
# Merge several convenience libraries into one big mysqlclient
# and link them together into shared library.
-MERGE_LIBRARIES(mysqlclient STATIC ${LIBS})
+MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development)
# Visual Studio users need debug static library for debug projects
IF(MSVC)
@@ -171,11 +171,11 @@ IF(UNIX)
SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
ENDIF()
ENDMACRO()
- INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR})
+ INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
ENDIF()
IF(NOT DISABLE_SHARED)
- MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
+ MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} COMPONENT SharedLibraries)
IF(UNIX)
# libtool compatability
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
@@ -209,7 +209,7 @@ IF(NOT DISABLE_SHARED)
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
""
linkname)
- INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR})
+ INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}")
LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS)
FOREACH(ver ${OS_SHARED_LIB_SYMLINKS})
@@ -218,7 +218,7 @@ IF(NOT DISABLE_SHARED)
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${ver}"
linkname)
- INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR})
+ INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
ENDFOREACH()
ENDIF()
ENDIF()
diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am
index b1d23a175d4..8aa1648c834 100644
--- a/libmysql/Makefile.am
+++ b/libmysql/Makefile.am
@@ -79,7 +79,7 @@ link_sources:
# a minimal MySQL client library
#
# For a really minimal distribution (without debugging code) we could
-# keep only the stubs for safemalloc.c and debug.c
+# keep only the stubs for debug.c
#
# A list of needed headers collected from the deps information 000213
nh = my_global.h config-win32.h dbug.h errmsg.h \
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index 71a4fd867bd..53264f2e559 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -38,7 +38,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
strmake.lo strend.lo \
strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.lo \
- strcend.lo bcmp.lo ctype-latin1.lo \
+ strcend.lo ctype-latin1.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
@@ -49,15 +49,15 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo dtoa.lo
mystringsextra= strto.c
-dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
+dbugobjects = dbug.lo
mysysheaders = mysys_priv.h my_static.h
vioheaders = vio_priv.h
-mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
+mysysobjects1 = my_init.lo my_static.lo my_malloc.lo \
my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \
my_file.lo my_read.lo my_write.lo errors.lo \
my_error.lo my_getwd.lo my_div.lo \
mf_pack.lo my_mess.lo mf_dirname.lo mf_fn_ext.lo\
- mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \
+ mf_wcomp.lo typelib.lo my_alloc.lo \
mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \
my_symlink.lo my_fstream.lo mf_arr_appstr.lo \
mf_loadpath.lo my_pthread.lo my_thr_init.lo \
diff --git a/libmysql/dll.c b/libmysql/dll.c
index 8fcf41c792c..b5fcba13f91 100644
--- a/libmysql/dll.c
+++ b/libmysql/dll.c
@@ -48,7 +48,7 @@ void libmysql_init(void)
#ifdef __WIN__
static int inited=0,threads=0;
-HINSTANCE NEAR s_hModule; /* Saved module handle */
+HINSTANCE s_hModule; /* Saved module handle */
DWORD main_thread;
BOOL APIENTRY LibMain(HANDLE hInst,DWORD ul_reason_being_called,
@@ -105,21 +105,3 @@ int __stdcall DllMain(HANDLE hInst,DWORD ul_reason_being_called,LPVOID lpReserve
return TRUE;
}
-#elif defined(WINDOWS)
-
-/****************************************************************************
-** This routine is called by LIBSTART.ASM at module load time. All it
-** does in this sample is remember the DLL module handle. The module
-** handle is needed if you want to do things like load stuff from the
-** resource file (for instance string resources).
-****************************************************************************/
-
-int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize,
- UCHAR FAR *lszCmdLine)
-{
- s_hModule = hModule;
- libmysql_init();
- return TRUE;
-}
-
-#endif
diff --git a/libmysql/get_password.c b/libmysql/get_password.c
index cbe5fce6949..56514a8d864 100644
--- a/libmysql/get_password.c
+++ b/libmysql/get_password.c
@@ -36,7 +36,7 @@
#include <pwd.h>
#endif /* HAVE_PWD_H */
#else /* ! HAVE_GETPASS */
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
#include <sys/ioctl.h>
#ifdef HAVE_TERMIOS_H /* For tty-password */
#include <termios.h>
@@ -55,9 +55,7 @@
#include <asm/termiobits.h>
#endif
#else
-#ifndef __NETWARE__
#include <conio.h>
-#endif /* __NETWARE__ */
#endif /* __WIN__ */
#endif /* HAVE_GETPASS */
@@ -65,16 +63,8 @@
#define getpass(A) getpassphrase(A)
#endif
-#if defined( __WIN__) || defined(__NETWARE__)
+#if defined(__WIN__)
/* were just going to fake it here and get input from the keyboard */
-
-#ifdef __NETWARE__
-#undef _getch
-#undef _cputs
-#define _getch getcharacter
-#define _cputs(A) putstring(A)
-#endif
-
char *get_tty_password(const char *opt_message)
{
char to[80];
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 901fa1f0c4c..02ed93fa501 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -34,7 +34,7 @@
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
-#if !defined(MSDOS) && !defined(__WIN__)
+#if !defined(__WIN__)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -45,7 +45,7 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#endif /* !defined(MSDOS) && !defined(__WIN__) */
+#endif /* !defined(__WIN__) */
#ifdef HAVE_POLL
#include <sys/poll.h>
#endif
@@ -74,7 +74,7 @@ ulong max_allowed_packet= 1024L*1024L*1024L;
my_bool net_flush(NET *net);
#endif
-#if defined(MSDOS) || defined(__WIN__)
+#if defined(__WIN__)
/* socket_errno is defined in my_global.h for all platforms */
#define perror(A)
#else
@@ -128,31 +128,29 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
init_client_errs();
if (!mysql_port)
{
+ char *env;
+ struct servent *serv_ptr __attribute__((unused));
+
mysql_port = MYSQL_PORT;
-#ifndef MSDOS
- {
- struct servent *serv_ptr __attribute__((unused));
- char *env;
- /*
- if builder specifically requested a default port, use that
- (even if it coincides with our factory default).
- only if they didn't do we check /etc/services (and, failing
- on that, fall back to the factory default of 3306).
- either default can be overridden by the environment variable
- MYSQL_TCP_PORT, which in turn can be overridden with command
- line options.
- */
+ /*
+ if builder specifically requested a default port, use that
+ (even if it coincides with our factory default).
+ only if they didn't do we check /etc/services (and, failing
+ on that, fall back to the factory default of 3306).
+ either default can be overridden by the environment variable
+ MYSQL_TCP_PORT, which in turn can be overridden with command
+ line options.
+ */
#if MYSQL_PORT_DEFAULT == 0
- if ((serv_ptr = getservbyname("mysql", "tcp")))
- mysql_port = (uint) ntohs((ushort) serv_ptr->s_port);
-#endif
- if ((env = getenv("MYSQL_TCP_PORT")))
- mysql_port =(uint) atoi(env);
- }
+ if ((serv_ptr= getservbyname("mysql", "tcp")))
+ mysql_port= (uint) ntohs((ushort) serv_ptr->s_port);
#endif
+ if ((env= getenv("MYSQL_TCP_PORT")))
+ mysql_port=(uint) atoi(env);
}
+
if (!mysql_unix_port)
{
char *env;
@@ -165,7 +163,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
mysql_unix_port = env;
}
mysql_debug(NullS);
-#if defined(SIGPIPE) && !defined(__WIN__) && !defined(__NETWARE__)
+#if defined(SIGPIPE) && !defined(__WIN__)
(void) signal(SIGPIPE, SIG_IGN);
#endif
#ifdef EMBEDDED_LIBRARY
@@ -318,7 +316,7 @@ sig_handler
my_pipe_sig_handler(int sig __attribute__((unused)))
{
DBUG_PRINT("info",("Hit by signal %d",sig));
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
(void) signal(SIGPIPE, my_pipe_sig_handler);
#endif
}
@@ -341,7 +339,7 @@ mysql_connect(MYSQL *mysql,const char *host,
if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0)))
{
if (mysql->free_me)
- my_free((uchar*) mysql,MYF(0));
+ my_free(mysql);
}
mysql->reconnect= 1;
DBUG_RETURN(res);
@@ -457,9 +455,9 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
if (rc == 0)
{
/* Free old connect information */
- my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->user);
+ my_free(mysql->passwd);
+ my_free(mysql->db);
/* alloc new connect information */
mysql->user= my_strdup(user,MYF(MY_WME));
@@ -479,15 +477,7 @@ struct passwd *getpwuid(uid_t);
char* getlogin(void);
#endif
-#if defined(__NETWARE__)
-/* Default to value of USER on NetWare, if unset use "UNKNOWN_USER" */
-void read_user_name(char *name)
-{
- char *str=getenv("USER");
- strmake(name, str ? str : "UNKNOWN_USER", USERNAME_LENGTH);
-}
-
-#elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__)
+#if !defined(__WIN__)
void read_user_name(char *name)
{
@@ -517,7 +507,7 @@ void read_user_name(char *name)
DBUG_VOID_RETURN;
}
-#else /* If MSDOS || VMS */
+#else /* If Windows */
void read_user_name(char *name)
{
@@ -604,7 +594,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
err:
/* free up memory allocated with _init, usually */
(*options->local_infile_end)(li_ptr);
- my_free(buf, MYF(0));
+ my_free(buf);
DBUG_RETURN(result);
}
@@ -715,7 +705,7 @@ static void default_local_infile_end(void *ptr)
{
if (data->fd >= 0)
my_close(data->fd, MYF(MY_WME));
- my_free(ptr, MYF(MY_WME));
+ my_free(ptr);
}
}
@@ -2127,7 +2117,12 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
stmt->insert_id= mysql->insert_id;
if (res)
{
- set_stmt_errmsg(stmt, net);
+ /*
+ Don't set stmt error if stmt->mysql is NULL, as the error in this case
+ has already been set by mysql_prune_stmt_list().
+ */
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, net);
DBUG_RETURN(1);
}
DBUG_RETURN(0);
@@ -2206,7 +2201,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
}
result= execute(stmt, param_data, length);
stmt->send_types_to_server=0;
- my_free(param_data, MYF(MY_WME));
+ my_free(param_data);
DBUG_RETURN(result);
}
DBUG_RETURN((int) execute(stmt,0,0));
@@ -2338,7 +2333,12 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
buff, sizeof(buff), (uchar*) 0, 0,
1, stmt))
{
- set_stmt_errmsg(stmt, net);
+ /*
+ Don't set stmt error if stmt->mysql is NULL, as the error in this case
+ has already been set by mysql_prune_stmt_list().
+ */
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, net);
return 1;
}
if ((*mysql->methods->read_rows_from_cursor)(stmt))
@@ -3025,7 +3025,12 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
buff, sizeof(buff), (uchar*) data,
length, 1, stmt))
{
- set_stmt_errmsg(stmt, &mysql->net);
+ /*
+ Don't set stmt error if stmt->mysql is NULL, as the error in this case
+ has already been set by mysql_prune_stmt_list().
+ */
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, &mysql->net);
DBUG_RETURN(1);
}
}
@@ -4027,6 +4032,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
case MYSQL_TYPE_TIME:
field->max_length= 15; /* 19:23:48.123456 */
param->skip_result= skip_result_with_length;
+ break;
case MYSQL_TYPE_DATE:
field->max_length= 10; /* 2003-11-11 */
param->skip_result= skip_result_with_length;
@@ -4440,7 +4446,12 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
(uchar*) 0, 0, 1, stmt))
{
- set_stmt_errmsg(stmt, net);
+ /*
+ Don't set stmt error if stmt->mysql is NULL, as the error in this case
+ has already been set by mysql_prune_stmt_list().
+ */
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, net);
DBUG_RETURN(1);
}
}
@@ -4707,7 +4718,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
}
}
- my_free((uchar*) stmt, MYF(MY_WME));
+ my_free(stmt);
DBUG_RETURN(test(rc));
}
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index fa5088f288b..6f553ef9c11 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -63,7 +63,8 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_class.cc ../sql/sql_crypt.cc ../sql/sql_cursor.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/sql_help.cc ../sql/sql_insert.cc ../sql/datadict.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 ../sql/sql_map.cc
@@ -124,7 +125,7 @@ FOREACH(LIB ${LIBS})
ENDFOREACH()
MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS}
- OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME})
+ OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT Embedded)
# Visual Studio users need debug static library
IF(MSVC)
@@ -137,5 +138,6 @@ IF(UNIX)
ENDIF()
IF(MSVC AND NOT DISABLE_SHARED)
- MERGE_LIBRARIES(libmysqld SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
+ MERGE_LIBRARIES(libmysqld SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS}
+ COMPONENT Embedded)
ENDIF()
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index 5ff23be42ba..9d8c5edaa12 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_profile.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 sql_map.cc \
@@ -157,27 +157,22 @@ if DARWIN_MWCC
mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects)
else
-rm -f libmysqld.a
- if test "$(host_os)" = "netware" ; \
- then \
- $(libmysqld_a_AR) libmysqld.a $(INC_LIB) libmysqld_int.a $(storageobjects); \
- else \
- current_dir=`pwd`; \
- rm -rf tmp; mkdir tmp; \
- (for arc in $(INC_LIB) ./libmysqld_int.a; do \
- arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \
- artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \
- for F in `$(AR) t $$arc | grep -v SYMDEF`; do \
- if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \
- mkdir $$artmp; cd $$artmp > /dev/null; \
- $(AR) x ../../$$arc; \
- cd $$current_dir > /dev/null; \
- ls $$artmp/* | grep -v SYMDEF; \
- continue 2; fi; done; \
- done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a ; \
- $(AR) r libmysqld.a $(storageobjects); \
- $(RANLIB) libmysqld.a ; \
- rm -rf tmp; \
- fi
+ current_dir=`pwd`; \
+ rm -rf tmp; mkdir tmp; \
+ (for arc in $(INC_LIB) ./libmysqld_int.a; do \
+ arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \
+ artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \
+ for F in `$(AR) t $$arc | grep -v SYMDEF`; do \
+ if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \
+ mkdir $$artmp; cd $$artmp > /dev/null; \
+ $(AR) x ../../$$arc; \
+ cd $$current_dir > /dev/null; \
+ ls $$artmp/* | grep -v SYMDEF; \
+ continue 2; fi; done; \
+ done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a; \
+ $(AR) r libmysqld.a $(storageobjects); \
+ $(RANLIB) libmysqld.a ; \
+ rm -rf tmp
endif
## XXX: any time the client interface changes, we'll need to bump
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index e7b053d9766..66c40d88e29 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -42,7 +42,8 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
mysqltest_embedded_LINK = $(CXXLINK)
nodist_mysqltest_embedded_SOURCES = mysqltest.cc
-mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a
+mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a \
+ @MYSQLD_EXTRA_LDFLAGS@
nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
my_readline.h sql_string.h completion_hash.h
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index e727122293c..94927c590cf 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -76,7 +76,7 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
strmake(net->last_error, ei->info, sizeof(net->last_error)-1);
memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate));
mysql->server_status= ei->server_status;
- my_free(data, MYF(0));
+ my_free(data);
}
static my_bool
@@ -207,7 +207,7 @@ static MYSQL_FIELD *emb_list_fields(MYSQL *mysql)
res= ((THD*) mysql->thd)->cur_data;
((THD*) mysql->thd)->cur_data= 0;
mysql->field_alloc= res->alloc;
- my_free(res,MYF(0));
+ my_free(res);
mysql->status= MYSQL_STATUS_READY;
return mysql->fields;
}
@@ -236,7 +236,7 @@ static my_bool emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
stmt->fields= mysql->fields;
stmt->mem_root= res->alloc;
mysql->fields= NULL;
- my_free(res,MYF(0));
+ my_free(res);
}
return 0;
@@ -293,7 +293,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
thd->cur_data= res;
}
else
- my_free(res, MYF(0));
+ my_free(res);
return 0;
}
@@ -335,7 +335,7 @@ int emb_read_binary_rows(MYSQL_STMT *stmt)
return 1;
}
stmt->result= *data;
- my_free((char *) data, MYF(0));
+ my_free(data);
set_stmt_errmsg(stmt, &stmt->mysql->net);
return 0;
}
@@ -522,10 +522,10 @@ int init_embedded_server(int argc, char **argv, char **groups)
mysql_data_home= mysql_real_data_home;
mysql_data_home_len= mysql_real_data_home_len;
-
+
/* Get default temporary directory */
opt_mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */
-#if defined( __WIN__) || defined(OS2)
+#if defined(__WIN__)
if (!opt_mysql_tmpdir)
opt_mysql_tmpdir=getenv("TEMP");
if (!opt_mysql_tmpdir)
@@ -590,7 +590,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
void end_embedded_server()
{
- my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(copy_arguments_ptr);
copy_arguments_ptr=0;
clean_up(0);
}
@@ -634,7 +634,6 @@ void *create_embedded_thd(int client_flag)
thd->variables.option_bits |= OPTION_BIG_SELECTS;
thd->proc_info=0; // Remove 'login'
thd->command=COM_SLEEP;
- thd->version=refresh_version;
thd->set_time();
thd->init_for_queries();
thd->client_capabilities= client_flag;
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 8f7503c9d6c..603fc3bc2f0 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -32,7 +32,7 @@
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
-#if !defined(MSDOS) && !defined(__WIN__)
+#if !defined(__WIN__)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -54,7 +54,7 @@
extern ulong net_buffer_length;
extern ulong max_allowed_packet;
-#if defined(MSDOS) || defined(__WIN__)
+#if defined(__WIN__)
#define ERRNO WSAGetLastError()
#define perror(A)
#else
@@ -119,8 +119,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
(mysql->options.my_cnf_file ?
mysql->options.my_cnf_file : "my"),
mysql->options.my_cnf_group);
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.my_cnf_file);
+ my_free(mysql->options.my_cnf_group);
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
}
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
index b309db292da..9745699b61d 100644
--- a/mysql-test/CMakeLists.txt
+++ b/mysql-test/CMakeLists.txt
@@ -16,6 +16,7 @@
INSTALL(
DIRECTORY .
DESTINATION ${INSTALL_MYSQLTESTDIR}
+ COMPONENT Test
PATTERN "var/" EXCLUDE
PATTERN "lib/My/SafeProcess" EXCLUDE
PATTERN "lib/t*" EXCLUDE
diff --git a/mysql-test/collections/default.daily b/mysql-test/collections/default.daily
index a95e5f4657d..d23ae8a6d51 100644
--- a/mysql-test/collections/default.daily
+++ b/mysql-test/collections/default.daily
@@ -3,3 +3,4 @@ perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collection
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_ndb_row --vardir=var-rpl_ndb_row --mysqld=--binlog-format=row --suite=rpl_ndb,ndb
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-ndb
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index e58953c9e73..47167f0bf96 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -24,9 +24,10 @@ main.sp @solaris # Bug#47791 2010-01-20 alik Several tes
main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
+parts.partition_alter4_innodb # Bug#45299 2010-06-28 alik Test "partition_alter4_innodb" is taking too long, timeout
perfschema.pfs_upgrade # Bug#53102 2010-06-15 alik perfschema.pfs_upgrade fails on sol10 sparc64 max in parallel mode
-rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically
+rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again
rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_innodb_bug28430* # Bug#46029
rpl.rpl_innodb_bug30888* @solaris # Bug#47646 2009-09-25 alik rpl.rpl_innodb_bug30888 fails sporadically on Solaris
@@ -35,6 +36,7 @@ rpl.rpl_plugin_load* @solaris # Bug#47146
rpl.rpl_row_sp011* @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+sys_vars.slow_query_log_func @solaris # Bug#54819 2010-06-26 alik sys_vars.slow_query_log_func fails sporadically on Solaris 10
sys_vars.wait_timeout_func # Bug#41255 2010-04-26 alik wait_timeout_func fails
# Declare all NDB-tests in ndb and rpl_ndb test suites experimental.
diff --git a/mysql-test/collections/default.push b/mysql-test/collections/default.push
index 77dc9a586db..a213706498e 100644
--- a/mysql-test/collections/default.push
+++ b/mysql-test/collections/default.push
@@ -1,5 +1,5 @@
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental --skip-ndb
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb
diff --git a/mysql-test/collections/disabled-per-push.list b/mysql-test/collections/disabled-per-push.list
new file mode 100644
index 00000000000..32177fcb98d
--- /dev/null
+++ b/mysql-test/collections/disabled-per-push.list
@@ -0,0 +1,186 @@
+rpl.rpl000010 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl000011 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl000013 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_000015 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_alter_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_auto_increment_11932 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_auto_increment_update_failure : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_begin_commit_rollback : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_binlog_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_binlog_query_filter_rules : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_bit : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_bit_npk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_blackhole : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_bug31076 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_bug33931 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_bug38694 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_bug41902 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_concurrency_error : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_create_if_not_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_create_tmp_table_if_not_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_cross_version : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_do_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_drop_if_exists : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_EE_err : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_empty_master_host : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_extraColmaster_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_extraCol_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_filter_tables_not_exist : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_flushlog_loop : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_flush_logs : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_foreign_key_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_free_items : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_get_lock : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_grant : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_heartbeat : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_idempotency : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_ignore_revoke : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_ignore_table_update : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_incident : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_init_slave_errors : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_init_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_innodb_bug30888 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_innodb_mixed_ddl : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_insert_id_pk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_insert_ignore : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_insert_select : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_ip_mix2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_ip_mix : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_ipv4_as_ipv6 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_ipv6 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_known_bugs_detection : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_loaddata_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_loaddata_fatal : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_loaddatalocal : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_loaddata : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_loaddata_map : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_loaddata_simple : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_loaddata_s : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_loaddata_symlink : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_log_pos : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_master_pos_wait : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_misc_functions : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_mixed_binlog_max_cache_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_mixed_bit_pk : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_mixed_ddl_dml : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_mixed_implicit_commit_binlog : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_mixed_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_mixed_row_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_mix_found_rows : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_multi_delete2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_multi_delete : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_multi_engine : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_multi_update2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_multi_update3 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_multi_update4 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_multi_update : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_mysql_upgrade : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_name_const : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_nondeterministic_functions : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_non_direct_mixed_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_non_direct_row_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_non_direct_stm_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_not_null_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_optimize : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_ps : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_relayrotate : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_relay_space_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_relayspace : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_relay_space_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_replicate_ignore_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_rewrt_db : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_4_bytes : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_basic_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_basic_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_basic_8partition : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_colSize : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_disabled_slave_key : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_drop : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_flsh_tbls : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_func001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_func002 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_func003 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_idempotency : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_implicit_commit_binlog : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_inexist_tbl : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_loaddata_concurrent : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_max_relay_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_reset_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_show_relaylog_events : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_sp001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_sp002_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_sp005 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_sp006_InnoDB : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_sp007_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_sp008 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_sp009 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_sp012 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_tabledefs_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_tabledefs_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_trig001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_trig002 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_trig003 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_trig004 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_trunc_temp : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_unsafe_funcs : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_until : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_USER : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_utf16 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_utf32 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_view01 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_row_wide_table : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_server_id1 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_server_id2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_server_id_ignore : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_server_id : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_set_charset : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_set_null_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_set_null_myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_sf : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_skip_error : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_slave_grp_exec : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_slave_load_in : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_slave_load_tmpdir_not_exist : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_slave_status : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_slow_query_log : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_sp004 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_sporadic_master : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_000001 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_auto_increment_bug33029 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_binlog_max_cache_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_conflicts : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_EE_err2 : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_flsh_tbls : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_found_rows : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_insert_delayed : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_loaddata_concurrent : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_loadfile : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_log : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_max_relay_size : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_mixing_engines : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_mix_show_relaylog_events : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_multi_query : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_no_op : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_reset_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_sql_mode : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_start_stop_slave : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_stop_middle_group : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_until : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_stm_user_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_temporary_errors : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_temporary : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_temp_table : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_temp_table_mix_row : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_temp_temporary : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_truncate_2myisam : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_truncate_3innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_trunc_temp : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_typeconv_innodb : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_typeconv : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_user : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_user_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_variables : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
+rpl.rpl_variables_stm : lsoares 2010-05-26 WL#5408 Reduce Pushbuild2 turnaround times for rpl suite.
diff --git a/mysql-test/collections/mysql-next-mr.push b/mysql-test/collections/mysql-next-mr.push
index b84f43eea7c..b87cc4b801f 100644
--- a/mysql-test/collections/mysql-next-mr.push
+++ b/mysql-test/collections/mysql-next-mr.push
@@ -1,5 +1,5 @@
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
diff --git a/mysql-test/collections/mysql-trunk.push b/mysql-test/collections/mysql-trunk.push
index b84f43eea7c..b87cc4b801f 100644
--- a/mysql-test/collections/mysql-trunk.push
+++ b/mysql-test/collections/mysql-trunk.push
@@ -1,5 +1,5 @@
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test
index c6f9e928cc5..900e46ff90a 100644
--- a/mysql-test/extra/binlog_tests/binlog.test
+++ b/mysql-test/extra/binlog_tests/binlog.test
@@ -243,14 +243,17 @@ reset master;
drop table if exists t3;
--enable_warnings
create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
-show master status;
+--let $binlog_file1= query_get_value(SHOW MASTER STATUS, File, 1)
+--echo File $binlog_file1
let $it=4;
while ($it)
{
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
dec $it;
}
-show master status /* must show new binlog index after rotating */;
+--let $binlog_file2= query_get_value(SHOW MASTER STATUS, File, 1)
+--echo *** show new binlog index after rotating ***
+--echo File $binlog_file2
drop table t3;
--echo #
diff --git a/mysql-test/extra/binlog_tests/binlog_truncate.test b/mysql-test/extra/binlog_tests/binlog_truncate.test
index dce33b3cef0..24cf363f780 100644
--- a/mysql-test/extra/binlog_tests/binlog_truncate.test
+++ b/mysql-test/extra/binlog_tests/binlog_truncate.test
@@ -25,3 +25,44 @@ TRUNCATE TABLE t2;
source include/show_binlog_events.inc;
DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+--echo #
+
+eval CREATE TABLE t1 (a INT) ENGINE=$engine;
+eval CREATE TABLE t2 (a INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1),(2);
+
+let $binlog_start = query_get_value("SHOW MASTER STATUS", Position, 1);
+if (`select length('$before_truncate') > 0`) {
+ eval $before_truncate;
+}
+
+--echo # Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+
+connect (truncate,localhost,root,,);
+--echo # Connection: truncate
+send TRUNCATE TABLE t1;
+
+connection default;
+--echo # Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COMMIT;
+
+connection truncate;
+--echo # Connection: truncate
+--echo # Reaping TRUNCATE TABLE
+--reap
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+
+connection default;
+--echo # Connection: default
+
+source include/show_binlog_events.inc;
+disconnect truncate;
+DROP TABLE t1,t2;
diff --git a/mysql-test/extra/binlog_tests/drop_temp_table.test b/mysql-test/extra/binlog_tests/drop_temp_table.test
index 63833c10c14..c852ee4c8a0 100644
--- a/mysql-test/extra/binlog_tests/drop_temp_table.test
+++ b/mysql-test/extra/binlog_tests/drop_temp_table.test
@@ -69,4 +69,34 @@ let $VERSION=`SELECT VERSION()`;
source include/show_binlog_events.inc;
DROP DATABASE `drop-temp+table-test`;
+
+#
+# Bug #54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW
+#
+# Sanity test. Checking that implicit DROP event is logged.
+#
+# After BUG#52616, the switch to ROW mode becomes effective even
+# if there are open temporary tables. As such the implicit drop
+# for temporary tables on session closing must be logged.
+#
+
+RESET MASTER;
+
+CREATE TABLE t1 ( i text );
+
+--connect(con1,localhost,root,,)
+CREATE TEMPORARY TABLE ttmp1 ( i text );
+SET @@session.binlog_format=ROW;
+INSERT INTO t1 VALUES ('1');
+SELECT @@session.binlog_format;
+--disconnect con1
+
+-- connection default
+--let $wait_binlog_event= DROP
+--source include/wait_for_binlog_event.inc
+-- source include/show_binlog_events.inc
+RESET MASTER;
+
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index 435cae7fd28..aaadda941fb 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -320,6 +320,16 @@ disconnect con3;
connection con4;
select get_lock("a",10); # wait for rollback to finish
+if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
+{
+ --let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7)
+ --let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 7)
+ if (`SELECT 'ROLLBACK' != '$binlog_query'`) {
+ --echo Wrong query from SHOW BINLOG EVENTS. Expected ROLLBACK, got '$binlog_query'
+ --source include/show_rpl_debug_info.inc
+ --die Wrong value for slave parameter
+ }
+}
flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
@@ -328,13 +338,12 @@ let $MYSQLD_DATADIR= `select @@datadir`;
# and does not make slave to stop)
if (`select @@binlog_format = 'ROW'`)
{
- --echo This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these
- --echo were previously flushed upon committing/rolling back each statement.
+ --echo There is nothing to roll back; transactional changes are removed from the trans cache.
}
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
- --exec $MYSQL_BINLOG --start-position=556 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+ --exec $MYSQL_BINLOG --start-position=$binlog_rollback $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
index dd5f9907a21..1fb6b3dcb8a 100644
--- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
@@ -77,11 +77,11 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
-if (`SELECT @@binlog_format = 'STATEMENT'`)
+if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
}
-if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
+if (`SELECT @@binlog_format = 'ROW'`)
{
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2;
}
diff --git a/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-test/extra/rpl_tests/rpl_conflicts.test
index 8a98059b0ad..b20bbb15a1a 100644
--- a/mysql-test/extra/rpl_tests/rpl_conflicts.test
+++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test
@@ -92,7 +92,10 @@ if (`SELECT @@global.binlog_format != 'ROW' OR @@global.slave_exec_mode = 'STRIC
let $slave_sql_errno= 1062; # ER_DUP_ENTRY
source include/wait_for_slave_sql_error.inc;
let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
- --echo Last_SQL_Error = $err (expected "duplicate key" error)
+ --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
+ --disable_query_log
+ --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)'
+ --enable_query_log
SELECT * FROM t1;
--echo ---- Resolve the conflict on the slave and restart SQL thread ----
diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
new file mode 100644
index 00000000000..2d480349c65
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
@@ -0,0 +1,967 @@
+--source include/have_innodb.inc
+--disable_abort_on_error
+
+if (`SELECT HEX(@commands) = HEX('configure')`)
+{
+ connection master;
+
+ #
+ # Creates a T-table that is never dropped.
+ #
+ --eval CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb
+
+ #
+ # Creates a N-table that is never dropped.
+ #
+ --eval CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam
+
+ #
+ # Creates a Temporary N-table that is never dropped.
+ #
+ --eval CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam
+
+ #
+ # Creates a Temporary N-table that is never dropped.
+ #
+ --eval CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb
+
+ #
+ # In what follows, we create a set of tables that are used
+ # throughout this test case. The number of tables to be
+ # created is give by the variable $tot_table.
+ #
+ #
+ # Creates Temporay N-tables that are automatically dropped and recreated
+ # when a command ends.
+ #
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
+ --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam
+ --disable_query_log
+ --eval SET @check_temp='$available_n_temp'
+ --enable_query_log
+ #
+ # Updates the $available_n_temp that keeps track of the created
+ # temporary N-tables.
+ #
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_n_temp= $available_n_temp,nt_tmp_$n
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_n_temp= nt_tmp_$n
+ }
+ --dec $n
+ }
+
+ #
+ # Creates Temporay T-tables that are automatically dropped and recreated
+ # when a command ends.
+ #
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
+ --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb
+ --disable_query_log
+ --eval SET @check_temp='$available_t_temp'
+ --enable_query_log
+ #
+ # Updates the $available_t_temp that keeps track of the created
+ # temporary T-tables.
+ #
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_t_temp= $available_t_temp,tt_tmp_$n
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_t_temp= tt_tmp_$n
+ }
+ --dec $n
+ }
+
+ #
+ # Creates N-tables that are automatically dropped and recreated
+ # when a command ends.
+ #
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TABLE IF EXISTS nt_$n
+ --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam
+ --disable_query_log
+ --eval SET @check_temp='$available_n'
+ --enable_query_log
+ #
+ # Updates the $available_n that keeps track of the created
+ # N-tables.
+ #
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_n= $available_n,nt_$n
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_n= nt_$n
+ }
+ --dec $n
+ }
+
+ #
+ # Creates T-tables that are automatically dropped and recreated
+ # when a command ends.
+ #
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TABLE IF EXISTS tt_$n
+ --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb
+ --disable_query_log
+ --eval SET @check_temp='$available_t'
+ --enable_query_log
+ #
+ # Updates the $available_t that keeps track of the created
+ # T-tables.
+ #
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_t= $available_t,tt_$n
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_t= tt_$n
+ }
+ --dec $n
+ }
+
+ --let $dropped_t_temp=
+ --let $dropped_n_temp=
+
+ --let $dropped_t=
+ --let $dropped_n=
+
+ let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
+
+ SET @commands= '';
+}
+
+#
+# Drops tables and synchronizes master and slave. Note that temporary
+# tables are not explitcily dropped as they will be dropped while
+# closing the connection.
+#
+if (`SELECT HEX(@commands) = HEX('clean')`)
+{
+ connection master;
+
+ DROP TABLE IF EXISTS tt_xx_1;
+
+ DROP TABLE IF EXISTS nt_xx_1;
+
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TABLE IF EXISTS nt_$n
+ --dec $n
+ }
+
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TABLE IF EXISTS tt_$n
+ --dec $n
+ }
+
+ sync_slave_with_master;
+
+ SET @commands= '';
+}
+
+#
+# This is the core of the test is responsible for processing
+# the following commands:
+#
+# B - Begin
+# C - Commit
+# R - Rollback
+#
+#
+# T - Inserts a row into a T-table
+# N-Temp - Inserts a row into a temporary N-table.
+#
+#
+# T-SELECT-N-Temp - Selects from a temporary N-table and inserts
+# into a T-table.
+# N-SELECT-N-Temp - Selects from a temporary N-table and inserts
+# into a N-table.
+# T-SELECT-T-Temp - Selects from a temporary T-table and inserts
+# into a T-table.
+# N-SELECT-T-Temp - Selects from a temporary T-table and inserts
+# into a N-table.
+#
+#
+# Create-N-Temp - Creates a temporary N-table if a temporary N-table
+# was dropped before
+# Create-T-Temp - Creates a temporary T-table if a temporary T-table
+# was dropped before
+#
+#
+# Drop-Temp-T-Temp - Drops a temporary T-table if there is any
+# Drop-Temp-N-Temp - Drops a temporary N-table if there is any
+# Drop-Temp-TN-Temp - Drops both a temporary T-table and N-table if there
+# is any
+# Drop-Temp-TT-Temp - Drops two temporary T-tables if there is any
+# Drop-Temp-NN-Temp - Drops two temporary N-tables if there is any
+# Drop-Temp-Xe-Temp - Tries to drop a temporary table that does not exist
+# Drop-Temp-NXe-Temp - Drops a temporary N-table if there is any and
+# a temporary table that does not exist
+# Drop-Temp-TXe-Temp - Drops a temporary T-table if there is any and
+# a temporary table that does not exist
+#
+#
+# Drop-Temp-If-Xe-Temp - Tries to drop a temporary table that does not exist
+# Drop-Temp-If-TXe-Temp - Drops a temporary T-table if there is any and
+# a temporary table that does not exist
+#
+#
+# Drop-T - Drops a T-table if there is any
+# Drop-N - Drops a N-table if there is any
+# Drop-Xe - Tries to drop a table that does not exist
+# Drop-TXe - Drops a T-table if there is any and a table that does
+# not exist
+# Drop-NXe - Drops a N-table if there is any and a table that does
+# not exist
+# Drop-TN - Drops both a T-table and N-table if there is any
+# Drop-TT - Drops two T-tables if there is any
+# Drop-NN - Drops two N-tables if there is any
+# Drop-N-TN-Temp - Drops a N-table and both a temporary T-table and
+# N-table if there is any
+#
+#
+# Drop-If-Xe - Tries to drop a table that does not exist
+# Drop-If-TXe - Drops a T-table if there is any and a table that does
+# not exist
+# Drop-If-NXe - Drops a N-table if there is any and a table that does
+# not exist
+#
+while (`SELECT HEX(@commands) != HEX('')`)
+{
+ --disable_query_log
+ SET @command= SUBSTRING_INDEX(@commands, ' ', 1);
+ let $command= `SELECT @command`;
+ --eval SET @check_commands= '$commands'
+ if (`SELECT HEX(@check_commands) = HEX('''')`)
+ {
+ let $commands= `SELECT @commands`;
+ }
+
+ if (`SELECT HEX(@command) = HEX('B')`)
+ {
+ --enable_query_log
+ eval BEGIN;
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('T')`)
+ {
+ --enable_query_log
+ eval INSERT INTO tt_xx_1() VALUES (1);
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('N')`)
+ {
+ --enable_query_log
+ eval INSERT INTO nt_xx_1() VALUES (1);
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('N-Temp')`)
+ {
+ --enable_query_log
+ eval INSERT INTO nt_tmp_xx_1() VALUES (1);
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('N-SELECT-N-Temp')`)
+ {
+ --enable_query_log
+ eval INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('N-SELECT-T-Temp')`)
+ {
+ --enable_query_log
+ eval INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('T-SELECT-N-Temp')`)
+ {
+ --enable_query_log
+ eval INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('T-SELECT-T-Temp')`)
+ {
+ --enable_query_log
+ eval INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('Create-N-Temp') || HEX(@command) = HEX('Create-T-Temp')`)
+ {
+ if (`SELECT HEX(@command) = HEX('Create-N-Temp')`)
+ {
+ --let $dropped_temp=$dropped_n_temp
+ --let $available_temp=$available_n_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Create-T-Temp')`)
+ {
+ --let $dropped_temp=$dropped_t_temp
+ --let $available_temp=$available_t_temp
+ }
+
+ --eval SET @check_temp='$dropped_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1);
+ let $table=`SELECT @temp`;
+ --eval SET @check_temp='$available_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_temp= $available_temp,$table
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_temp= $table
+ }
+ --eval SET @check_temp='$dropped_temp'
+ --eval SET @table_temp='$table'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $dropped_temp= `SELECT @check_temp`
+
+ if (`SELECT HEX(@command) = HEX('Create-N-Temp')`)
+ {
+ --enable_query_log
+ --eval CREATE TEMPORARY TABLE $table ( id INT ) engine= MyIsam
+ --disable_query_log
+
+ --let $available_n_temp= $available_temp
+ --let $dropped_n_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Create-T-Temp')`)
+ {
+ --enable_query_log
+ --eval CREATE TEMPORARY TABLE $table ( id INT ) engine= Innodb
+ --disable_query_log
+
+ --let $available_t_temp= $available_temp
+ --let $dropped_t_temp= $dropped_temp
+ }
+ }
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp') || HEX(@command) = HEX('Drop-Temp-T-Temp') || HEX(@command) = HEX('Drop-T') || HEX(@command) = HEX('Drop-N')`)
+ {
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp')`)
+ {
+ --let $dropped_temp=$dropped_n_temp
+ --let $available_temp=$available_n_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-T-Temp')`)
+ {
+ --let $dropped_temp=$dropped_t_temp
+ --let $available_temp=$available_t_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-N')`)
+ {
+ --let $dropped_temp=$dropped_n
+ --let $available_temp=$available_n
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-T')`)
+ {
+ --let $dropped_temp=$dropped_t
+ --let $available_temp=$available_t
+ }
+
+ --eval SET @check_temp='$available_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1);
+ let $table=`SELECT @temp`;
+ --eval SET @check_temp='$dropped_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $dropped_temp= $dropped_temp,$table
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $dropped_temp= $table
+ }
+ --eval SET @check_temp='$available_temp'
+ --eval SET @table_temp='$table'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_temp= `SELECT @check_temp`
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE $table
+ --disable_query_log
+
+ --let $available_n_temp= $available_temp
+ --let $dropped_n_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-T-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE $table
+ --disable_query_log
+
+ --let $available_t_temp= $available_temp
+ --let $dropped_t_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-N')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE $table
+ --disable_query_log
+
+ --let $available_n= $available_temp
+ --let $dropped_n= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-T')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE $table
+ --disable_query_log
+
+ --let $available_t= $available_temp
+ --let $dropped_t= $dropped_temp
+ }
+ }
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-Xe-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE tt_xx_1
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-If-Xe-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-Xe')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE xx_1
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-If-Xe')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE IF EXISTS xx_1
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-TXe-Temp') || HEX(@command) = HEX('Drop-NXe') || HEX(@command) = HEX('Drop-TXe') || HEX(@command) = HEX('Drop-Temp-If-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-TXe-Temp') || HEX(@command) = HEX('Drop-If-NXe') || HEX(@command) = HEX('Drop-If-TXe')`)
+ {
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-NXe-Temp')`)
+ {
+ --let $dropped_temp=$dropped_n_temp
+ --let $available_temp=$available_n_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-TXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-TXe-Temp')`)
+ {
+ --let $dropped_temp=$dropped_t_temp
+ --let $available_temp=$available_t_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-NXe') || HEX(@command) = HEX('Drop-If-NXe')`)
+ {
+ --let $dropped_temp=$dropped_n
+ --let $available_temp=$available_n
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-TXe') || HEX(@command) = HEX('Drop-If-TXe')`)
+ {
+ --let $dropped_temp=$dropped_t
+ --let $available_temp=$available_t
+ }
+
+ --eval SET @check_temp='$available_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1);
+ let $table=`SELECT @temp`;
+ --eval SET @check_temp='$dropped_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $dropped_temp= $dropped_temp,$table
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $dropped_n_temp= $table
+ }
+ --eval SET @check_temp='$available_temp'
+ --eval SET @table_temp='$table'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_temp= `SELECT @check_temp`
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE $table, tt_1
+ --disable_query_log
+
+ --let $available_n_temp= $available_temp
+ --let $dropped_n_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-If-NXe-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE IF EXISTS $table, tt_1
+ --disable_query_log
+
+ --let $available_n_temp= $available_temp
+ --let $dropped_n_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-TXe-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE $table, tt_1
+ --disable_query_log
+
+ --let $available_t_temp= $available_temp
+ --let $dropped_t_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-If-TXe-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE IF EXISTS $table, tt_1
+ --disable_query_log
+
+ --let $available_t_temp= $available_temp
+ --let $dropped_t_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-NXe')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE $table, xx_1
+ --disable_query_log
+
+ --let $available_n= $available_temp
+ --let $dropped_n= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-If-NXe')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE IF EXISTS $table, xx_1
+ --disable_query_log
+
+ --let $available_n= $available_temp
+ --let $dropped_n= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-TXe')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE $table, xx_1
+ --disable_query_log
+
+ --let $available_t= $available_temp
+ --let $dropped_t= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-If-TXe')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE IF EXISTS $table, xx_1
+ --disable_query_log
+
+ --let $available_t= $available_temp
+ --let $dropped_t= $dropped_temp
+ }
+ }
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp') || HEX(@command) = HEX('Drop-Temp-TT-Temp') || HEX(@command) = HEX('Drop-NN') || HEX(@command) = HEX('Drop-TT')`)
+ {
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp')`)
+ {
+ --let $dropped_temp=$dropped_n_temp
+ --let $available_temp=$available_n_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-TT-Temp')`)
+ {
+ --let $dropped_temp=$dropped_t_temp
+ --let $available_temp=$available_t_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-NN')`)
+ {
+ --let $dropped_temp=$dropped_n
+ --let $available_temp=$available_n
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-TT')`)
+ {
+ --let $dropped_temp=$dropped_t
+ --let $available_temp=$available_t
+ }
+
+ --eval SET @check_temp='$available_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $n= 2
+ while (`SELECT HEX(@check_temp) != HEX('') && $n != 0`)
+ {
+ SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1);
+ let $table=`SELECT @temp`;
+ --eval SET @check_temp='$dropped_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $dropped_temp= $dropped_temp,$table
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $dropped_temp= $table
+ }
+ if (`SELECT $n = 1`)
+ {
+ --let $table_1= $table
+ }
+ if (`SELECT $n = 2`)
+ {
+ --let $table_2= $table
+ }
+
+ --dec $n
+ --eval SET @check_temp='$available_temp'
+ --eval SET @table_temp='$table'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_temp= `SELECT @check_temp`
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp') && $n = 0`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE $table_1, $table_2
+ --disable_query_log
+
+ --let $available_n_temp= $available_temp
+ --let $dropped_n_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-TT-Temp') && $n= 0`)
+ {
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE $table_1, $table_2
+ --disable_query_log
+
+ --let $available_t_temp= $available_temp
+ --let $dropped_t_temp= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-NN') && $n = 0`)
+ {
+ --enable_query_log
+ --eval DROP TABLE $table_1, $table_2
+ --disable_query_log
+
+ --let $available_n= $available_temp
+ --let $dropped_n= $dropped_temp
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-TT') && $n= 0`)
+ {
+ --enable_query_log
+ --eval DROP TABLE $table_1, $table_2
+ --disable_query_log
+
+ --let $available_t= $available_temp
+ --let $dropped_t= $dropped_temp
+ }
+ }
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-Temp-TN-Temp')`)
+ {
+ --eval SET @check_temp_t='$available_t_temp'
+ --eval SET @check_temp_n='$available_n_temp'
+ if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('')`)
+ {
+ SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1);
+ let $table_t=`SELECT @temp_t`;
+ --eval SET @check_temp_t='$dropped_t_temp'
+ if (`SELECT HEX(@check_temp_t) != HEX('')`)
+ {
+ --let $dropped_t_temp= $dropped_t_temp,$table_t
+ }
+ if (`SELECT HEX(@check_temp_t) = HEX('')`)
+ {
+ --let $dropped_t_temp= $table_t
+ }
+ --eval SET @check_temp='$available_t_temp'
+ --eval SET @table_temp='$table_t'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_t_temp= `SELECT @check_temp`
+
+ SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1);
+ let $table_n=`SELECT @temp_n`;
+ --eval SET @check_temp_n='$dropped_n_temp'
+ if (`SELECT HEX(@check_temp_n) != HEX('')`)
+ {
+ --let $dropped_n_temp= $dropped_n_temp,$table_n
+ }
+ if (`SELECT HEX(@check_temp_n) = HEX('')`)
+ {
+ --let $dropped_n_temp= $table_n
+ }
+ --eval SET @check_temp='$available_n_temp'
+ --eval SET @table_temp='$table_n'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_t_temp= `SELECT @check_temp`
+
+ --enable_query_log
+ --eval DROP TEMPORARY TABLE $table_t, $table_n
+ --disable_query_log
+ }
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-TN')`)
+ {
+ --eval SET @check_temp_t='$available_t'
+ --eval SET @check_temp_n='$available_n'
+ if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('')`)
+ {
+ SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1);
+ let $table_t=`SELECT @temp_t`;
+ --eval SET @check_temp_t='$dropped_t'
+ if (`SELECT HEX(@check_temp_t) != HEX('')`)
+ {
+ --let $dropped_t= $dropped_t,$table_t
+ }
+ if (`SELECT HEX(@check_temp_t) = HEX('')`)
+ {
+ --let $dropped_t= $table_t
+ }
+ --eval SET @check_temp='$available_t'
+ --eval SET @table_temp='$table_t'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_t= `SELECT @check_temp`
+
+ SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1);
+ let $table_n=`SELECT @temp_n`;
+ --eval SET @check_temp_n='$dropped_n'
+ if (`SELECT HEX(@check_temp_n) != HEX('')`)
+ {
+ --let $dropped_n= $dropped_n,$table_n
+ }
+ if (`SELECT HEX(@check_temp_n) = HEX('')`)
+ {
+ --let $dropped_n= $table_n
+ }
+ --eval SET @check_temp='$available_n'
+ --eval SET @table_temp='$table_n'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_t= `SELECT @check_temp`
+
+ --enable_query_log
+ --eval DROP TABLE $table_t, $table_n
+ --disable_query_log
+ }
+ }
+
+ if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp') || HEX(@command) = HEX('Drop-TN-Temp')`)
+ {
+ --eval SET @check_temp_t='$available_t_temp'
+ --eval SET @check_temp_n='$available_n_temp'
+ if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp')`)
+ {
+ --eval SET @check_n='$available_n'
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-TN-Temp')`)
+ {
+ #
+ # Just to be possible to go through the next if...
+ #
+ --eval SET @check_n='...'
+ }
+ if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('') && HEX(@check_n) != HEX('')`)
+ {
+ SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1);
+ let $table_temp_t=`SELECT @temp_t`;
+ --eval SET @check_temp_t='$dropped_t_temp'
+ if (`SELECT HEX(@check_temp_t) != HEX('')`)
+ {
+ --let $dropped_t_temp= $dropped_t_temp,$table_temp_t
+ }
+ if (`SELECT HEX(@check_temp_t) = HEX('')`)
+ {
+ --let $dropped_t_temp= $table_temp_t
+ }
+ --eval SET @check_temp='$available_t_temp'
+ --eval SET @table_temp='$table_temp_t'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_t_temp= `SELECT @check_temp`
+
+ SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1);
+ let $table_temp_n=`SELECT @temp_n`;
+ --eval SET @check_temp_n='$dropped_n_temp'
+ if (`SELECT HEX(@check_temp_n) != HEX('')`)
+ {
+ --let $dropped_n_temp= $dropped_n_temp,$table_temp_n
+ }
+ if (`SELECT HEX(@check_temp_n) = HEX('')`)
+ {
+ --let $dropped_n_temp= $table_temp_n
+ }
+ --eval SET @check_temp='$available_n_temp'
+ --eval SET @table_temp='$table_temp_n'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_n_temp= `SELECT @check_temp`
+
+ if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp')`)
+ {
+ SET @temp_n= SUBSTRING_INDEX(@check_n, ',', 1);
+ let $table_n=`SELECT @temp_n`;
+ --eval SET @check_n='$dropped_n'
+ if (`SELECT HEX(@check_n) != HEX('')`)
+ {
+ --let $dropped_n= $dropped_n,$table_n
+ }
+ if (`SELECT HEX(@check_n) = HEX('')`)
+ {
+ --let $dropped_n= $table_n
+ }
+ --eval SET @check_temp='$available_n'
+ --eval SET @table_temp='$table_n'
+ SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+ --let $available_n= `SELECT @check_temp`
+
+ --enable_query_log
+ --eval DROP TABLE $table_temp_t, $table_temp_n, $table_n
+ --disable_query_log
+ }
+ if (`SELECT HEX(@command) = HEX('Drop-TN-Temp')`)
+ {
+ --enable_query_log
+ --eval DROP TABLE $table_temp_t, $table_temp_n
+ --disable_query_log
+ }
+ }
+ }
+
+ if (`SELECT HEX(@command) = HEX('C')`)
+ {
+ --enable_query_log
+ --error 0, ER_GET_ERRMSG
+ eval COMMIT;
+ --disable_query_log
+ }
+
+ if (`SELECT HEX(@command) = HEX('R')`)
+ {
+ --enable_query_log
+ --error 0, ER_GET_ERRMSG
+ eval ROLLBACK;
+ --disable_query_log
+ }
+
+ SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));
+ if (`SELECT HEX(@commands) = HEX('')`)
+ {
+ let $binlog_start= $pos_trans_command;
+ --echo -b-b-b-b-b-b-b-b-b-b-b- >> $commands << -b-b-b-b-b-b-b-b-b-b-b-
+ --source include/show_binlog_events.inc
+ --echo -e-e-e-e-e-e-e-e-e-e-e- >> $commands << -e-e-e-e-e-e-e-e-e-e-e-
+ --echo
+
+ --disable_warnings
+ --let $available_n_temp=
+ --let $dropped_n_temp=
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
+ --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam
+ --eval SET @check_temp='$available_n_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_n_temp= $available_n_temp,nt_tmp_$n
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_n_temp= nt_tmp_$n
+ }
+ --dec $n
+ }
+
+ --let $available_t_temp=
+ --let $dropped_t_temp=
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
+ --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb
+ --eval SET @check_temp='$available_t_temp'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_t_temp= $available_t_temp,tt_tmp_$n
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_t_temp= tt_tmp_$n
+ }
+ --dec $n
+ }
+
+ --let $available_t=
+ --let $dropped_t=
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TABLE IF EXISTS tt_$n
+ --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb
+ --eval SET @check_temp='$available_t'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_t= $available_t,tt_$n
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_t= tt_$n
+ }
+ --dec $n
+ }
+
+ --let $available_n=
+ --let $dropped_n=
+ --let $n= $tot_table
+ while (`SELECT $n != 0`)
+ {
+ --eval DROP TABLE IF EXISTS nt_$n
+ --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam
+ --eval SET @check_temp='$available_n'
+ if (`SELECT HEX(@check_temp) != HEX('')`)
+ {
+ --let $available_n= $available_n,nt_$n
+ }
+ if (`SELECT HEX(@check_temp) = HEX('')`)
+ {
+ --let $available_n= nt_$n
+ }
+ --dec $n
+ }
+ --enable_warnings
+
+ let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
+ let $commands= '';
+ }
+ --enable_query_log
+}
diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test
new file mode 100644
index 00000000000..32f8d16b900
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test
@@ -0,0 +1,389 @@
+###############################################################################
+# In this test case, we check how changes to temporary tables are written
+# to the binary log.
+#
+# (TODO --- GET INFO AS SOON AS THE SITE IS AVAILABLE)
+#
+# This test uses the commands available at:
+# extra/rpl_tests/rpl_drop_create_temp_table.inc
+#
+###############################################################################
+
+
+--echo #########################################################################
+--echo # CONFIGURATION
+--echo #########################################################################
+
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+
+--let $tot_table= 2
+SET @commands= 'configure';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo #########################################################################
+--echo # 1 - Tables dropped by "DROP TEMPORARY TABLE"
+--echo #########################################################################
+connection master;
+
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo #
+SET @commands= 'Drop-Temp-T-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-N-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-Xe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-If-Xe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-TXe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-If-TXe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-NXe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-If-NXe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-TT-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-NN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+
+--echo
+--echo #
+--echo #2) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-Temp-T-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-Xe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TN-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TT-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NN-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+
+--echo
+--echo #
+--echo #3) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-Temp-T-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-Xe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TN-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TT-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NN-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+
+--echo #########################################################################
+--echo # 2 - Tables dropped by "DROP TABLE"
+--echo #########################################################################
+connection master;
+
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo #
+SET @commands= 'Drop-T';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-N';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Xe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-If-Xe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-TXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-If-TXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-NXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-If-NXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-TN';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-TT';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-NN';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-N-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo
+--echo #
+--echo #2) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-T';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-N';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Xe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-If-Xe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-TXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-If-TXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-NXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-If-NXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-TN';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-TT';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-NN';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-N-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo #########################################################################
+--echo # 3 - CREATE TEMPORARY TABLE
+--echo #########################################################################
+connection master;
+
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo #
+SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo
+--echo #
+--echo #2) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo
+--echo #
+--echo #3) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+
+--echo #########################################################################
+--echo # 4 - CHANGING TEMPORARY TABLES
+--echo #########################################################################
+connection master;
+
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo
+--echo
+--echo #
+--echo #2) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo ###################################################################################
+--echo # CHECK CONSISTENCY
+--echo ###################################################################################
+connection master;
+sync_slave_with_master;
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-slave.sql
+--diff_files $MYSQLD_DATADIR/test-temporary-master.sql $MYSQLD_DATADIR/test-temporary-slave.sql
+
+--echo #########################################################################
+--echo # CLEAN
+--echo #########################################################################
+SET @commands= 'clean';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
diff --git a/mysql-test/include/check_concurrent_insert.inc b/mysql-test/include/check_concurrent_insert.inc
index 6a9ada65562..f4bec3c9cdb 100644
--- a/mysql-test/include/check_concurrent_insert.inc
+++ b/mysql-test/include/check_concurrent_insert.inc
@@ -10,9 +10,9 @@
# $con_aux2 Name of the second auxiliary connection to be used by this
# script.
# $statement Statement to be checked.
-# $restore_table Table which might be modified affected by statement to be
-# checked and thus needs backing up before its execution
-# and restoring after it (can be empty).
+# $restore_table Table which might be modified by statement to be checked
+# and thus needs backing up before its execution and
+# restoring after it (can be empty).
#
# EXAMPLE
# lock_sync.test
@@ -25,7 +25,7 @@ set debug_sync= "RESET";
if (`SELECT '$restore_table' <> ''`)
{
---eval create table t_backup select * from $restore_table;
+--eval create temporary table t_backup select * from $restore_table;
}
connection $con_aux1;
@@ -34,19 +34,19 @@ set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
connection $con_aux2;
set debug_sync='now WAIT_FOR parked';
---send_eval insert into $table values (0);
+--send_eval insert into $table (i) values (0);
--enable_result_log
--enable_query_log
connection default;
# Wait until concurrent insert is successfully executed while
# statement being checked has its tables locked.
-# We use wait_condition.inc instead of simply executing
+# We use wait_condition.inc instead of simply reaping
# concurrent insert here in order to avoid deadlocks if test
-# fails and timing out instead.
+# fails and to time out gracefully instead.
let $wait_condition=
select count(*) = 0 from information_schema.processlist
- where info = "insert into $table values (0)";
+ where info = "insert into $table (i) values (0)";
--source include/wait_condition.inc
--disable_result_log
@@ -86,7 +86,7 @@ if (`SELECT '$restore_table' <> ''`)
{
--eval truncate table $restore_table;
--eval insert into $restore_table select * from t_backup;
-drop table t_backup;
+drop temporary table t_backup;
}
# Clean-up. Reset DEBUG_SYNC facility after use.
diff --git a/mysql-test/include/check_no_concurrent_insert.inc b/mysql-test/include/check_no_concurrent_insert.inc
index 278ffeffb1e..57772dddefc 100644
--- a/mysql-test/include/check_no_concurrent_insert.inc
+++ b/mysql-test/include/check_no_concurrent_insert.inc
@@ -10,9 +10,9 @@
# $con_aux2 Name of the second auxiliary connection to be used by this
# script.
# $statement Statement to be checked.
-# $restore_table Table which might be modified affected by statement to be
-# checked and thus needs backing up before its execution
-# and restoring after it (can be empty).
+# $restore_table Table which might be modified by statement to be checked
+# and thus needs backing up before its execution and
+# restoring after it (can be empty).
#
# EXAMPLE
# lock_sync.test
@@ -25,7 +25,7 @@ set debug_sync= "RESET";
if (`SELECT '$restore_table' <> ''`)
{
---eval create table t_backup select * from $restore_table;
+--eval create temporary table t_backup select * from $restore_table;
}
connection $con_aux1;
@@ -34,7 +34,7 @@ set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
connection $con_aux2;
set debug_sync='now WAIT_FOR parked';
---send_eval insert into $table values (0);
+--send_eval insert into $table (i) values (0);
--enable_result_log
--enable_query_log
@@ -43,7 +43,7 @@ connection default;
# of our statement.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Table lock" and info = "insert into $table values (0)";
+ where state = "Table lock" and info = "insert into $table (i) values (0)";
--source include/wait_condition.inc
--disable_result_log
@@ -71,7 +71,7 @@ if (`SELECT '$restore_table' <> ''`)
{
--eval truncate table $restore_table;
--eval insert into $restore_table select * from t_backup;
-drop table t_backup;
+drop temporary table t_backup;
}
# Clean-up. Reset DEBUG_SYNC facility after use.
diff --git a/mysql-test/include/check_no_row_lock.inc b/mysql-test/include/check_no_row_lock.inc
index 958161b9b7f..c08e7f35b10 100644
--- a/mysql-test/include/check_no_row_lock.inc
+++ b/mysql-test/include/check_no_row_lock.inc
@@ -29,9 +29,9 @@ connection default;
# Wait until statement is successfully executed while
# all rows in table are X-locked. This means that it
# does not acquire any row locks.
-# We use wait_condition.inc instead of simply executing
+# We use wait_condition.inc instead of simply reaping
# statement here in order to avoid deadlocks if test
-# fails and timing out instead.
+# fails and to time out gracefully instead.
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where info = "$statement";
diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc
index be82f67b9f8..77913fc8c18 100644
--- a/mysql-test/include/ctype_numconv.inc
+++ b/mysql-test/include/ctype_numconv.inc
@@ -1606,3 +1606,41 @@ drop function f1;
--echo # End of WL#2649 Number-to-string conversions
--echo #
+--echo #
+--echo # Bug#54668 User variable assignments get wrong type
+--echo #
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+
+
+--echo #
+--echo # Bug#52159 returning time type from function and empty left join causes debug assertion
+--echo #
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+--disable_warnings
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+--enable_warnings
+DROP TABLE t1;
+SET sql_mode=default;
diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc
index ad42615511a..d6216f3fe1e 100644
--- a/mysql-test/include/diff_tables.inc
+++ b/mysql-test/include/diff_tables.inc
@@ -65,17 +65,13 @@ let $_diff_table=$diff_table_2;
let $_diff_i=2;
while ($_diff_i) {
- # Parse out any leading "master:" or "slave:" from the table
- # specification and connect the appropriate server.
- let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`;
- if ($_diff_conn_master) {
- let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`;
- connection master;
- }
- let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`;
- if ($_diff_conn_slave) {
- let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`;
- connection slave;
+ # Parse out any leading "master:" or "slave:" from the table specification
+# and connect the appropriate server.
+ let $_pos= `SELECT LOCATE(':', '$_diff_table')`;
+ let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`;
+ if (`SELECT 'XX$_diff_conn' <> 'XX'`) {
+ let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`;
+ connection $_diff_conn;
}
# Sanity-check the input.
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index 66648aaf1bf..fe6abe13892 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -1351,6 +1351,13 @@ connection con1;
SELECT * FROM t1;
ROLLBACK;
+--echo # Switch to connection con2
+connection con2;
+ROLLBACK;
+
+--echo # Switch to connection con1
+connection con1;
+
--echo # 2. test for serialized update:
CREATE TABLE t2 (a INT);
@@ -1435,6 +1442,7 @@ connection con2;
--reap
SELECT * FROM t1;
+--enable_abort_on_error
connection default;
disconnect con1;
disconnect con2;
@@ -1556,3 +1564,36 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+--echo #
+--echo # Check that a TRUNCATE TABLE statement, needing an exclusive meta
+--echo # data lock, waits for a shared metadata lock owned by a concurrent
+--echo # transaction.
+--echo #
+
+eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
+INSERT INTO t1 VALUES (1),(2),(3);
+BEGIN;
+SELECT * FROM t1 ORDER BY a;
+--echo # Connection con1
+connect (con1, localhost, root,,);
+--send TRUNCATE TABLE t1;
+--echo # Connection default
+connection default;
+let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state='Waiting for table' AND info='TRUNCATE TABLE t1';
+--source include/wait_condition.inc
+SELECT * FROM t1 ORDER BY a;
+ROLLBACK;
+--echo # Connection con1
+connection con1;
+--echo # Reaping TRUNCATE TABLE
+--reap
+SELECT * FROM t1;
+--echo # Disconnect con1
+disconnect con1;
+--echo # Connection default
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc
index f21f8b20aa4..3c50e50ac0e 100644
--- a/mysql-test/include/mysqld--help.inc
+++ b/mysql-test/include/mysqld--help.inc
@@ -13,7 +13,7 @@ perl;
@skipvars=qw/basedir open-files-limit general-log-file log plugin-dir
log-slow-queries pid-file slow-query-log-file
datadir slave-load-tmpdir tmpdir/;
- @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster safemalloc debug temp-pool ssl des-key-file
+ @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file
thread-concurrency super-large-pages mutex-deadlock-detector null-audit/;
@env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR /;
$re1=join('|', @skipvars, @plugins);
diff --git a/mysql-test/include/parser_bug21114.inc b/mysql-test/include/parser_bug21114.inc
index eb709d5cc03..eb709d5cc03 100755..100644
--- a/mysql-test/include/parser_bug21114.inc
+++ b/mysql-test/include/parser_bug21114.inc
diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc
new file mode 100644
index 00000000000..c3a45578a79
--- /dev/null
+++ b/mysql-test/include/rpl_diff_tables.inc
@@ -0,0 +1,35 @@
+# #############################################################################
+# Check whether the given table is consistent between different master and
+# slaves
+#
+# Usage:
+# --let $diff_table= test.t1
+# --let $diff_server_list= master, slave, slave2
+# --source include/rpl_diff_tables.inc
+# #############################################################################
+
+if (`SELECT "XX$diff_table" = "XX"`)
+{
+ --die diff_table is null.
+}
+
+--let $_servers= master, slave
+if (`SELECT "XX$diff_server_list" <> "XX"`)
+{
+ --let $_servers= $diff_server_list
+}
+
+--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
+--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))`
+connection $_master;
+while (`SELECT "XX$_servers" <> "XX"`)
+{
+ --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
+ --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))`
+
+ --sync_slave_with_master $_slave
+ --let $diff_table_1= $_master:$diff_table
+ --let $diff_table_2= $_slave:$diff_table
+ --source include/diff_tables.inc
+ connection $_slave;
+}
diff --git a/mysql-test/include/show_msg.inc b/mysql-test/include/show_msg.inc
index 659dce14686..659dce14686 100755..100644
--- a/mysql-test/include/show_msg.inc
+++ b/mysql-test/include/show_msg.inc
diff --git a/mysql-test/include/show_msg80.inc b/mysql-test/include/show_msg80.inc
index 42fb35edbcc..42fb35edbcc 100755..100644
--- a/mysql-test/include/show_msg80.inc
+++ b/mysql-test/include/show_msg80.inc
diff --git a/mysql-test/lib/My/Handles.pm b/mysql-test/lib/My/Handles.pm
index 66ee22b403f..66ee22b403f 100755..100644
--- a/mysql-test/lib/My/Handles.pm
+++ b/mysql-test/lib/My/Handles.pm
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index 893e6d896be..f79c2d450b9 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -13,15 +13,20 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+SET(INSTALL_ARGS
+ DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess"
+ COMPONENT Test
+)
+
IF (WIN32)
- ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
- ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
+ MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
+ MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
ELSE()
- ADD_EXECUTABLE(my_safe_process safe_process.cc)
+ MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS})
ENDIF()
-INSTALL(TARGETS my_safe_process DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess")
+INSTALL(TARGETS my_safe_process DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
IF(WIN32)
- INSTALL(TARGETS my_safe_kill DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess")
+ INSTALL(TARGETS my_safe_kill DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
ENDIF()
-INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess")
+INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
index f72b851d0b6..f72b851d0b6 100755..100644
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index 50c433b9b39..1c778362975 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -159,7 +159,7 @@ int main(int argc, char* const argv[] )
signal(SIGCHLD, handle_signal);
signal(SIGABRT, handle_abort);
- sprintf(safe_process_name, "safe_process[%d]", own_pid);
+ sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);
message("Started");
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
index 8fffede0b62..8fffede0b62 100755..100644
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 4039825be55..f7a23ab34e7 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -41,6 +41,12 @@ our $opt_with_ndbcluster_only;
our $defaults_file;
our $defaults_extra_file;
our $quick_collect;
+# Set to 1 if you want the tests to override
+# default storage engine settings, and use MyISAM
+# as default. (temporary option used in connection
+# with the change of default storage engine to InnoDB)
+our $default_myisam= 1;
+
sub collect_option {
my ($opt, $value)= @_;
@@ -98,10 +104,11 @@ sub init_pattern {
#
##############################################################################
-sub collect_test_cases ($$$) {
+sub collect_test_cases ($$$$) {
my $opt_reorder= shift; # True if we're reordering tests
my $suites= shift; # Semicolon separated list of test suites
my $opt_cases= shift;
+ my $opt_skip_test_list= shift;
my $cases= []; # Array of hash(one hash for each testcase)
$do_test_reg= init_pattern($do_test, "--do-test");
@@ -125,7 +132,7 @@ sub collect_test_cases ($$$) {
{
foreach my $suite (split(",", $suites))
{
- push(@$cases, collect_one_suite($suite, $opt_cases));
+ push(@$cases, collect_one_suite($suite, $opt_cases, $opt_skip_test_list));
last if $some_test_found;
}
}
@@ -250,6 +257,7 @@ sub collect_one_suite($)
{
my $suite= shift; # Test suite name
my $opt_cases= shift;
+ my $opt_skip_test_list= shift;
my @cases; # Array of hash
mtr_verbose("Collecting: $suite");
@@ -311,18 +319,23 @@ sub collect_one_suite($)
# Build a hash of disabled testcases for this suite
# ----------------------------------------------------------------------
my %disabled;
- if ( open(DISABLED, "$testdir/disabled.def" ) )
- {
- while ( <DISABLED> )
+ my @disabled_collection= @{$opt_skip_test_list} if defined @{$opt_skip_test_list};
+ unshift (@disabled_collection, "$testdir/disabled.def");
+ for my $skip (@disabled_collection)
+ {
+ if ( open(DISABLED, $skip ) )
{
- chomp;
- if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
+ while ( <DISABLED> )
{
- $disabled{$1}= $2;
+ chomp;
+ if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
+ {
+ $disabled{$1}= $2 if not exists $disabled{$1};
+ }
}
+ close DISABLED;
}
- close DISABLED;
- }
+ }
# Read suite.opt file
my $suite_opt_file= "$testdir/suite.opt";
@@ -591,6 +604,9 @@ sub optimize_cases {
my $default_engine=
mtr_match_prefix($opt, "--default-storage-engine=");
+ # Allow use of uppercase, convert to all lower case
+ $default_engine =~ tr/A-Z/a-z/;
+
if (defined $default_engine){
#print " $tinfo->{name}\n";
@@ -948,10 +964,12 @@ sub collect_one_test_case {
return $tinfo unless $do_innodb_plugin;
}
}
- else
+ elsif ($default_myisam)
{
- push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb");
- push(@{$tinfo->{'slave_opt'}}, "--loose-skip-innodb");
+ # This is a temporary fix to allow non-innodb tests to run even if
+ # the default storage engine is innodb.
+ push(@{$tinfo->{'master_opt'}}, "--default-storage-engine=MyISAM");
+ push(@{$tinfo->{'slave_opt'}}, "--default-storage-engine=MyISAM");
}
if ( $tinfo->{'need_binlog'} )
diff --git a/mysql-test/lib/v1/mtr_misc.pl b/mysql-test/lib/v1/mtr_misc.pl
index 0173e8b8572..da2395a8a95 100644
--- a/mysql-test/lib/v1/mtr_misc.pl
+++ b/mysql-test/lib/v1/mtr_misc.pl
@@ -141,7 +141,6 @@ sub mtr_exe_maybe_exists (@) {
my @path= @_;
map {$_.= ".exe"} @path if $::glob_win32;
- map {$_.= ".nlm"} @path if $::glob_netware;
foreach my $path ( @path )
{
if($::glob_win32)
diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl
index 36aba983c34..84784ed19d4 100644
--- a/mysql-test/lib/v1/mtr_report.pl
+++ b/mysql-test/lib/v1/mtr_report.pl
@@ -253,19 +253,8 @@ sub mtr_report_stats ($) {
mtr_warning("can't read $errlog");
next;
}
- my $leak_reports_expected= undef;
while ( <ERR> )
{
- # There is a test case that purposely provokes a
- # SAFEMALLOC leak report, even though there is no actual
- # leak. We need to detect this, and ignore the warning in
- # that case.
- if (/Begin safemalloc memory dump:/) {
- $leak_reports_expected= 1;
- } elsif (/End safemalloc memory dump./) {
- $leak_reports_expected= undef;
- }
-
# Skip some non fatal warnings from the log files
if (
/\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or
@@ -426,9 +415,6 @@ sub mtr_report_stats ($) {
}
if ( /$pattern/ )
{
- if ($leak_reports_expected) {
- next;
- }
$found_problems= 1;
print WARN basename($errlog) . ": $testname: $_";
}
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index 64d7376605e..489db060e99 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -76,7 +76,6 @@ $| = 1; # Automatically flush STDOUT
our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl
our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl
our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
-our $glob_netware= ($^O eq "NetWare"); # NetWare
require "lib/v1/mtr_cases.pl";
require "lib/v1/mtr_im.pl";
@@ -3125,11 +3124,8 @@ sub install_db ($$) {
$path_vardir_trace, $type);
}
- if ( ! $glob_netware )
- {
- mtr_add_arg($args, "--lc-messages-dir=%s", $path_language);
- mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
- }
+ mtr_add_arg($args, "--lc-messages-dir=%s", $path_language);
+ mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
@@ -3882,8 +3878,6 @@ sub mysqld_arguments ($$$$) {
if ( $opt_valgrind_mysqld )
{
- mtr_add_arg($args, "%s--loose-skip-safemalloc", $prefix);
-
if ( $mysql_version_id < 50100 )
{
mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -4722,7 +4716,6 @@ sub run_check_testcase ($$) {
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
- mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
@@ -4805,7 +4798,6 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
- mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
diff --git a/mysql-test/mysql-stress-test.pl b/mysql-test/mysql-stress-test.pl
index e51eba04525..504bee1ebbc 100755
--- a/mysql-test/mysql-stress-test.pl
+++ b/mysql-test/mysql-stress-test.pl
@@ -123,7 +123,7 @@ $pid_file="mysql_stress_test.pid";
$opt_mysqltest= ($^O =~ /mswin32/i) ? "mysqltest.exe" : "mysqltest";
$opt_check_tests_file="";
# OBM adding a setting for 'max-connect-retries=20' the default of 500 is to high
-@mysqltest_args=("--silent", "-v", "--skip-safemalloc", "--max-connect-retries=20");
+@mysqltest_args=("--silent", "-v", "--max-connect-retries=20");
# Client ip address
$client_ip=inet_ntoa((gethostbyname(hostname()))[4]);
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 23a92828e2a..1a574fe6e6b 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -165,6 +165,7 @@ our @opt_extra_mysqld_opt;
my $opt_compress;
my $opt_ssl;
my $opt_skip_ssl;
+my @opt_skip_test_list;
our $opt_ssl_supported;
my $opt_ps_protocol;
my $opt_sp_protocol;
@@ -326,7 +327,7 @@ sub main {
}
mtr_report("Collecting tests...");
- my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases);
+ my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list);
if ( $opt_report_features ) {
# Put "report features" as the first test to run
@@ -944,9 +945,11 @@ sub command_line_setup {
'timestamp' => \&report_option,
'timediff' => \&report_option,
'max-connections=i' => \$opt_max_connections,
+ 'default-myisam!' => \&collect_option,
'help|h' => \$opt_usage,
'list-options' => \$opt_list_options,
+ 'skip-test-list=s' => \@opt_skip_test_list
);
GetOptions(%options) or usage("Can't read options");
@@ -2843,7 +2846,6 @@ sub mysql_install_db {
mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--basedir=%s", $install_basedir);
mtr_add_arg($args, "--datadir=%s", $install_datadir);
- mtr_add_arg($args, "--loose-innodb=OFF");
mtr_add_arg($args, "--loose-skip-falcon");
mtr_add_arg($args, "--loose-skip-ndbcluster");
mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/");
@@ -3178,7 +3180,6 @@ sub start_run_one ($$) {
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
mtr_add_arg($args, "--silent");
- mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--test-file=%s", "include/$run.test");
my $errfile= "$opt_vardir/tmp/$name.err";
@@ -3757,25 +3758,6 @@ sub extract_server_log ($$) {
}
$Ferr = undef; # Close error log file
- # mysql_client_test.test sends a COM_DEBUG packet to the server
- # to provoke a SAFEMALLOC leak report, ignore any warnings
- # between "Begin/end safemalloc memory dump"
- if ( grep(/Begin safemalloc memory dump:/, @lines) > 0)
- {
- my $discard_lines= 1;
- foreach my $line ( @lines )
- {
- if ($line =~ /Begin safemalloc memory dump:/){
- $discard_lines = 1;
- } elsif ($line =~ /End safemalloc memory dump./){
- $discard_lines = 0;
- }
-
- if ($discard_lines){
- $line = "ignored";
- }
- }
- }
return @lines;
}
@@ -3871,8 +3853,6 @@ sub start_check_warnings ($$) {
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
-
- mtr_add_arg($args, "--loose-skip-safemalloc");
mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test");
if ( $opt_embedded_server )
@@ -4303,8 +4283,6 @@ sub mysqld_arguments ($$$) {
if ( $opt_valgrind_mysqld )
{
- mtr_add_arg($args, "--loose-skip-safemalloc");
-
if ( $mysql_version_id < 50100 )
{
mtr_add_arg($args, "--skip-bdb");
@@ -4897,9 +4875,6 @@ sub start_check_testcase ($$$) {
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
-
- mtr_add_arg($args, "--skip-safemalloc");
-
mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result");
mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test");
mtr_add_arg($args, "--verbose");
@@ -4940,7 +4915,6 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--silent");
- mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
@@ -5440,6 +5414,9 @@ Options to control what test suites or cases to run
enable-disabled Run also tests marked as disabled
print-testcases Don't run the tests but print details about all the
selected tests, in the order they would be run.
+ skip-test-list=FILE Skip the tests listed in FILE. Each line in the file
+ is an entry and should be formatted as:
+ <TESTNAME> : <COMMENT>
Options that specify ports
@@ -5560,7 +5537,9 @@ Misc options
timediff With --timestamp, also print time passed since
*previous* test started
max-connections=N Max number of open connection to server in mysqltest
-
+ default-myisam Set default storage engine to MyISAM for non-innodb
+ tests. This is needed after switching default storage
+ engine to InnoDB.
HERE
exit(1);
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index 88f38a13b4a..685e1e5ba4b 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -12749,6 +12749,14 @@ ERROR HY000: Can't find file: 't1' (errno: 2)
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'
#
+# Ensure that TRUNCATE fails for non-empty archive tables.
+#
+CREATE TABLE t1 (a INT) ENGINE=ARCHIVE;
+INSERT INTO t1 VALUES (1);
+TRUNCATE TABLE t1;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+DROP TABLE t1;
+#
# BUG#46565 - repair of partition fail for archive engine
#
# Installing corrupted table files for t1.
diff --git a/mysql-test/r/bug46080.result b/mysql-test/r/bug46080.result
index 44f6bba8db6..44f6bba8db6 100755..100644
--- a/mysql-test/r/bug46080.result
+++ b/mysql-test/r/bug46080.result
diff --git a/mysql-test/r/bug46760.result b/mysql-test/r/bug46760.result
index 413df050b10..46b8c23b95c 100644
--- a/mysql-test/r/bug46760.result
+++ b/mysql-test/r/bug46760.result
@@ -25,7 +25,7 @@ DROP TABLE t1;
# MySQL Bug#39200: optimize table does not recognize
# ROW_FORMAT=COMPRESSED
#
-CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
+CREATE TABLE t1 (a INT) ROW_FORMAT=compressed, ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/commit.result b/mysql-test/r/commit.result
new file mode 100644
index 00000000000..8620d2077c6
--- /dev/null
+++ b/mysql-test/r/commit.result
@@ -0,0 +1,272 @@
+#
+# Bug#20837 Apparent change of isolation level
+# during transaction
+#
+# Bug#53343 completion_type=1, COMMIT/ROLLBACK
+# AND CHAIN don't preserve the isolation
+# level
+connection default;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+CREATE TABLE t1 (s1 INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+COMMIT;
+START TRANSACTION;
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+ERROR 25001: Transaction isolation level can't be changed while a transaction is in progress
+COMMIT;
+SET @@autocommit=0;
+COMMIT;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+START TRANSACTION;
+SELECT @@tx_isolation;
+@@tx_isolation
+REPEATABLE-READ
+Should be REPEATABLE READ
+SELECT * FROM t1;
+s1
+1
+2
+SELECT @@tx_isolation;
+@@tx_isolation
+REPEATABLE-READ
+Should be REPEATABLE READ
+INSERT INTO t1 VALUES (-1);
+SELECT @@tx_isolation;
+@@tx_isolation
+REPEATABLE-READ
+Should be REPEATABLE READ
+COMMIT;
+START TRANSACTION;
+SELECT * FROM t1;
+s1
+1
+2
+-1
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+connection con1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1000);
+COMMIT;
+connection default
+We should not be able to read the '1000'
+SELECT * FROM t1;
+s1
+1
+2
+-1
+COMMIT;
+Now, the '1000' should appear.
+START TRANSACTION;
+SELECT * FROM t1;
+s1
+1
+2
+-1
+1000
+COMMIT;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+connection default
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+connection con1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+connection default
+SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
+COUNT(*)
+1
+Should be 1
+COMMIT AND CHAIN;
+connection con1
+INSERT INTO t1 VALUES (1002);
+COMMIT;
+connection default
+SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
+COUNT(*)
+1
+Should be 1
+COMMIT;
+SELECT * FROM t1;
+s1
+1
+2
+-1
+1000
+1001
+1002
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT;
+connection default
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+connection con1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+connection default
+SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
+COUNT(*)
+1
+Should be 1
+ROLLBACK AND CHAIN;
+connection con1
+INSERT INTO t1 VALUES (1002);
+COMMIT;
+connection default
+SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
+COUNT(*)
+1
+Should be 1
+COMMIT;
+SELECT * FROM t1;
+s1
+1
+2
+-1
+1001
+1002
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT;
+SET @@completion_type=1;
+connection default
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+connection con1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+connection default
+SELECT * FROM t1 WHERE s1 >= 1000;
+s1
+1001
+Should see 1001
+COMMIT AND NO CHAIN;
+default transaction is now in REPEATABLE READ
+connection con1
+INSERT INTO t1 VALUES (1002);
+COMMIT;
+connection default
+SELECT * FROM t1 WHERE s1 >= 1000;
+s1
+1001
+1002
+Should see 1001 and 1002
+connection con1
+INSERT INTO t1 VALUES (1003);
+COMMIT;
+connection default
+SELECT * FROM t1 WHERE s1 >= 1000;
+s1
+1001
+1002
+Should see 1001 and 1002, but NOT 1003
+COMMIT;
+SELECT * FROM t1;
+s1
+1
+2
+-1
+1001
+1002
+1003
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT AND NO CHAIN;
+SET @@completion_type=0;
+COMMIT;
+connection default
+SET @@completion_type=1;
+COMMIT AND NO CHAIN;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+connection con1
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+connection default
+SELECT * FROM t1 WHERE s1 >= 1000;
+s1
+1001
+Should see 1001
+ROLLBACK AND NO CHAIN;
+default transaction is now in REPEATABLE READ
+connection con1
+INSERT INTO t1 VALUES (1002);
+COMMIT;
+connection default
+SELECT * FROM t1 WHERE s1 >= 1000;
+s1
+1001
+1002
+Should see 1001 and 1002
+connection con1
+INSERT INTO t1 VALUES (1003);
+COMMIT;
+connection default
+SELECT * FROM t1 WHERE s1 >= 1000;
+s1
+1001
+1002
+Should see 1001 and 1002, but NOT 1003
+COMMIT;
+SELECT * FROM t1;
+s1
+1
+2
+-1
+1001
+1002
+1003
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT AND NO CHAIN;
+SET @@completion_type=0;
+COMMIT;
+connection default
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+START TRANSACTION;
+SELECT * FROM t1;
+s1
+1
+2
+-1
+connection con1
+INSERT INTO t1 VALUES (1000);
+COMMIT;
+connection default
+SELECT * FROM t1;
+s1
+1
+2
+-1
+Should get same result as above (i.e should not read '1000')
+COMMIT;
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT;
+SET @@completion_type=1;
+COMMIT AND NO CHAIN;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (1000);
+SELECT * FROM t1;
+s1
+1000
+Should read '1000'
+connection con1
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+connection default
+SELECT * FROM t1;
+s1
+1000
+Should only read the '1000' as this transaction is now in REP READ
+COMMIT AND NO CHAIN;
+SET @@completion_type=0;
+COMMIT AND NO CHAIN;
+SET @autocommit=1;
+COMMIT;
+DROP TABLE t1;
+#
+# End of test cases for Bug#20837
+#
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index e37f9d580ba..fce775c5952 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -99,6 +99,14 @@ create table t1 (`` int);
ERROR 42000: Incorrect column name ''
create table t1 (i int, index `` (i));
ERROR 42000: Incorrect index name ''
+create table t1 (i int);
+lock tables t1 read;
+create table t2 (j int);
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+create temporary table t2 (j int);
+drop temporary table t2;
+unlock tables;
+drop table t1;
create table t1 (a int auto_increment not null primary key, B CHAR(20));
insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1;
@@ -377,6 +385,17 @@ ERROR 42S01: Table 't3' already exists
drop table t1, t2, t3;
drop table t3;
drop database mysqltest;
+create table t1 (i int);
+create table t2 (j int);
+lock tables t1 read;
+create table t3 like t1;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
+create temporary table t3 like t1;
+drop temporary table t3;
+create temporary table t3 like t2;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+unlock tables;
+drop tables t1, t2;
SET SESSION storage_engine="heap";
SELECT @@storage_engine;
@@storage_engine
@@ -2033,3 +2052,39 @@ ID
3
DROP TABLE t1;
DROP TEMPORARY TABLE t2;
+#
+# Bug #22909 "Using CREATE ... LIKE is possible to create field
+# with invalid default value"
+#
+# Altough original bug report suggests to use older version of MySQL
+# for producing .FRM with invalid defaults we use sql_mode to achieve
+# the same effect.
+drop tables if exists t1, t2;
+# Attempt to create table with invalid default should fail in normal mode
+create table t1 (dt datetime default '2008-02-31 00:00:00');
+ERROR 42000: Invalid default value for 'dt'
+set @old_mode= @@sql_mode;
+set @@sql_mode='ALLOW_INVALID_DATES';
+# The same should be possible in relaxed mode
+create table t1 (dt datetime default '2008-02-31 00:00:00');
+set @@sql_mode= @old_mode;
+# In normal mode attempt to create copy of table with invalid
+# default should fail
+create table t2 like t1;
+ERROR 42000: Invalid default value for 'dt'
+set @@sql_mode='ALLOW_INVALID_DATES';
+# But should work in relaxed mode
+create table t2 like t1;
+# Check that table definitions match
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `dt` datetime DEFAULT '2008-02-31 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `dt` datetime DEFAULT '2008-02-31 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+set @@sql_mode= @old_mode;
+drop tables t1, t2;
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 3ffb087c1d3..76a4d0f3cf3 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -2567,5 +2567,56 @@ drop function f1;
# End of WL#2649 Number-to-string conversions
#
#
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+binary binary
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+binary binary
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+binary binary
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+binary binary
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+binary binary
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+binary binary
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+binary binary
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index e0339ee2109..f93cb5f9a12 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -2649,5 +2649,56 @@ drop function f1;
# End of WL#2649 Number-to-string conversions
#
#
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+cp1251 cp1251_general_ci
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+cp1251 cp1251_general_ci
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+cp1251 cp1251_general_ci
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+cp1251 cp1251_general_ci
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+cp1251 cp1251_general_ci
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+cp1251 cp1251_general_ci
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+cp1251 cp1251_general_ci
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result
index bd25b1beed4..bd25b1beed4 100755..100644
--- a/mysql-test/r/ctype_eucjpms.result
+++ b/mysql-test/r/ctype_eucjpms.result
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 4f0e863bfca..43ee365cd53 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -2977,5 +2977,56 @@ drop function f1;
# End of WL#2649 Number-to-string conversions
#
#
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+latin1 latin1_swedish_ci
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+latin1 latin1_swedish_ci
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+latin1 latin1_swedish_ci
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+latin1 latin1_swedish_ci
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+latin1 latin1_swedish_ci
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+latin1 latin1_swedish_ci
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+latin1 latin1_swedish_ci
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 4f033d54043..7bb27e03acc 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -3808,6 +3808,57 @@ drop function f1;
#
# End of WL#2649 Number-to-string conversions
#
+#
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+ucs2 ucs2_general_ci
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+ucs2 ucs2_general_ci
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+ucs2 ucs2_general_ci
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+ucs2 ucs2_general_ci
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+ucs2 ucs2_general_ci
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+ucs2 ucs2_general_ci
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+ucs2 ucs2_general_ci
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
SET NAMES latin1;
#
# End of 5.5 tests
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 17ec2b09a0a..f1712a650b1 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -157,3 +157,13 @@ Error 1051 Unknown table 't1'
# --
# -- End of Bug#37431.
# --
+#
+# Bug#54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+LOCK TABLE t1 WRITE;
+DROP TABLE t1, t1;
+ERROR 42000: Not unique table/alias: 't1'
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index fc58687cc86..b6b79cb596b 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -48,5 +48,40 @@ Got one of the listed errors
SET SESSION debug=DEFAULT;
DROP TABLE t1;
#
+# Bug#41660: Sort-index_merge for non-first join table may require
+# O(#scans) memory
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b));
+INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C;
+INSERT INTO t2 VALUES (1, 1, 'data');
+# the example query uses LEFT JOIN only for the sake of being able to
+# demonstrate the issue with a very small dataset. (left outer join
+# disables the use of join buffering, so we get the second table
+# re-scanned for every record in the outer table. if we used inner join,
+# we would need to have thousands of records and/or more columns in both
+# tables so that the join buffer is filled and re-scans are triggered).
+SET SESSION debug = '+d,only_one_Unique_may_be_created';
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+id select_type table type possible_keys key key_len ref rows Extra
+x x x x x x x x x
+x x x x x x x x x Using sort_union(a,b); Using where
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+a a b filler
+0 1 1 data
+1 1 1 data
+2 1 1 data
+3 1 1 data
+4 1 1 data
+5 1 1 data
+6 1 1 data
+7 1 1 data
+8 1 1 data
+9 1 1 data
+SET SESSION debug = DEFAULT;
+DROP TABLE t1, t2;
+#
# End of 5.1 tests
#
diff --git a/mysql-test/r/analyse.result b/mysql-test/r/func_analyse.result
index 1820782d2f8..1820782d2f8 100644
--- a/mysql-test/r/analyse.result
+++ b/mysql-test/r/func_analyse.result
diff --git a/mysql-test/r/func_digest.result b/mysql-test/r/func_digest.result
index ff3a4dcf79a..095b69363ce 100644
--- a/mysql-test/r/func_digest.result
+++ b/mysql-test/r/func_digest.result
@@ -1405,3 +1405,24 @@ LENGTH(SHA2( 'size', 384 )) / 2 * 8 = 384
SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512;
LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512
1
+#
+# Bug#54661 sha2() returns BINARY result
+#
+SET NAMES binary;
+SELECT sha2('1',224);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def sha2('1',224) 253 56 56 Y 128 31 63
+sha2('1',224)
+e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
+SET NAMES utf8;
+SELECT sha2('1',224);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def sha2('1',224) 253 168 56 Y 0 31 33
+sha2('1',224)
+e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
+SET NAMES latin1;
+SELECT sha2('1',224);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def sha2('1',224) 253 56 56 Y 0 31 8
+sha2('1',224)
+e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index ffdacc43735..fdeec2755ca 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -750,4 +750,24 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1;
#
+# Bug#54477: Crash on IN / CASE with NULL arguments
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT 1 IN (NULL, a) FROM t1;
+1 IN (NULL, a)
+1
+NULL
+SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP;
+a IN (a, a)
+1
+1
+NULL
+SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP;
+CASE a WHEN a THEN a END
+1
+2
+NULL
+DROP TABLE t1;
+#
End of 5.1 tests
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 8d0f34f3bda..552ff564a89 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -169,3 +169,17 @@ select 'andre%' like 'andreÊ%' escape 'Ê';
select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê';
_cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'
1
+End of 4.1 tests
+#
+# Bug #54575: crash when joining tables with unique set column
+#
+CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
+CREATE TABLE t2(b INT PRIMARY KEY);
+INSERT INTO t1 VALUES ();
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
+INSERT INTO t2 VALUES (1), (2), (3);
+SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
+1
+DROP TABLE t1, t2;
+End of 5.1 tests
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index cdf48376fb0..3416e368dff 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1812,3 +1812,32 @@ MAX(t2.a)
DROP TABLE t1, t2;
#
# End of 5.1 tests
+#
+# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
+#
+CREATE TABLE t1 (f1 int, f2 DATE);
+INSERT INTO t1 VALUES (1,'2004-04-19'), (1,'0000-00-00'), (1,'2004-04-18'),
+(2,'2004-05-19'), (2,'0001-01-01'), (3,'2004-04-10');
+SELECT MIN(f2),MAX(f2) FROM t1;
+MIN(f2) MAX(f2)
+0000-00-00 2004-05-19
+SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1;
+f1 MIN(f2) MAX(f2)
+1 0000-00-00 2004-04-19
+2 0001-01-01 2004-05-19
+3 2004-04-10 2004-04-10
+DROP TABLE t1;
+CREATE TABLE t1 ( f1 int, f2 time);
+INSERT INTO t1 VALUES (1,'01:27:35'), (1,'06:11:01'), (2,'19:53:05'),
+(2,'21:44:25'), (3,'10:55:12'), (3,'05:45:11'), (4,'00:25:00');
+SELECT MIN(f2),MAX(f2) FROM t1;
+MIN(f2) MAX(f2)
+00:25:00 21:44:25
+SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1;
+f1 MIN(f2) MAX(f2)
+1 01:27:35 06:11:01
+2 19:53:05 21:44:25
+3 05:45:11 10:55:12
+4 00:25:00 00:25:00
+DROP TABLE t1;
+#End of test#49771
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index c69de0f307b..daf043860a4 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -532,3 +532,19 @@ Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'd'
DROP TABLE t1,t2;
End of 5.0 tests
+#
+# Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set
+#
+CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (1,'f');
+CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1));
+INSERT INTO t2 VALUES (2,'m');
+INSERT INTO t2 VALUES (3,'m');
+INSERT INTO t2 VALUES (11,NULL);
+INSERT INTO t2 VALUES (12,'k');
+SELECT MAX(t1.f1) field1
+FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
+HAVING field1 < 7;
+field1
+DROP TABLE t1,t2;
+End of 5.1 tests
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 86fa9d76864..21b42577a11 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1427,7 +1427,7 @@ USE test;
End of 5.0 tests.
select * from information_schema.engines WHERE ENGINE="MyISAM";
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
-MyISAM DEFAULT Default engine as of MySQL 3.23 with great performance NO NO NO
+MyISAM DEFAULT MyISAM storage engine NO NO NO
grant select on *.* to user3148@localhost;
select user,db from information_schema.processlist;
user db
@@ -1681,6 +1681,33 @@ COUNT(*)
DROP USER nonpriv;
DROP TABLE db1.t1;
DROP DATABASE db1;
+
+Bug#54422 query with = 'variables'
+
+CREATE TABLE variables(f1 INT);
+SELECT COLUMN_DEFAULT, TABLE_NAME
+FROM INFORMATION_SCHEMA.COLUMNS
+WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
+COLUMN_DEFAULT TABLE_NAME
+NULL variables
+DROP TABLE variables;
+#
+# Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19,
+# should be 20
+#
+CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
+SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION
+FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
+TABLE_NAME COLUMN_NAME NUMERIC_PRECISION
+ubig a 19
+ubig b 20
+INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT length(CAST(b AS CHAR)) FROM ubig;
+length(CAST(b AS CHAR))
+20
+DROP TABLE ubig;
End of 5.1 tests.
#
# Additional test for WL#3726 "DDL locking for all metadata objects"
diff --git a/mysql-test/r/information_schema_parameters.result b/mysql-test/r/information_schema_parameters.result
index db04f5c0bd3..288f22e2ea3 100644
--- a/mysql-test/r/information_schema_parameters.result
+++ b/mysql-test/r/information_schema_parameters.result
@@ -25,7 +25,7 @@ WHERE table_schema = 'information_schema'
ORDER BY ordinal_position;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_CATALOG
ORDINAL_POSITION 1
COLUMN_DEFAULT
@@ -44,7 +44,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_SCHEMA
ORDINAL_POSITION 2
COLUMN_DEFAULT
@@ -63,7 +63,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_NAME
ORDINAL_POSITION 3
COLUMN_DEFAULT
@@ -82,7 +82,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME ORDINAL_POSITION
ORDINAL_POSITION 4
COLUMN_DEFAULT 0
@@ -101,7 +101,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME PARAMETER_MODE
ORDINAL_POSITION 5
COLUMN_DEFAULT NULL
@@ -120,7 +120,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME PARAMETER_NAME
ORDINAL_POSITION 6
COLUMN_DEFAULT NULL
@@ -139,7 +139,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME DATA_TYPE
ORDINAL_POSITION 7
COLUMN_DEFAULT
@@ -158,7 +158,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_MAXIMUM_LENGTH
ORDINAL_POSITION 8
COLUMN_DEFAULT NULL
@@ -177,7 +177,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_OCTET_LENGTH
ORDINAL_POSITION 9
COLUMN_DEFAULT NULL
@@ -196,7 +196,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME NUMERIC_PRECISION
ORDINAL_POSITION 10
COLUMN_DEFAULT NULL
@@ -215,7 +215,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME NUMERIC_SCALE
ORDINAL_POSITION 11
COLUMN_DEFAULT NULL
@@ -234,7 +234,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_SET_NAME
ORDINAL_POSITION 12
COLUMN_DEFAULT NULL
@@ -253,7 +253,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME COLLATION_NAME
ORDINAL_POSITION 13
COLUMN_DEFAULT NULL
@@ -272,7 +272,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME DTD_IDENTIFIER
ORDINAL_POSITION 14
COLUMN_DEFAULT NULL
@@ -291,7 +291,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME ROUTINE_TYPE
ORDINAL_POSITION 15
COLUMN_DEFAULT
diff --git a/mysql-test/r/information_schema_routines.result b/mysql-test/r/information_schema_routines.result
index 664ec6bf748..aa4766f0a6b 100644
--- a/mysql-test/r/information_schema_routines.result
+++ b/mysql-test/r/information_schema_routines.result
@@ -40,7 +40,7 @@ WHERE table_schema = 'information_schema'
ORDER BY ordinal_position;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SPECIFIC_NAME
ORDINAL_POSITION 1
COLUMN_DEFAULT
@@ -59,7 +59,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_CATALOG
ORDINAL_POSITION 2
COLUMN_DEFAULT
@@ -78,7 +78,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_SCHEMA
ORDINAL_POSITION 3
COLUMN_DEFAULT
@@ -97,7 +97,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_NAME
ORDINAL_POSITION 4
COLUMN_DEFAULT
@@ -116,7 +116,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_TYPE
ORDINAL_POSITION 5
COLUMN_DEFAULT
@@ -135,7 +135,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME DATA_TYPE
ORDINAL_POSITION 6
COLUMN_DEFAULT
@@ -154,7 +154,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_MAXIMUM_LENGTH
ORDINAL_POSITION 7
COLUMN_DEFAULT NULL
@@ -173,7 +173,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_OCTET_LENGTH
ORDINAL_POSITION 8
COLUMN_DEFAULT NULL
@@ -192,7 +192,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME NUMERIC_PRECISION
ORDINAL_POSITION 9
COLUMN_DEFAULT NULL
@@ -211,7 +211,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME NUMERIC_SCALE
ORDINAL_POSITION 10
COLUMN_DEFAULT NULL
@@ -230,7 +230,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_SET_NAME
ORDINAL_POSITION 11
COLUMN_DEFAULT NULL
@@ -249,7 +249,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME COLLATION_NAME
ORDINAL_POSITION 12
COLUMN_DEFAULT NULL
@@ -268,7 +268,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME DTD_IDENTIFIER
ORDINAL_POSITION 13
COLUMN_DEFAULT NULL
@@ -287,7 +287,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_BODY
ORDINAL_POSITION 14
COLUMN_DEFAULT
@@ -306,7 +306,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_DEFINITION
ORDINAL_POSITION 15
COLUMN_DEFAULT NULL
@@ -325,7 +325,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME EXTERNAL_NAME
ORDINAL_POSITION 16
COLUMN_DEFAULT NULL
@@ -344,7 +344,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME EXTERNAL_LANGUAGE
ORDINAL_POSITION 17
COLUMN_DEFAULT NULL
@@ -363,7 +363,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME PARAMETER_STYLE
ORDINAL_POSITION 18
COLUMN_DEFAULT
@@ -382,7 +382,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME IS_DETERMINISTIC
ORDINAL_POSITION 19
COLUMN_DEFAULT
@@ -401,7 +401,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SQL_DATA_ACCESS
ORDINAL_POSITION 20
COLUMN_DEFAULT
@@ -420,7 +420,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SQL_PATH
ORDINAL_POSITION 21
COLUMN_DEFAULT NULL
@@ -439,7 +439,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SECURITY_TYPE
ORDINAL_POSITION 22
COLUMN_DEFAULT
@@ -458,7 +458,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CREATED
ORDINAL_POSITION 23
COLUMN_DEFAULT 0000-00-00 00:00:00
@@ -477,7 +477,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME LAST_ALTERED
ORDINAL_POSITION 24
COLUMN_DEFAULT 0000-00-00 00:00:00
@@ -496,7 +496,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SQL_MODE
ORDINAL_POSITION 25
COLUMN_DEFAULT
@@ -515,7 +515,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_COMMENT
ORDINAL_POSITION 26
COLUMN_DEFAULT NULL
@@ -534,7 +534,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME DEFINER
ORDINAL_POSITION 27
COLUMN_DEFAULT
@@ -553,7 +553,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_SET_CLIENT
ORDINAL_POSITION 28
COLUMN_DEFAULT
@@ -572,7 +572,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME COLLATION_CONNECTION
ORDINAL_POSITION 29
COLUMN_DEFAULT
@@ -591,7 +591,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME DATABASE_COLLATION
ORDINAL_POSITION 30
COLUMN_DEFAULT
diff --git a/mysql-test/r/innodb_mysql_lock2.result b/mysql-test/r/innodb_mysql_lock2.result
index aed704e6b3e..17dd747de6f 100644
--- a/mysql-test/r/innodb_mysql_lock2.result
+++ b/mysql-test/r/innodb_mysql_lock2.result
@@ -178,8 +178,7 @@ end|
# 1.1 Simple SELECT statement.
#
# No locks are necessary as this statement won't be written
-# to the binary log and thanks to how MyISAM works SELECT
-# will see version of the table prior to concurrent insert.
+# to the binary log and InnoDB supports snapshots.
Success: 'select * from t1' doesn't take row locks on 't1'.
#
# 1.2 Multi-UPDATE statement.
@@ -484,7 +483,7 @@ Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' takes sh
# row locks on the data it reads.
Success: 'call p2(@a)' doesn't take row locks on 't1'.
#
-# 5.2 Function that modifes data and uses CALL,
+# 5.2 Function that modifies data and uses CALL,
# which reads a table through SELECT.
#
# Since a call to such function is written to the binary
@@ -562,3 +561,68 @@ drop view v1, v2;
drop procedure p1;
drop procedure p2;
drop table t1, t2, t3, t4, t5;
+#
+# Test for bug#51263 "Deadlock between transactional SELECT
+# and ALTER TABLE ... REBUILD PARTITION".
+#
+drop table if exists t1, t2;
+create table t1 (i int auto_increment not null primary key) engine=innodb;
+create table t2 (i int) engine=innodb;
+insert into t1 values (1), (2), (3), (4), (5);
+begin;
+# Acquire SR metadata lock on t1 and LOCK_S row-locks on its rows.
+insert into t2 select count(*) from t1;
+# Switching to connection 'con1'.
+# Sending:
+alter table t1 add column j int;
+# Switching to connection 'default'.
+# Wait until ALTER is blocked because it tries to upgrade SNW
+# metadata lock to X lock.
+# It should not be blocked during copying data to new version of
+# table as it acquires LOCK_S locks on rows of old version, which
+# are compatible with locks acquired by connection 'con1'.
+# The below statement will deadlock because it will try to acquire
+# SW lock on t1, which will conflict with ALTER's SNW lock. And
+# ALTER will be waiting for this connection to release its SR lock.
+# This deadlock should be detected by an MDL subsystem and this
+# statement should be aborted with an appropriate error.
+insert into t1 values (6);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+# Unblock ALTER TABLE.
+commit;
+# Switching to connection 'con1'.
+# Reaping ALTER TABLE.
+# Switching to connection 'default'.
+#
+# Now test for scenario in which bug was reported originally.
+#
+drop tables t1, t2;
+create table t1 (i int auto_increment not null primary key) engine=innodb
+partition by hash (i) partitions 4;
+create table t2 (i int) engine=innodb;
+insert into t1 values (1), (2), (3), (4), (5);
+begin;
+# Acquire SR metadata lock on t1.
+select * from t1;
+i
+1
+2
+3
+4
+5
+# Switching to connection 'con1'.
+# Sending:
+alter table t1 rebuild partition p0;
+# Switching to connection 'default'.
+# Wait until ALTER is blocked because of active SR lock.
+# The below statement should succeed as transaction
+# has SR metadata lock on t1 and only going to read
+# rows from it.
+insert into t2 select count(*) from t1;
+# Unblock ALTER TABLE.
+commit;
+# Switching to connection 'con1'.
+# Reaping ALTER TABLE.
+# Switching to connection 'default'.
+# Clean-up.
+drop tables t1, t2;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index a7407cfa699..1c59f41cfc0 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -503,4 +503,33 @@ DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL);
LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
DROP TABLE t1;
+#
+# Bug #51876 : crash/memory underrun when loading data with ucs2
+# and reverse() function
+#
+# Problem # 1 (original report): wrong parsing of ucs2 data
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+Warnings:
+Warning 1366 Incorrect integer value: '?' for column 'a' at row 1
+Warning 1366 Incorrect integer value: '?' for column 'a' at row 2
+# should return 2 zeroes (as the value is truncated)
+SELECT * FROM t1;
+a
+0
+0
+DROP TABLE t1;
+# Problem # 2 : if you write and read ucs2 data to a file they're lost
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+# should return 0 and 1 (10 reversed)
+SELECT * FROM t1;
+a
+0
+1
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result
index e6265f1cb5e..3682f0df26a 100644
--- a/mysql-test/r/lock_sync.result
+++ b/mysql-test/r/lock_sync.result
@@ -511,7 +511,7 @@ Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' doesn't
# strong locks on the data it reads.
Success: 'call p2(@a)' allows concurrent inserts into 't1'.
#
-# 5.2 Function that modifes data and uses CALL,
+# 5.2 Function that modifies data and uses CALL,
# which reads a table through SELECT.
#
# Since a call to such function is written to the binary
diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result
index 714a14c1f4f..4c54f12b34f 100644
--- a/mysql-test/r/log_state.result
+++ b/mysql-test/r/log_state.result
@@ -333,7 +333,7 @@ rows_examined sql_text
2 INSERT INTO t1 SELECT b+sleep(.01) from t2
4 UPDATE t1 SET a=a+sleep(.01) WHERE a>2
8 UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC
-2 UPDATE t2 set b=b+sleep(.01) limit 1
+1 UPDATE t2 set b=b+sleep(.01) limit 1
4 UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2)
6 DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2
DROP TABLE t1,t2;
diff --git a/mysql-test/r/lowercase_mixed_tmpdir_innodb.result b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result
index a478b49cfda..a478b49cfda 100755..100644
--- a/mysql-test/r/lowercase_mixed_tmpdir_innodb.result
+++ b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index b621a466a29..26a151b55aa 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -2,7 +2,7 @@ DROP TABLE IF EXISTS t1,t2,t3,t2aA,t1Aa;
DROP DATABASE IF EXISTS `TEST_$1`;
DROP DATABASE IF EXISTS `test_$1`;
DROP DATABASE IF EXISTS mysqltest_LC2;
-CREATE TABLE T1 (a int);
+CREATE TABLE T1 (a int) ENGINE=MyISAM;
INSERT INTO T1 VALUES (1);
SHOW TABLES LIKE "T1";
Tables_in_test (T1)
diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result
index c37dc41c495..33c87ec101c 100644
--- a/mysql-test/r/lowercase_view.result
+++ b/mysql-test/r/lowercase_view.result
@@ -148,3 +148,20 @@ a
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests.
+#
+# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
+# returns nothing
+#
+CREATE TABLE `ttt` (
+`f1` char(3) NOT NULL,
+PRIMARY KEY (`f1`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
+'TTT';
+count(COLUMN_NAME)
+1
+SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
+count(*)
+1
+DROP TABLE `ttt`;
+End of 5.0 tests.
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index b78b8dadc77..67d778211dd 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -330,9 +330,9 @@ select column_name from information_schema.columns where
table_schema='test' and table_name='t1';
column_name
c1
-select count(*) from t1;
-count(*)
-4
+# Disable result log to make test robust against
+# effects of concurrent insert.
+select * from t1;
insert into t1 values (1);
# Check that SNW lock is not compatible with SW lock.
# Again we use ALTER TABLE which fails after opening
@@ -1765,6 +1765,7 @@ drop tables t1, t2;
# locking subsystem.
#
drop tables if exists t0, t1, t2, t3, t4, t5;
+set debug_sync= 'RESET';
create table t1 (i int);
create table t2 (j int);
create table t3 (k int);
@@ -1943,6 +1944,98 @@ commit;
# Reap ALTER TABLE ... RENAME.
drop table t2;
#
+# Test that in situation when MDL subsystem detects a deadlock
+# but it turns out that it can be resolved by backing-off locks
+# acquired by one of participating transactions (which is
+# possible when one of transactions consists only of currently
+# executed statement, e.g. in autocommit mode) no error is
+# reported.
+#
+create table t1 (i int);
+create table t2 (j int);
+# Ensure that the below SELECT stops once it has acquired metadata
+# lock on table 't2'.
+set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
+# Sending:
+select * from t2, t1;
+#
+# Switching to connection 'deadlock_con1'.
+# Wait till SELECT acquires MDL on 't2' and starts waiting for signal.
+set debug_sync= 'now WAIT_FOR locked';
+# Sending:
+lock tables t1 write, t2 write;
+#
+# Switching to connection 'deadlock_con2'.
+# Wait until LOCK TABLES acquires SNRW lock on 't1' and is blocked
+# while trying to acquire SNRW lock on 't1'.
+# Resume SELECT execution, this should eventually unblock LOCK TABLES.
+set debug_sync= 'now SIGNAL finish';
+#
+# Switching to connection 'deadlock_con1'.
+# Reaping LOCK TABLES.
+unlock tables;
+#
+# Switching to connection 'default'.
+# Reaping SELECT. It succeed and not report ER_LOCK_DEADLOCK error.
+j i
+drop tables t1, t2;
+#
+# Test coverage for situation in which a race has happened
+# during deadlock detection process which led to unwarranted
+# ER_LOCK_DEADLOCK error.
+#
+create table t1 (i int);
+# Ensure that ALTER waits once it has acquired SNW lock.
+set debug_sync='after_open_table_mdl_shared SIGNAL parked1 WAIT_FOR go1';
+# Sending:
+alter table t1 add column j int;
+#
+# Switching to connection 'deadlock_con1'.
+# Wait till ALTER acquires SNW lock and stops.
+set debug_sync='now WAIT_FOR parked1';
+# Ensure that INSERT is paused once it detects that there is
+# a conflicting metadata lock so it has to wait, but before
+# deadlock detection is run.
+set debug_sync='mdl_acquire_lock_wait SIGNAL parked2 WAIT_FOR go2';
+# Sending:
+insert into t1 values ();
+#
+# Switching to connection 'deadlock_con2'.
+# Wait till INSERT is paused.
+set debug_sync='now WAIT_FOR parked2';
+# Resume ALTER execution. Eventually it will release its
+# metadata lock and INSERT's request for SW lock will be
+# satisified.
+set debug_sync='now SIGNAL go1';
+#
+# Switching to connection 'default'.
+# Reaping ALTER TABLE.
+# Add a new request for SNW lock to waiting graph.
+# Sending:
+alter table t1 drop column j;
+#
+# Switching to connection 'deadlock_con2'.
+# Wait until ALTER is blocked.
+# Resume INSERT so it can start deadlock detection.
+#
+# At this point there is a discrepancy between the fact that INSERT's
+# SW lock is already satisfied, but INSERT's connection is still
+# marked as waiting for it. Looking for a loop in waiters graph
+# without additional checks has detected a deadlock (INSERT waits
+# for SW lock; which is not granted because of pending SNW lock from
+# ALTER; which waits for active SW lock from INSERT). Since requests
+# for SW and SNW locks have same weight ALTER was selected as a victim
+# and ended with ER_LOCK_DEADLOCK error.
+set debug_sync='now SIGNAL go2';
+#
+# Switching to connection 'deadlock_con1'.
+# Reaping INSERT.
+#
+# Switching to connection 'default'.
+# Reaping ALTER. It should succeed and not produce ER_LOCK_DEADLOCK.
+drop table t1;
+set debug_sync= 'RESET';
+#
# Test for bug #46748 "Assertion in MDL_context::wait_for_locks()
# on INSERT + CREATE TRIGGER".
#
@@ -2175,7 +2268,7 @@ alter table t1 add column e int, rename to t2;;
#
# Switching to connection 'default'.
set debug_sync='now WAIT_FOR alter_table_locked';
-set debug_sync='before_open_table_wait_refresh SIGNAL alter_go';
+set debug_sync='mdl_acquire_lock_wait SIGNAL alter_go';
# The below statement should get ER_LOCK_DEADLOCK error
# (i.e. it should not allow ALTER to proceed, and then
# fail due to 't1' changing its name to 't2').
@@ -2382,6 +2475,45 @@ commit;
set debug_sync= 'RESET';
drop table t1;
#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+# Ensure that a acquired lock is not given up due to a conflict.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+# Connection: con1
+SET debug_sync='lock_table_for_truncate SIGNAL parked_truncate WAIT_FOR go_truncate';
+TRUNCATE TABLE t1;
+# Connection: default
+SET debug_sync='now WAIT_FOR parked_truncate';
+# Connection: con2
+SET debug_sync='after_open_table_ignore_flush SIGNAL parked_show WAIT_FOR go_show';
+SHOW FIELDS FROM t1;
+# Connection: default
+SET debug_sync='now WAIT_FOR parked_show';
+# Connection: con3
+SET debug_sync='after_flush_unlock SIGNAL parked_flush WAIT_FOR go_flush';
+FLUSH TABLES t1;
+# Connection: default
+SET debug_sync='now WAIT_FOR parked_flush';
+SET debug_sync='now SIGNAL go_truncate';
+# Connection: con1
+# Reaping...
+# Connection: default
+SET debug_sync= 'now SIGNAL go_show';
+# Connection: con2 (SHOW FIELDS FROM t1)
+# Reaping...
+Field Type Null Key Default Extra
+a int(11) YES NULL
+# Connection: default
+SET debug_sync= 'now SIGNAL go_flush';
+# Connection: con3 (FLUSH TABLES t1)
+# Reaping...
+# Connection: default
+SET debug_sync= 'RESET';
+DROP TABLE t1;
+#
# Bug#52856 concurrent show columns or show full columns causes a crash!!!
#
CREATE TABLE t1(a CHAR(255));
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index e46d8e75ab1..87d4f75dc8d 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -1191,6 +1191,9 @@ SHOW CREATE TABLE t4;
ERROR HY000: Table 't4' was not locked with LOCK TABLES
INSERT INTO t4 VALUES (4);
ERROR HY000: Table 't4' was not locked with LOCK TABLES
+# Temporary tables can be created in spite of LOCK TABLES.
+# If the temporary MERGE table uses the locked children only,
+# 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
@@ -1672,6 +1675,7 @@ c1
33
DELETE FROM t4 WHERE c1 = 33;
DROP TRIGGER t3_ai;
+UNLOCK TABLES;
#
# Trigger with table use on child
DELETE FROM t4 WHERE c1 = 4;
@@ -1854,9 +1858,9 @@ ALTER TABLE t2 UNION=(t3,t1);
SELECT * FROM t2;
ERROR HY000: Table 't3' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, t2, t3;
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2);
+CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
+CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t3;
@@ -2635,6 +2639,17 @@ DROP TRIGGER t2_au;
DROP FUNCTION f1;
DROP TABLE tm1, t1, t2, t3, t4, t5;
#
+# Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
+#
+CREATE TEMPORARY TABLE t1 (c1 INT);
+ALTER TABLE t1 ENGINE=MERGE UNION(t_not_exists,t1);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize Error Table 'test.t_not_exists' doesn't exist
+test.t1 optimize Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+test.t1 optimize note The storage engine for the table doesn't support optimize
+DROP TABLE t1;
+#
# Bug47098 assert in MDL_context::destroy on HANDLER
# <damaged merge table> OPEN
#
@@ -2699,4 +2714,35 @@ LOCK TABLE m1 WRITE;
ALTER TABLE m1 ADD INDEX (c1);
UNLOCK TABLES;
DROP TABLE m1, t1;
+#
+# If children are to be altered, they need an explicit lock.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1);
+LOCK TABLE m1 WRITE;
+ALTER TABLE t1 ADD INDEX (c1);
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+LOCK TABLE m1 WRITE, t1 WRITE;
+ALTER TABLE t1 ADD INDEX (c1);
+UNLOCK TABLES;
+DROP TABLE m1, t1;
+#
+# Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter"
+#
+drop tables if exists t1, m1, m2;
+create table t1 (i int) engine=myisam;
+create table m1 (i int) engine=mrg_myisam union=(t1) insert_method=first;
+create table m2 like m1;
+# Table definitions should match
+show create table m1;
+Table Create Table
+m1 CREATE TABLE `m1` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`)
+show create table m2;
+Table Create Table
+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;
End of 6.0 tests
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 394beb042a5..58f6ffd4040 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -169,4 +169,46 @@ DROP PROCEDURE testproc;
WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary.
WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary.
WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary.
+#
+# Bug #53613: mysql_upgrade incorrectly revokes
+# TRIGGER privilege on given table
+#
+GRANT USAGE ON *.* TO 'user3'@'%';
+GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
+Run mysql_upgrade with all privileges on a user
+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
+SHOW GRANTS FOR 'user3'@'%';
+Grants for user3@%
+GRANT USAGE ON *.* TO 'user3'@'%'
+GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
+DROP USER 'user3'@'%';
+End of 5.1 tests
The --upgrade-system-tables option was used, databases won't be touched.
diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
index 5f1a25324ed..533f35c1113 100644
--- a/mysql-test/r/mysqld--help-notwin.result
+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -746,7 +746,7 @@ connect-timeout 10
console FALSE
date-format %Y-%m-%d
datetime-format %Y-%m-%d %H:%i:%s
-default-storage-engine MyISAM
+default-storage-engine InnoDB
default-time-zone (No default value)
default-week-format 0
delay-key-write ON
diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result
index 5d517f06add..9b6b0f53b01 100644
--- a/mysql-test/r/mysqld--help-win.result
+++ b/mysql-test/r/mysqld--help-win.result
@@ -750,7 +750,7 @@ connect-timeout 10
console FALSE
date-format %Y-%m-%d
datetime-format %Y-%m-%d %H:%i:%s
-default-storage-engine MyISAM
+default-storage-engine InnoDB
default-time-zone (No default value)
default-week-format 0
delay-key-write ON
diff --git a/mysql-test/r/parser_not_embedded.result b/mysql-test/r/parser_not_embedded.result
index 140b13c9864..5a5ae9f8178 100644
--- a/mysql-test/r/parser_not_embedded.result
+++ b/mysql-test/r/parser_not_embedded.result
@@ -47,3 +47,48 @@
+----------+--------+
| 4 | 4 |
+----------+--------+
+# Bug#46527 "COMMIT AND CHAIN RELEASE does not make sense"
+#
+COMMIT AND CHAIN RELEASE;
+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 'RELEASE' at line 1
+COMMIT AND NO CHAIN RELEASE;
+COMMIT RELEASE;
+COMMIT CHAIN RELEASE;
+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 'CHAIN RELEASE' at line 1
+COMMIT NO CHAIN RELEASE;
+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 'CHAIN RELEASE' at line 1
+COMMIT AND NO RELEASE;
+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 'RELEASE' at line 1
+COMMIT AND RELEASE;
+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 'RELEASE' at line 1
+COMMIT NO RELEASE;
+COMMIT CHAIN NO RELEASE;
+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 'CHAIN NO RELEASE' at line 1
+COMMIT NO CHAIN NO RELEASE;
+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 'CHAIN NO RELEASE' at line 1
+COMMIT AND RELEASE CHAIN;
+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 'RELEASE CHAIN' at line 1
+COMMIT AND NO CHAIN NO RELEASE;
+ROLLBACK AND CHAIN RELEASE;
+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 'RELEASE' at line 1
+ROLLBACK AND NO CHAIN RELEASE;
+ROLLBACK RELEASE;
+ROLLBACK CHAIN RELEASE;
+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 'CHAIN RELEASE' at line 1
+ROLLBACK NO CHAIN RELEASE;
+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 'CHAIN RELEASE' at line 1
+ROLLBACK AND NO RELEASE;
+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 'RELEASE' at line 1
+ROLLBACK AND RELEASE;
+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 'RELEASE' at line 1
+ROLLBACK NO RELEASE;
+ROLLBACK CHAIN NO RELEASE;
+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 'CHAIN NO RELEASE' at line 1
+ROLLBACK NO CHAIN NO RELEASE;
+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 'CHAIN NO RELEASE' at line 1
+ROLLBACK AND RELEASE CHAIN;
+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 'RELEASE CHAIN' at line 1
+ROLLBACK AND NO CHAIN NO RELEASE;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 2df8b19e00c..58d014938bf 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -266,12 +266,12 @@ engine = x
partition by key (a);
Warnings:
Warning 1286 Unknown storage engine 'x'
-Warning 1266 Using storage engine MyISAM for table 't1'
+Warning 1266 Using storage engine InnoDB for table 't1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
drop table t1;
create table t1 (a int)
@@ -373,3 +373,21 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
CREATE INDEX i1 ON t1 (a);
DROP TABLE t1;
+#
+# Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00')
+ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1;
+SET @old_mode = @@sql_mode;
+SET SESSION sql_mode = 'NO_ZERO_DATE';
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize error Invalid default value for 'b'
+test.t1 optimize status Operation failed
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Error 1067 Invalid default value for 'b'
+SET SESSION sql_mode = @old_mode;
+DROP TABLE t1;
diff --git a/mysql-test/r/partition_innodb_semi_consistent.result b/mysql-test/r/partition_innodb_semi_consistent.result
index 48a1bb3d258..1ff7ffba6db 100644
--- a/mysql-test/r/partition_innodb_semi_consistent.result
+++ b/mysql-test/r/partition_innodb_semi_consistent.result
@@ -18,6 +18,7 @@ set autocommit=0;
update t1 set a=10 where a=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
+commit;
set session transaction isolation level read committed;
update t1 set a=10 where a=5;
select * from t1 where a=2 for update;
@@ -64,6 +65,7 @@ a b
# Switch to connection con2
UPDATE t1 SET b = 21 WHERE a = 1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ROLLBACK;
# Switch to connection con1
SELECT * FROM t1;
a b
@@ -99,6 +101,7 @@ a b
SELECT * FROM t1;
a b
1 init+con1+con2
+COMMIT;
# Switch to connection con1
# 3. test for updated key column:
TRUNCATE t1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 16f6657ceeb..0e75ebd57ec 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -695,11 +695,11 @@ REPEATABLE-READ
set transaction isolation level read committed;
execute stmt;
@@tx_isolation
-READ-COMMITTED
+REPEATABLE-READ
set transaction isolation level serializable;
execute stmt;
@@tx_isolation
-SERIALIZABLE
+REPEATABLE-READ
set @@tx_isolation=default;
execute stmt;
@@tx_isolation
diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result
index 1257a668cce..edf05d0c5d3 100644
--- a/mysql-test/r/rename.result
+++ b/mysql-test/r/rename.result
@@ -55,14 +55,15 @@ t2
t4
drop table t2, t4;
End of 4.1 tests
+#
+# Bug#14959: "ALTER TABLE isn't able to rename a view"
+# Bug#53976: "ALTER TABLE RENAME is allowed on views
+# (not documented, broken)"
+#
create table t1(f1 int);
create view v1 as select * from t1;
alter table v1 rename to v2;
-alter table v1 rename to v2;
-ERROR 42S02: Table 'test.v1' doesn't exist
-rename table v2 to v1;
-rename table v2 to v1;
-ERROR 42S01: Table 'v1' already exists
+ERROR HY000: 'test.v1' is not BASE TABLE
drop view v1;
drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/rpl_mysqldump_slave.result b/mysql-test/r/rpl_mysqldump_slave.result
index 158a43a658c..2229725a61d 100644
--- a/mysql-test/r/rpl_mysqldump_slave.result
+++ b/mysql-test/r/rpl_mysqldump_slave.result
@@ -8,10 +8,10 @@ start slave;
# New --dump-slave, --apply-slave-statements functionality
#
use test;
-CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107;
+CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
STOP SLAVE;
-CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107;
+CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
START SLAVE;
STOP SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
START SLAVE;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index e594e87694f..b193a269288 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4856,4 +4856,38 @@ a b c
SELECT * FROM t1 WHERE 102 < c;
a b c
DROP TABLE t1;
+#
+# Bug #54459: Assertion failed: param.sort_length,
+# file .\filesort.cc, line 149 (part II)
+#
+CREATE TABLE t1(a ENUM('') NOT NULL);
+INSERT INTO t1 VALUES (), (), ();
+EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+1
+1
+1
+1
+DROP TABLE t1;
End of 5.1 tests
+#
+# Bug#54515: Crash in opt_range.cc::get_best_group_min_max on
+# SELECT from VIEW with GROUP BY
+#
+CREATE TABLE t1 (
+col_int_key int DEFAULT NULL,
+KEY int_key (col_int_key)
+) ;
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW view_t1 AS
+SELECT t1.col_int_key AS col_int_key
+FROM t1;
+SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
+col_int_key
+1
+2
+DROP VIEW view_t1;
+DROP TABLE t1;
+# End of test BUG#54515
diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result
new file mode 100644
index 00000000000..921d308097c
--- /dev/null
+++ b/mysql-test/r/single_delete_update.result
@@ -0,0 +1,1074 @@
+#
+# Bug #30584: delete with order by and limit clauses does not use
+# limit efficiently
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
+(20),(21),(22),(23),(24),(25);
+CREATE TABLE t2(a INT, i INT PRIMARY KEY);
+INSERT INTO t2 (i) SELECT i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+a i
+NULL 11
+NULL 12
+NULL 13
+NULL 14
+NULL 15
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+a i
+NULL 16
+NULL 17
+NULL 18
+DROP TABLE t2;
+#
+# index on field prefix:
+#
+CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1)));
+INSERT INTO t2 (i) SELECT i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+a i
+NULL 11
+NULL 12
+NULL 13
+NULL 14
+NULL 15
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 5
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
+FLUSH STATUS;
+DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 8
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 5
+Handler_read_rnd_next 17
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+a i
+NULL 16
+NULL 17
+NULL 18
+DROP TABLE t2;
+#
+# constant inside ORDER BY list, should use filesort
+# on a small table
+#
+CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
+INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+a b c d
+10 10 10 NULL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
+FLUSH STATUS;
+DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 1
+Handler_read_rnd_next 17
+## should be 5 (previous LIMIT)
+SELECT 1 - COUNT(*) FROM t2 WHERE b = 10;
+1 - COUNT(*)
+1
+DROP TABLE t2;
+#
+# same test as above (constant inside ORDER BY list), but with
+# a larger table - should not use filesort
+#
+CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
+INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
+INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+a b c d
+10 10 10 NULL
+10 10 10 NULL
+10 10 10 NULL
+10 10 10 NULL
+10 10 10 NULL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+## should be 5 (previous LIMIT)
+SELECT 257 - COUNT(*) FROM t2 WHERE b = 10;
+257 - COUNT(*)
+5
+DROP TABLE t2;
+#
+# as above + partial index, should use filesort
+#
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c));
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+a b c d
+10 10 10 10
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
+FLUSH STATUS;
+DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 1
+Handler_read_rnd_next 17
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
+a b c d
+DROP TABLE t2;
+#
+# as above but index is without HA_READ_ORDER flag, should use filesort
+#
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP;
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+a b c d
+10 10 10 10
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 1
+Handler_read_rnd_next 17
+FLUSH STATUS;
+DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 1
+Handler_read_rnd_next 17
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
+a b c d
+DROP TABLE t2;
+#
+# quick select is Index Merge, should use filesort
+#
+CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2));
+INSERT INTO t2 (key1, key2) SELECT i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+i key1 key2
+NULL 10 10
+NULL 11 11
+NULL 12 12
+NULL 13 13
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 1
+Sort_rows 4
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 2
+Handler_read_next 7
+Handler_read_prev 0
+Handler_read_rnd 4
+Handler_read_rnd_next 0
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort
+Warnings:
+x x x
+FLUSH STATUS;
+DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 1
+Sort_rows 4
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 2
+Handler_read_next 7
+Handler_read_prev 0
+Handler_read_rnd 8
+Handler_read_rnd_next 0
+SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+i key1 key2
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort
+Warnings:
+x x x
+DROP TABLE t2;
+#
+# reverse quick select, should not use filesort
+#
+CREATE TABLE t2(a INT, i INT PRIMARY KEY);
+INSERT INTO t2 (i) SELECT i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
+a i
+NULL 18
+NULL 17
+NULL 16
+NULL 15
+NULL 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 0
+Handler_read_prev 4
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 0
+Handler_read_prev 4
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+a i
+NULL 11
+NULL 12
+NULL 13
+DROP TABLE t2;
+#
+# mixed sorting direction, should use filesort
+#
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
+INSERT INTO t2 SELECT i, i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5;
+a b c
+10 10 10
+11 11 11
+12 12 12
+13 13 13
+14 14 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 5
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
+FLUSH STATUS;
+DELETE FROM t2 ORDER BY a, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 16
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 5
+Handler_read_rnd_next 17
+SELECT * FROM t2 ORDER BY a, b DESC;
+a b c
+15 15 15
+16 16 16
+17 17 17
+18 18 18
+19 19 19
+20 20 20
+21 21 21
+22 22 22
+23 23 23
+24 24 24
+25 25 25
+DROP TABLE t2;
+#
+# LIMIT with no WHERE and DESC direction, should not use filesort
+#
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
+INSERT INTO t2 (a, b) SELECT i, i FROM t1;
+INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2;
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a, b LIMIT 5;
+a b c
+10 10 NULL
+10 10 NULL
+10 10 NULL
+10 10 NULL
+10 10 NULL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
+a b c
+25 25 NULL
+25 25 NULL
+25 25 NULL
+25 25 NULL
+25 25 NULL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 4
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 4
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC;
+a b c
+DROP TABLE t1, t2;
+#
+# Bug #36569: UPDATE ... WHERE ... ORDER BY... always does a filesort
+# even if not required
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
+(20),(21),(22),(23),(24),(25);
+CREATE TABLE t2(a INT, i INT PRIMARY KEY);
+INSERT INTO t2 (i) SELECT i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+a i
+NULL 11
+NULL 12
+NULL 13
+NULL 14
+NULL 15
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 5
+Handler_read_rnd_next 0
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+a i
+10 11
+10 12
+10 13
+10 14
+10 15
+NULL 16
+NULL 17
+NULL 18
+DROP TABLE t2;
+#
+# index on field prefix:
+#
+CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1)));
+INSERT INTO t2 (i) SELECT i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+a i
+NULL 11
+NULL 12
+NULL 13
+NULL 14
+NULL 15
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 5
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
+FLUSH STATUS;
+UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 5
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 5
+Handler_read_rnd_next 17
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+a i
+10 11
+10 12
+10 13
+10 14
+10 15
+NULL 16
+NULL 17
+NULL 18
+DROP TABLE t2;
+#
+# constant inside ORDER BY list, should use filesort
+# on a small table
+#
+CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
+INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+a b c d
+10 10 10 NULL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
+FLUSH STATUS;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 1
+Handler_read_rnd_next 17
+## should be 5 (previous LIMIT)
+SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c;
+COUNT(*)
+1
+DROP TABLE t2;
+#
+# same test as above (constant inside ORDER BY list), but with
+# a larger table - should not use filesort
+#
+CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
+INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
+INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+a b c d
+10 10 10 NULL
+10 10 10 NULL
+10 10 10 NULL
+10 10 10 NULL
+10 10 10 NULL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 5
+Handler_read_rnd_next 0
+## should be 5 (previous LIMIT)
+SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c;
+COUNT(*)
+5
+DROP TABLE t2;
+#
+# as above + partial index, should use filesort
+#
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c));
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+a b c d
+10 10 10 10
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
+FLUSH STATUS;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 1
+Handler_read_rnd_next 17
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
+a b c d
+10 10 10 10
+DROP TABLE t2;
+#
+# as above but index is without HA_READ_ORDER flag, should use filesort
+#
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP;
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+a b c d
+10 10 10 10
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 1
+Handler_read_rnd_next 17
+FLUSH STATUS;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 1
+Handler_read_rnd_next 17
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
+a b c d
+10 10 10 10
+DROP TABLE t2;
+#
+# quick select is Index Merge, should use filesort
+#
+CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2));
+INSERT INTO t2 (key1, key2) SELECT i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+i key1 key2
+NULL 10 10
+NULL 11 11
+NULL 12 12
+NULL 13 13
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 1
+Sort_rows 4
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 2
+Handler_read_next 7
+Handler_read_prev 0
+Handler_read_rnd 4
+Handler_read_rnd_next 0
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort
+Warnings:
+x x x
+FLUSH STATUS;
+UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 1
+Sort_rows 4
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 2
+Handler_read_next 7
+Handler_read_prev 0
+Handler_read_rnd 8
+Handler_read_rnd_next 0
+SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+i key1 key2
+123 10 10
+123 11 11
+123 12 12
+123 13 13
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort
+Warnings:
+x x x
+DROP TABLE t2;
+#
+# reverse quick select, should not use filesort
+#
+CREATE TABLE t2(a INT, i INT PRIMARY KEY);
+INSERT INTO t2 (i) SELECT i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
+a i
+NULL 18
+NULL 17
+NULL 16
+NULL 15
+NULL 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 0
+Handler_read_prev 4
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 0
+Handler_read_prev 4
+Handler_read_rnd 5
+Handler_read_rnd_next 0
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+a i
+NULL 11
+NULL 12
+NULL 13
+10 14
+10 15
+10 16
+10 17
+10 18
+DROP TABLE t2;
+#
+# mixed sorting direction, should use filesort
+#
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
+INSERT INTO t2 SELECT i, i, i FROM t1;
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5;
+a b c
+10 10 10
+11 11 11
+12 12 12
+13 13 13
+14 14 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 5
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
+FLUSH STATUS;
+UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 5
+Sort_scan 1
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 5
+Handler_read_rnd_next 17
+SELECT * FROM t2 WHERE c = 10 ORDER BY a, b DESC;
+a b c
+10 10 10
+11 11 10
+12 12 10
+13 13 10
+14 14 10
+DROP TABLE t2;
+#
+# LIMIT with no WHERE and DESC direction, should not use filesort
+#
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
+INSERT INTO t2 (a, b) SELECT i, i FROM t1;
+INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2;
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a, b LIMIT 5;
+a b c
+10 10 NULL
+10 10 NULL
+10 10 NULL
+10 10 NULL
+10 10 NULL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_next 4
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
+a b c
+25 25 NULL
+25 25 NULL
+25 25 NULL
+25 25 NULL
+25 25 NULL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 4
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_range 0
+Sort_rows 0
+Sort_scan 0
+SHOW STATUS LIKE 'Handler_read_%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 4
+Handler_read_rnd 5
+Handler_read_rnd_next 0
+SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC;
+a b c
+25 25 10
+25 25 10
+25 25 10
+25 25 10
+25 25 10
+DROP TABLE t1, t2;
+#
+# Bug #53742: UPDATEs have no effect after applying patch for bug 36569
+#
+CREATE TABLE t1 (
+pk INT NOT NULL AUTO_INCREMENT,
+c1_idx CHAR(1) DEFAULT 'y',
+c2 INT,
+PRIMARY KEY (pk),
+INDEX c1_idx (c1_idx)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (), (), (), ();
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+pk c1_idx c2
+4 y NULL
+3 y NULL
+UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+pk c1_idx c2
+4 y 0
+3 y 0
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
+pk c1_idx c2
+4 y 0
+3 y 0
+2 y NULL
+1 y NULL
+DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
+pk c1_idx c2
+2 y NULL
+1 y NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/sp_sync.result b/mysql-test/r/sp_sync.result
index a16babaef67..174b3c60745 100644
--- a/mysql-test/r/sp_sync.result
+++ b/mysql-test/r/sp_sync.result
@@ -59,30 +59,31 @@ SET DEBUG_SYNC= 'RESET';
#
# Bug #48246 assert in close_thread_table
#
+CREATE TABLE t0 (b INTEGER);
CREATE TABLE t1 (a INTEGER);
CREATE FUNCTION f1(b INTEGER) RETURNS INTEGER RETURN 1;
-CREATE PROCEDURE p1() SELECT COUNT(f1(a)) FROM t1;
+CREATE PROCEDURE p1() SELECT COUNT(f1(a)) FROM t1, t0;
+INSERT INTO t0 VALUES(1);
INSERT INTO t1 VALUES(1), (2);
# Connection 2
CALL p1();
COUNT(f1(a))
2
-# Connection default
-SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR called';
-# Sending:
-CREATE TABLE t1 (a INTEGER);
-# Connection 2
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
-SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL called WAIT_FOR created';
-# This call used to cause an assertion. MDL locking conflict will
-# cause back-off and retry. A variable indicating if a prelocking list
-# exists, used to be not reset properly causing an eventual assert.
+SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked_t1 WAIT_FOR go_for_t0';
+# This call used to cause an assertion. MDL deadlock with upcoming
+# LOCK TABLES statement will cause back-off and retry.
+# A variable indicating if a prelocking list exists, used to be not
+# reset properly causing an eventual assert.
# Sending:
CALL p1();
# Connection default
-# Reaping: CREATE TABLE t1 (a INTEGER)
-ERROR 42S01: Table 't1' already exists
-SET DEBUG_SYNC= 'now SIGNAL created';
+SET DEBUG_SYNC= 'now WAIT_FOR locked_t1';
+# Issue LOCK TABLES statement which will enter in MDL deadlock
+# with CALL statement and as result will cause it to perform
+# back-off and retry.
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL go_for_t0';
+LOCK TABLES t0 WRITE, t1 WRITE;
+UNLOCK TABLES;
# Connection 2
# Reaping: CALL p1()
COUNT(f1(a))
@@ -90,5 +91,5 @@ COUNT(f1(a))
# Connection default
DROP PROCEDURE p1;
DROP FUNCTION f1;
-DROP TABLE t1;
+DROP TABLES t0, t1;
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result
index 34d24f70848..e3463dec571 100644
--- a/mysql-test/r/sp_trans_log.result
+++ b/mysql-test/r/sp_trans_log.result
@@ -14,7 +14,7 @@ end|
reset master|
insert into t2 values (bug23333(),1)|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-show binlog events from <binlog_start>|
+show binlog events from <binlog_start> limit 0, 4|
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index e3aa87876ed..72d63e47d9a 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4988,3 +4988,20 @@ t1_id total_amount
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug #52711: Segfault when doing EXPLAIN SELECT with
+# union...order by (select... where...)
+#
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+# Should not crash
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+# Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+End of 5.1 tests
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 482e0045840..dd4bf599ad0 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -59,3 +59,28 @@ FROM t3 WHERE 1 = 0 GROUP BY 1;
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
DROP TABLE t1,t2,t3;
End of 5.0 tests.
+#
+# Bug#53236 Segfault in DTCollation::set(DTCollation&)
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_varchar VARCHAR(1),
+PRIMARY KEY (pk)
+)
+;
+INSERT INTO t1 (col_varchar)
+VALUES
+('w'),
+('m')
+;
+SELECT table1.pk
+FROM ( t1 AS table1 JOIN t1 AS table2 ON (table1.col_varchar =
+table2.col_varchar) )
+WHERE ( 1, 2 ) IN ( SELECT SUBQUERY1_t1.pk AS SUBQUERY1_field1,
+SUBQUERY1_t1.pk AS SUBQUERY1_field2
+FROM ( t1 AS SUBQUERY1_t1 JOIN t1 AS SUBQUERY1_t2
+ON (SUBQUERY1_t2.col_varchar =
+SUBQUERY1_t1.col_varchar) ) )
+;
+pk
+drop table t1;
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index 8f237c81e75..773075f9dae 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -99,7 +99,7 @@ LOCK TABLE t1 WRITE;
SELECT * FROM v1;
ERROR HY000: Table 'v1' was not locked with LOCK TABLES
TRUNCATE v1;
-ERROR 42S02: Table 'test.v1' doesn't exist
+ERROR HY000: Table 'v1' was not locked with LOCK TABLES
SELECT * FROM v1;
ERROR HY000: Table 'v1' was not locked with LOCK TABLES
UNLOCK TABLES;
@@ -107,7 +107,7 @@ LOCK TABLE t1 WRITE, t2 WRITE;
SELECT * FROM v1;
ERROR HY000: Table 'v1' was not locked with LOCK TABLES
TRUNCATE v1;
-ERROR 42S02: Table 'test.v1' doesn't exist
+ERROR HY000: Table 'v1' was not locked with LOCK TABLES
SELECT * FROM v1;
ERROR HY000: Table 'v1' was not locked with LOCK TABLES
UNLOCK TABLES;
@@ -117,7 +117,7 @@ c1
1
3
TRUNCATE v1;
-ERROR 42S02: Table 'test.v1' doesn't exist
+ERROR HY000: Table 'v1' was not locked with LOCK TABLES
SELECT * FROM v1;
c1
1
@@ -129,7 +129,7 @@ c1
1
3
TRUNCATE v1;
-ERROR 42S02: Table 'test.v1' doesn't exist
+ERROR HY000: Table 'v1' was not locked with LOCK TABLES
SELECT * FROM v1;
c1
1
diff --git a/mysql-test/r/truncate_coverage.result b/mysql-test/r/truncate_coverage.result
index 7a5021f55e2..a7a4b9c70f4 100644
--- a/mysql-test/r/truncate_coverage.result
+++ b/mysql-test/r/truncate_coverage.result
@@ -18,13 +18,15 @@ TRUNCATE TABLE t1;
SET DEBUG_SYNC='now WAIT_FOR waiting';
KILL QUERY @id;
#
+# connection default
+ERROR 70100: Query execution was interrupted
+UNLOCK TABLES;
+#
# connection con1
# Release shared metadata lock by closing HANDLER.
HANDLER t1 CLOSE;
#
# connection default
-ERROR 70100: Query execution was interrupted
-UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
CREATE TABLE t1 (c1 INT);
@@ -64,10 +66,15 @@ TRUNCATE TABLE t1;
# connection con1
SET DEBUG_SYNC='now WAIT_FOR waiting';
KILL QUERY @id;
-COMMIT;
#
# connection default
ERROR 70100: Query execution was interrupted
+#
+# connection con1
+# Release SW lock by committing transaction.
+COMMIT;
+#
+# connection default
UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 006eaba4e69..05ab1b71018 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -306,8 +306,8 @@ Handler_read_first 0
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
-Handler_read_rnd 1
-Handler_read_rnd_next 9
+Handler_read_rnd 0
+Handler_read_rnd_next 0
alter table t1 disable keys;
flush status;
delete from t1 order by a limit 1;
@@ -527,3 +527,17 @@ ERROR HY000: You are using safe update mode and you tried to update a table with
SET SESSION sql_safe_updates = DEFAULT;
DROP TABLE t1;
DROP VIEW v1;
+#
+# Bug#54734 assert in Diagnostics_area::set_ok_status
+#
+DROP TABLE IF EXISTS t1, not_exists;
+DROP FUNCTION IF EXISTS f1;
+DROP VIEW IF EXISTS v1;
+CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk;
+CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists);
+CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13;
+UPDATE v1 SET pk = 7 WHERE pk > 0;
+ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DROP VIEW v1;
+DROP FUNCTION f1;
+DROP TABLE t1;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 95d2827c1a6..e1c1d6f4128 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3954,6 +3954,7 @@ drop procedure p;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT a FROM t1;
ALTER TABLE v1;
+ERROR HY000: 'test.v1' is not BASE TABLE
DROP VIEW v1;
DROP TABLE t1;
#
diff --git a/mysql-test/std_data/intersect-bug50389.tsv b/mysql-test/std_data/intersect-bug50389.tsv
new file mode 100644
index 00000000000..f84359603a8
--- /dev/null
+++ b/mysql-test/std_data/intersect-bug50389.tsv
@@ -0,0 +1,441 @@
+3304605 1221256 0 0 abcdefghijklmnopwrst
+3304606 1221259 0 0 abcdefghijklmnopwrst
+3304607 1221260 0 0 asdfghjklzxcvbnm
+3304629 1221273 0 0 asdfghjklzxcvbnm
+3304630 1221273 0 0 asdfghjklzxcvbnm
+3304634 1221259 0 0 asdfghjklzxcvbnm
+3304644 1221278 0 0 abcdefghijklmnopwrst
+3304648 1221278 0 0 abcdefghijklmnopwrst
+3304649 1221278 0 1 asdfghjklzxcvbnm
+3304650 1221278 0 0 asdfghjklzxcvbnm
+3304651 1221282 0 0 abcdefghijklmnopwrst
+3304660 1221287 0 0 asdfghjklzxcvbnm
+3304662 1221288 0 0 abcdefghijklmnopwrst
+3304663 1221288 0 0 abcdefghijklmnopwrst
+3304664 1221290 0 0 abcdefghijklmnopwrst
+3304670 1221290 0 0 asdfghjklzxcvbnm
+3304671 1221292 0 0 abcdefghijklmnopwrst
+3304672 1221287 0 0 asdfghjklzxcvbnm
+3304673 1221294 0 0 asdfghjklzxcvbnm
+3304674 1221287 0 0 asdfghjklzxcvbnm
+3304676 1221296 0 0 abcdefghijklmnopwrst
+3304677 1221287 0 0 abcdefghijklmnopwrst
+3304678 1221287 0 0 abcdefghijklmnopwrst
+3304679 1221297 0 0 asdfghjklzxcvbnm
+3304680 1221290 0 0 abcdefghijklmnopwrst
+3304681 1221290 0 0 abcdefghijklmnopwrst
+3304685 1221300 0 0 asdfghjklzxcvbnm
+3304687 1221302 0 0 abcdefghijklmnopwrst
+3304688 1221296 1221298 0 abcdefghijklmnopwrst
+3304692 1221309 0 0 asdfghjklzxcvbnm
+3304694 1221309 0 0 asdfghjklzxcvbnm
+3304695 1221290 0 0 abcdefghijklmnopwrst
+3304696 1221313 0 0 asdfghjklzxcvbnm
+3304701 1221314 0 0 asdfghjklzxcvbnm
+3304703 1221313 0 0 abcdefghijklmnopwrst
+3304707 1221313 0 0 asdfghjklzxcvbnm
+3304709 1221313 0 0 abcdefghijklmnopwrst
+3304713 1221314 0 0 abcdefghijklmnopwrst
+3304715 1221317 0 0 abcdefghijklmnopwrst
+3304717 1221319 0 0 asdfghjklzxcvbnm
+3304718 1221320 0 0 abcdefghijklmnopwrst
+3304723 1221314 0 0 abcdefghijklmnopwrst
+3304724 1221314 0 0 asdfghjklzxcvbnm
+3304725 1221300 0 0 asdfghjklzxcvbnm
+3304726 1221314 0 0 asdfghjklzxcvbnm
+3304730 1221326 0 0 asdfghjklzxcvbnm
+3304732 1221328 0 0 asdfghjklzxcvbnm
+3304733 1221329 0 0 asdfghjklzxcvbnm
+3304745 1221331 0 0 abcdefghijklmnopwrst
+3304747 1221300 0 0 abcdefghijklmnopwrst
+3304752 1221332 0 0 asdfghjklzxcvbnm
+3304756 1221333 0 0 asdfghjklzxcvbnm
+3304765 1221336 0 0 asdfghjklzxcvbnm
+3304767 1221338 0 0 abcdefghijklmnopwrst
+3304769 1221340 0 0 asdfghjklzxcvbnm
+3304770 1221328 0 0 asdfghjklzxcvbnm
+3304771 1221328 0 0 abcdefghijklmnopwrst
+3304773 1221340 0 0 asdfghjklzxcvbnm
+3304774 1221340 0 0 abcdefghijklmnopwrst
+3304775 1221338 1221342 1 asdfghjklzxcvbnm
+3304778 1221345 0 0 asdfghjklzxcvbnm
+3304786 1221332 0 0 asdfghjklzxcvbnm
+3304787 1221347 0 0 abcdefghijklmnopwrst
+3304789 1221347 0 0 asdfghjklzxcvbnm
+3304793 1221349 0 0 abcdefghijklmnopwrst
+3304794 1221350 0 0 asdfghjklzxcvbnm
+3304800 1221290 0 0 asdfghjklzxcvbnm
+3304802 1221290 0 0 asdfghjklzxcvbnm
+3304803 1221290 0 0 asdfghjklzxcvbnm
+3304810 1221356 0 0 asdfghjklzxcvbnm
+3304811 1221356 0 0 asdfghjklzxcvbnm
+3304821 1221364 0 0 asdfghjklzxcvbnm
+3304823 1221365 0 0 asdfghjklzxcvbnm
+3304824 1221366 0 0 abcdefghijklmnopwrst
+3304825 1221365 0 0 asdfghjklzxcvbnm
+3304826 1221367 0 0 asdfghjklzxcvbnm
+3304828 1221369 0 0 abcdefghijklmnopwrst
+3304829 1221366 1221368 0 asdfghjklzxcvbnm
+3304831 1221372 0 0 abcdefghijklmnopwrst
+3304832 1221364 1221373 0 abcdefghijklmnopwrst
+3304833 1221364 1221371 0 asdfghjklzxcvbnm
+3304834 1221364 0 0 abcdefghijklmnopwrst
+3304836 1221375 0 0 abcdefghijklmnopwrst
+3304837 1221364 0 0 abcdefghijklmnopwrst
+3304838 1221364 1221376 0 asdfghjklzxcvbnm
+3304840 1221372 0 0 asdfghjklzxcvbnm
+3304842 1221372 0 1 abcdefghijklmnopwrst
+3304844 1221372 0 0 asdfghjklzxcvbnm
+3304845 1221372 0 0 abcdefghijklmnopwrst
+3304847 1221382 0 0 abcdefghijklmnopwrst
+3304848 1221372 0 0 abcdefghijklmnopwrst
+3304849 1221372 0 0 asdfghjklzxcvbnm
+3304852 1221364 1221378 0 asdfghjklzxcvbnm
+3304853 1221383 0 0 abcdefghijklmnopwrst
+3304854 1221384 0 0 asdfghjklzxcvbnm
+3304855 1221347 0 0 asdfghjklzxcvbnm
+3304858 1221383 0 0 abcdefghijklmnopwrst
+3304862 1221386 0 0 abcdefghijklmnopwrst
+3304864 1221387 0 0 abcdefghijklmnopwrst
+3304867 1221389 0 0 abcdefghijklmnopwrst
+3304868 1221390 0 0 asdfghjklzxcvbnm
+3304869 1221391 0 0 asdfghjklzxcvbnm
+3304871 1221393 0 0 asdfghjklzxcvbnm
+3304874 1221395 0 0 abcdefghijklmnopwrst
+3304877 1221396 0 0 abcdefghijklmnopwrst
+3304879 1221396 0 0 asdfghjklzxcvbnm
+3304882 1221398 0 0 abcdefghijklmnopwrst
+3304883 1221399 0 0 abcdefghijklmnopwrst
+3304884 1221400 0 0 abcdefghijklmnopwrst
+3304889 1221405 0 0 abcdefghijklmnopwrst
+3304895 1221409 0 0 asdfghjklzxcvbnm
+3304899 1221395 0 0 asdfghjklzxcvbnm
+3304900 1221395 0 0 asdfghjklzxcvbnm
+3304902 1221395 0 0 abcdefghijklmnopwrst
+3304903 1221395 0 0 asdfghjklzxcvbnm
+3304924 1221414 0 0 abcdefghijklmnopwrst
+3304925 1221415 0 0 asdfghjklzxcvbnm
+3304935 1221416 0 0 asdfghjklzxcvbnm
+3304936 1221418 0 0 asdfghjklzxcvbnm
+3304944 1221419 0 0 abcdefghijklmnopwrst
+3304959 1221427 0 0 asdfghjklzxcvbnm
+3304963 1221415 0 0 asdfghjklzxcvbnm
+3304964 1221428 0 0 asdfghjklzxcvbnm
+3304965 1221429 0 0 abcdefghijklmnopwrst
+3304978 1221433 0 0 abcdefghijklmnopwrst
+3304986 1221437 0 0 asdfghjklzxcvbnm
+3304988 1221439 0 0 asdfghjklzxcvbnm
+3304994 1221441 0 0 asdfghjklzxcvbnm
+3304996 1221442 0 0 asdfghjklzxcvbnm
+3304998 1221443 0 0 asdfghjklzxcvbnm
+3305003 1221446 0 0 abcdefghijklmnopwrst
+3305008 1221433 0 0 abcdefghijklmnopwrst
+3305009 1221447 0 0 asdfghjklzxcvbnm
+3305012 1221447 0 0 asdfghjklzxcvbnm
+3305013 1221449 0 0 abcdefghijklmnopwrst
+3305015 1221451 0 0 asdfghjklzxcvbnm
+3305019 1221453 0 0 asdfghjklzxcvbnm
+3305023 1221449 0 0 asdfghjklzxcvbnm
+3305026 1221456 0 0 abcdefghijklmnopwrst
+3305028 1221457 0 0 asdfghjklzxcvbnm
+3305032 1221449 0 0 asdfghjklzxcvbnm
+3305037 1221453 0 0 asdfghjklzxcvbnm
+3305040 1221451 0 0 asdfghjklzxcvbnm
+3305061 1221446 0 0 abcdefghijklmnopwrst
+3305175 1221457 0 0 abcdefghijklmnopwrst
+3305304 1221453 0 0 abcdefghijklmnopwrst
+3305308 1221453 0 1 abcdefghijklmnopwrst
+3305333 1221457 1221577 0 asdfghjklzxcvbnm
+3305335 1221453 0 0 asdfghjklzxcvbnm
+3305354 1221457 0 1 asdfghjklzxcvbnm
+3306089 1221442 0 0 abcdefghijklmnopwrst
+3306090 1221442 0 0 abcdefghijklmnopwrst
+3306092 1221442 0 0 asdfghjklzxcvbnm
+3306345 1221366 0 0 asdfghjklzxcvbnm
+3306349 1221366 0 0 asdfghjklzxcvbnm
+3306419 1221364 1221371 0 asdfghjklzxcvbnm
+3307390 1221453 0 0 abcdefghijklmnopwrst
+3308002 1221416 1221417 0 abcdefghijklmnopwrst
+3308331 1221366 1222821 0 abcdefghijklmnopwrst
+3309991 1221347 0 0 asdfghjklzxcvbnm
+3311917 1221287 0 0 abcdefghijklmnopwrst
+3311937 1221287 0 0 abcdefghijklmnopwrst
+3311945 1221287 0 0 asdfghjklzxcvbnm
+3311955 1221287 0 0 abcdefghijklmnopwrst
+3311961 1221287 0 0 asdfghjklzxcvbnm
+3311963 1221287 0 1 asdfghjklzxcvbnm
+3311968 1221287 0 0 asdfghjklzxcvbnm
+3311974 1221287 0 1 abcdefghijklmnopwrst
+3311976 1221287 0 1 abcdefghijklmnopwrst
+3311981 1221287 0 1 abcdefghijklmnopwrst
+3311985 1221287 0 1 asdfghjklzxcvbnm
+3312014 1221287 0 0 abcdefghijklmnopwrst
+3312018 1221287 0 1 abcdefghijklmnopwrst
+3312025 1221287 0 0 abcdefghijklmnopwrst
+3312027 1221287 0 0 abcdefghijklmnopwrst
+3312030 1221287 0 0 abcdefghijklmnopwrst
+3313755 1221288 0 0 abcdefghijklmnopwrst
+3313767 1221288 0 0 asdfghjklzxcvbnm
+3314668 1221290 0 0 asdfghjklzxcvbnm
+3314670 1221290 0 0 abcdefghijklmnopwrst
+3323440 1221338 0 0 abcdefghijklmnopwrst
+3323736 1221338 0 0 asdfghjklzxcvbnm
+3323739 1221338 0 0 asdfghjklzxcvbnm
+3324077 1221290 0 0 asdfghjklzxcvbnm
+3324081 1221290 0 0 abcdefghijklmnopwrst
+3324082 1221290 0 0 abcdefghijklmnopwrst
+3324639 1221457 1221563 1 asdfghjklzxcvbnm
+3326180 1221287 0 0 abcdefghijklmnopwrst
+3326204 1221287 0 0 asdfghjklzxcvbnm
+3326945 1221457 1221563 1 asdfghjklzxcvbnm
+3328393 1221364 1221373 0 asdfghjklzxcvbnm
+3328966 1221287 0 0 abcdefghijklmnopwrst
+3329875 1221457 1382427 0 abcdefghijklmnopwrst
+3333449 1221278 1231113 0 abcdefghijklmnopwrst
+3336022 1221457 0 0 abcdefghijklmnopwrst
+3340069 1221364 1221373 0 abcdefghijklmnopwrst
+3340073 1221364 1221373 0 abcdefghijklmnopwrst
+3340563 1221290 0 0 asdfghjklzxcvbnm
+3341553 1221453 0 0 abcdefghijklmnopwrst
+3345868 1221287 0 0 asdfghjklzxcvbnm
+3345873 1221287 0 0 abcdefghijklmnopwrst
+3345879 1221287 0 0 asdfghjklzxcvbnm
+3346860 1221457 0 0 abcdefghijklmnopwrst
+3347053 1221287 0 0 asdfghjklzxcvbnm
+3347109 1221287 0 1 abcdefghijklmnopwrst
+3350589 1221372 1236415 0 abcdefghijklmnopwrst
+3350594 1221372 1236415 1 asdfghjklzxcvbnm
+3353871 1221457 0 0 asdfghjklzxcvbnm
+3354727 1221364 1221373 0 abcdefghijklmnopwrst
+3355270 1221393 0 1 abcdefghijklmnopwrst
+3357638 1221287 0 0 asdfghjklzxcvbnm
+3357644 1221287 0 0 abcdefghijklmnopwrst
+3357648 1221287 0 0 abcdefghijklmnopwrst
+3357651 1221287 0 0 asdfghjklzxcvbnm
+3357661 1221287 0 0 abcdefghijklmnopwrst
+3357678 1221287 0 0 abcdefghijklmnopwrst
+3357697 1221287 0 0 asdfghjklzxcvbnm
+3357737 1221287 0 0 asdfghjklzxcvbnm
+3357744 1221287 0 0 abcdefghijklmnopwrst
+3357754 1221287 0 1 asdfghjklzxcvbnm
+3357760 1221287 0 1 abcdefghijklmnopwrst
+3357774 1221287 0 1 abcdefghijklmnopwrst
+3357779 1221287 0 0 abcdefghijklmnopwrst
+3357796 1221287 0 0 asdfghjklzxcvbnm
+3357814 1221287 0 0 asdfghjklzxcvbnm
+3357833 1221287 0 1 asdfghjklzxcvbnm
+3357835 1221287 0 0 abcdefghijklmnopwrst
+3357840 1221287 0 1 asdfghjklzxcvbnm
+3357842 1221287 0 0 abcdefghijklmnopwrst
+3357845 1221287 0 1 abcdefghijklmnopwrst
+3357849 1221287 0 1 abcdefghijklmnopwrst
+3357852 1221287 0 0 abcdefghijklmnopwrst
+3358935 1221443 0 1 abcdefghijklmnopwrst
+3358967 1221443 0 1 abcdefghijklmnopwrst
+3359181 1221256 0 0 abcdefghijklmnopwrst
+3360512 1221319 0 0 asdfghjklzxcvbnm
+3362004 1221287 0 0 abcdefghijklmnopwrst
+3362009 1221287 0 1 abcdefghijklmnopwrst
+3362358 1221287 0 0 asdfghjklzxcvbnm
+3363214 1221287 0 0 abcdefghijklmnopwrst
+3363238 1221287 0 1 asdfghjklzxcvbnm
+3363616 1221287 0 1 asdfghjklzxcvbnm
+3363631 1221287 0 0 asdfghjklzxcvbnm
+3364281 1221287 0 0 abcdefghijklmnopwrst
+3365900 1221347 0 0 asdfghjklzxcvbnm
+3365901 1221347 0 0 asdfghjklzxcvbnm
+3365906 1221347 0 0 asdfghjklzxcvbnm
+3365907 1221347 0 0 asdfghjklzxcvbnm
+3365910 1221347 0 0 abcdefghijklmnopwrst
+3365936 1221347 0 0 abcdefghijklmnopwrst
+3367846 1221287 0 0 abcdefghijklmnopwrst
+3368011 1221428 0 0 abcdefghijklmnopwrst
+3369882 1221300 0 0 asdfghjklzxcvbnm
+3370856 1221443 0 0 asdfghjklzxcvbnm
+3370861 1221443 1221445 0 abcdefghijklmnopwrst
+3375327 1221443 0 0 abcdefghijklmnopwrst
+3375333 1221443 1221445 0 abcdefghijklmnopwrst
+3376219 1221453 0 1 abcdefghijklmnopwrst
+3376228 1221453 0 0 abcdefghijklmnopwrst
+3376238 1221453 0 0 asdfghjklzxcvbnm
+3376243 1221453 0 0 abcdefghijklmnopwrst
+3376248 1221453 0 1 abcdefghijklmnopwrst
+3376254 1221453 0 0 abcdefghijklmnopwrst
+3376263 1221453 0 0 abcdefghijklmnopwrst
+3376272 1221453 0 1 asdfghjklzxcvbnm
+3376281 1221453 0 0 asdfghjklzxcvbnm
+3376290 1221453 0 0 abcdefghijklmnopwrst
+3376296 1221453 0 1 abcdefghijklmnopwrst
+3376301 1221453 0 0 asdfghjklzxcvbnm
+3376350 1221453 0 0 asdfghjklzxcvbnm
+3379002 1221453 0 0 abcdefghijklmnopwrst
+3379015 1221453 0 0 asdfghjklzxcvbnm
+3379025 1221453 0 0 abcdefghijklmnopwrst
+3379032 1221453 0 0 asdfghjklzxcvbnm
+3380181 1221372 1245650 0 asdfghjklzxcvbnm
+3380186 1221372 1245650 0 abcdefghijklmnopwrst
+3380190 1221372 1245650 0 asdfghjklzxcvbnm
+3380195 1221372 1245650 0 abcdefghijklmnopwrst
+3380202 1221372 1245650 0 asdfghjklzxcvbnm
+3380683 1221287 0 0 asdfghjklzxcvbnm
+3382317 1221453 0 0 abcdefghijklmnopwrst
+3382417 1221287 0 0 asdfghjklzxcvbnm
+3383523 1221338 0 1 abcdefghijklmnopwrst
+3387213 1221287 0 0 abcdefghijklmnopwrst
+3388139 1221453 0 0 asdfghjklzxcvbnm
+3398039 1221443 1251164 0 abcdefghijklmnopwrst
+3401835 1221453 0 0 asdfghjklzxcvbnm
+3412582 1221443 1255886 0 asdfghjklzxcvbnm
+3412583 1221443 1255886 0 asdfghjklzxcvbnm
+3413795 1221443 1255886 0 asdfghjklzxcvbnm
+3413813 1221443 1256258 0 asdfghjklzxcvbnm
+3420306 1221453 0 0 asdfghjklzxcvbnm
+3420354 1221453 0 0 asdfghjklzxcvbnm
+3425653 1221443 0 0 abcdefghijklmnopwrst
+3425658 1221443 0 0 asdfghjklzxcvbnm
+3431409 1221453 0 0 asdfghjklzxcvbnm
+3432510 1221443 1262320 0 asdfghjklzxcvbnm
+3432513 1221443 1262320 0 asdfghjklzxcvbnm
+3444444 1221443 1262320 0 abcdefghijklmnopwrst
+3445447 1221287 0 1 asdfghjklzxcvbnm
+3448662 1221338 0 0 asdfghjklzxcvbnm
+3450032 1221347 0 0 abcdefghijklmnopwrst
+3450259 1221453 0 0 abcdefghijklmnopwrst
+3452176 1221453 0 0 asdfghjklzxcvbnm
+3459239 1221347 0 0 asdfghjklzxcvbnm
+3463196 1221347 0 0 abcdefghijklmnopwrst
+3468759 1221453 0 0 abcdefghijklmnopwrst
+3470988 1221457 0 0 asdfghjklzxcvbnm
+3477116 1221287 0 0 asdfghjklzxcvbnm
+3477639 1221372 1277136 0 abcdefghijklmnopwrst
+3477656 1221372 1277136 0 asdfghjklzxcvbnm
+3488071 1221256 1238964 0 abcdefghijklmnopwrst
+3488079 1221256 0 0 asdfghjklzxcvbnm
+3488108 1221256 0 1 asdfghjklzxcvbnm
+3507126 1221287 0 1 asdfghjklzxcvbnm
+3511898 1221347 0 0 asdfghjklzxcvbnm
+3521780 1221453 0 0 abcdefghijklmnopwrst
+3536908 1221287 0 0 abcdefghijklmnopwrst
+3544231 1221329 0 1 asdfghjklzxcvbnm
+3545379 1221329 1298955 0 abcdefghijklmnopwrst
+3545384 1221329 1298955 0 abcdefghijklmnopwrst
+3545387 1221329 1298955 0 abcdefghijklmnopwrst
+3545389 1221329 1298955 1 abcdefghijklmnopwrst
+3545398 1221329 1298955 1 abcdefghijklmnopwrst
+3555715 1221287 0 0 asdfghjklzxcvbnm
+3563557 1221329 1298955 0 abcdefghijklmnopwrst
+3564322 1221338 0 0 asdfghjklzxcvbnm
+3565475 1221453 0 0 abcdefghijklmnopwrst
+3577588 1221287 0 0 asdfghjklzxcvbnm
+3600047 1221453 0 0 abcdefghijklmnopwrst
+3600062 1221453 0 0 asdfghjklzxcvbnm
+3600071 1221453 0 0 abcdefghijklmnopwrst
+3600080 1221453 0 1 abcdefghijklmnopwrst
+3600086 1221453 0 0 asdfghjklzxcvbnm
+3600091 1221453 0 1 abcdefghijklmnopwrst
+3600097 1221453 0 0 asdfghjklzxcvbnm
+3600103 1221453 0 0 asdfghjklzxcvbnm
+3600106 1221453 0 0 abcdefghijklmnopwrst
+3600113 1221453 0 0 abcdefghijklmnopwrst
+3600119 1221453 0 0 asdfghjklzxcvbnm
+3600124 1221453 0 0 abcdefghijklmnopwrst
+3600144 1221453 0 0 asdfghjklzxcvbnm
+3600152 1221453 0 0 asdfghjklzxcvbnm
+3600165 1221453 0 0 asdfghjklzxcvbnm
+3610561 1221287 0 0 abcdefghijklmnopwrst
+3617030 1221329 0 0 asdfghjklzxcvbnm
+3628347 1221443 1327098 0 abcdefghijklmnopwrst
+3628348 1221443 1327098 0 abcdefghijklmnopwrst
+3628646 1221443 0 0 asdfghjklzxcvbnm
+3633673 1221372 1328838 0 abcdefghijklmnopwrst
+3648489 1221443 0 0 asdfghjklzxcvbnm
+3648490 1221443 0 0 asdfghjklzxcvbnm
+3648534 1221443 1333827 0 asdfghjklzxcvbnm
+3653046 1221329 1298955 0 asdfghjklzxcvbnm
+3662680 1221287 0 0 asdfghjklzxcvbnm
+3699529 1221288 0 0 asdfghjklzxcvbnm
+3706659 1221453 0 0 asdfghjklzxcvbnm
+3723399 1221287 0 1 asdfghjklzxcvbnm
+3749934 1221278 0 0 abcdefghijklmnopwrst
+3761370 1221443 1371176 0 asdfghjklzxcvbnm
+3765884 1221443 1333827 0 abcdefghijklmnopwrst
+3772880 1221457 0 0 abcdefghijklmnopwrst
+3779574 1221457 1372998 1 abcdefghijklmnopwrst
+3784656 1221457 1372998 1 abcdefghijklmnopwrst
+3784700 1221457 1372998 1 abcdefghijklmnopwrst
+3784744 1221457 1382427 0 abcdefghijklmnopwrst
+3796187 1221457 1382427 1 abcdefghijklmnopwrst
+3796193 1221457 0 0 abcdefghijklmnopwrst
+3817277 1221457 1382427 0 asdfghjklzxcvbnm
+3828282 1221457 0 0 abcdefghijklmnopwrst
+3828297 1221457 0 0 abcdefghijklmnopwrst
+3828300 1221457 0 0 abcdefghijklmnopwrst
+3833022 1221287 0 0 asdfghjklzxcvbnm
+3856380 1221457 1395359 0 asdfghjklzxcvbnm
+3856391 1221457 0 0 asdfghjklzxcvbnm
+3861413 1221256 0 0 abcdefghijklmnopwrst
+3864734 1221393 0 1 abcdefghijklmnopwrst
+3868051 1221329 0 0 abcdefghijklmnopwrst
+3868059 1221329 0 0 abcdefghijklmnopwrst
+3869088 1221329 0 0 abcdefghijklmnopwrst
+3878669 1221329 1298955 0 asdfghjklzxcvbnm
+3878684 1221329 1298955 0 asdfghjklzxcvbnm
+3881785 1221287 0 0 abcdefghijklmnopwrst
+3882333 1221287 0 0 asdfghjklzxcvbnm
+3882389 1221287 0 0 abcdefghijklmnopwrst
+3908680 1221372 1245650 0 asdfghjklzxcvbnm
+3908690 1221372 1245650 0 asdfghjklzxcvbnm
+3908697 1221372 1245650 0 abcdefghijklmnopwrst
+3911434 1221453 0 0 abcdefghijklmnopwrst
+3911446 1221453 0 0 asdfghjklzxcvbnm
+3911448 1221453 0 0 abcdefghijklmnopwrst
+3911489 1221453 0 0 abcdefghijklmnopwrst
+3917384 1221453 0 0 abcdefghijklmnopwrst
+3939602 1221457 0 1 asdfghjklzxcvbnm
+3962210 1221453 0 0 asdfghjklzxcvbnm
+3963734 1221457 0 0 asdfghjklzxcvbnm
+3977364 1221287 0 0 asdfghjklzxcvbnm
+3981725 1221453 0 0 abcdefghijklmnopwrst
+4042952 1221453 0 0 abcdefghijklmnopwrst
+4042953 1221453 0 0 abcdefghijklmnopwrst
+4042958 1221453 0 0 abcdefghijklmnopwrst
+4042960 1221453 0 1 abcdefghijklmnopwrst
+4042965 1221453 0 0 asdfghjklzxcvbnm
+4066893 1221453 0 1 abcdefghijklmnopwrst
+4066896 1221453 0 0 abcdefghijklmnopwrst
+4066900 1221453 0 0 abcdefghijklmnopwrst
+4066908 1221453 0 0 abcdefghijklmnopwrst
+4066912 1221453 0 0 asdfghjklzxcvbnm
+4066915 1221453 0 0 asdfghjklzxcvbnm
+4066919 1221453 0 0 abcdefghijklmnopwrst
+4066924 1221453 0 0 asdfghjklzxcvbnm
+4066929 1221453 0 0 abcdefghijklmnopwrst
+4066934 1221453 0 0 asdfghjklzxcvbnm
+4066941 1221453 0 0 abcdefghijklmnopwrst
+4066946 1221453 0 0 asdfghjklzxcvbnm
+4066955 1221453 0 0 abcdefghijklmnopwrst
+4116291 1221433 1487238 0 asdfghjklzxcvbnm
+4116295 1221433 1487238 0 abcdefghijklmnopwrst
+4116450 1221433 1487238 0 abcdefghijklmnopwrst
+4121149 1221287 0 0 asdfghjklzxcvbnm
+4137325 1221453 0 0 abcdefghijklmnopwrst
+4149051 1221287 0 0 abcdefghijklmnopwrst
+4162347 1221287 0 0 abcdefghijklmnopwrst
+4164485 1221457 0 1 asdfghjklzxcvbnm
+4174706 1221457 0 0 abcdefghijklmnopwrst
+4178645 1221457 0 0 abcdefghijklmnopwrst
+4180122 1221457 1382427 0 asdfghjklzxcvbnm
+4180925 1221457 1382427 0 asdfghjklzxcvbnm
+4186417 1221457 0 0 abcdefghijklmnopwrst
+4189624 1221457 0 1 asdfghjklzxcvbnm
+4203132 1221453 0 0 asdfghjklzxcvbnm
+4228206 1221457 0 0 abcdefghijklmnopwrst
+4278829 1221453 0 0 abcdefghijklmnopwrst
+4326422 1221453 0 0 abcdefghijklmnopwrst
+4337061 1221287 0 0 abcdefghijklmnopwrst
+4379354 1221287 0 0 abcdefghijklmnopwrst
+4404901 1221457 0 0 abcdefghijklmnopwrst
+4494153 1221457 0 0 abcdefghijklmnopwrst
+4535721 1221287 0 0 asdfghjklzxcvbnm
+4559596 1221457 0 0 abcdefghijklmnopwrst
+4617751 1221393 0 0 abcdefghijklmnopwrst
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result
index 58c444c9571..7fb5e50a219 100644
--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
@@ -91,3 +91,14 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
';
ERROR HY000: master may suffer from http://bugs.mysql.com/bug.php?id=37426 so slave stops; check error log on slave for more info
drop table t1, char63_utf8, char128_utf8;
+#
+# Bug #54393: crash and/or valgrind errors in
+# mysql_client_binlog_statement
+#
+BINLOG '';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
+BINLOG '123';
+BINLOG '-2079193929';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
+BINLOG 'xç↓%~∙D╒ƒ╡';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result
index 5f90dd5d3dd..dc170361026 100644
--- a/mysql-test/suite/binlog/r/binlog_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_innodb.result
@@ -2,65 +2,65 @@ SET BINLOG_FORMAT=MIXED;
RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
UPDATE t1 SET b = 2*a WHERE a > 1;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
UPDATE t1 SET b = a * a WHERE a > 3;
COMMIT;
SET BINLOG_FORMAT=STATEMENT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
UPDATE t1 SET b = 1*a WHERE a > 1;
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
UPDATE t1 SET b = 2*a WHERE a > 2;
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
UPDATE t1 SET b = 3*a WHERE a > 3;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+BEGIN;
UPDATE t1 SET b = 4*a WHERE a > 4;
COMMIT;
SET BINLOG_FORMAT=MIXED;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
UPDATE t1 SET b = 1*a WHERE a > 1;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
UPDATE t1 SET b = 2*a WHERE a > 2;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
UPDATE t1 SET b = 3*a WHERE a > 3;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+BEGIN;
UPDATE t1 SET b = 4*a WHERE a > 4;
COMMIT;
SET BINLOG_FORMAT=ROW;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
UPDATE t1 SET b = 1*a WHERE a > 1;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
UPDATE t1 SET b = 2*a WHERE a > 2;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
UPDATE t1 SET b = 3*a WHERE a > 3;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+BEGIN;
UPDATE t1 SET b = 4*a WHERE a > 4;
COMMIT;
show binlog events from <binlog_start>;
diff --git a/mysql-test/suite/binlog/r/binlog_multi_engine.result b/mysql-test/suite/binlog/r/binlog_multi_engine.result
index b0ec756b651..d0febc3f8bc 100644
--- a/mysql-test/suite/binlog/r/binlog_multi_engine.result
+++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result
@@ -7,8 +7,6 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
The last event before the COMMIT is use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
*** Please look in binlog_multi_engine.test if you have a diff here ****
START TRANSACTION;
@@ -73,6 +71,9 @@ mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows # # table_id: #
mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query # # COMMIT
+mysqld-bin.000001 # Query # # BEGIN
+mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
+mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n
diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result
index 67a9869520b..8ba70fb8311 100644
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result
@@ -1286,16 +1286,13 @@ drop table t1;
reset master;
drop table if exists t3;
create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
-show master status;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 347
+File master-bin.000001
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
-show master status /* must show new binlog index after rotating */;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 107
+*** show new binlog index after rotating ***
+File master-bin.000002
drop table t3;
#
# Bug #45998: database crashes when running "create as select"
diff --git a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
index a43ed03b774..24e779eee8e 100644
--- a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
+++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
@@ -33,4 +33,23 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE I
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
DROP DATABASE `drop-temp+table-test`;
+RESET MASTER;
+CREATE TABLE t1 ( i text );
+CREATE TEMPORARY TABLE ttmp1 ( i text );
+SET @@session.binlog_format=ROW;
+INSERT INTO t1 VALUES ('1');
+SELECT @@session.binlog_format;
+@@session.binlog_format
+ROW
+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 ( i text )
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`
+RESET MASTER;
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
index 86da7468892..52065ef1a3d 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
@@ -297,6 +297,7 @@ 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
master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb
+master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti`
do release_lock("lock1");
drop table t0,t2;
set autocommit=0;
@@ -462,8 +463,7 @@ select get_lock("a",10);
get_lock("a",10)
1
flush logs;
-This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these
-were previously flushed upon committing/rolling back each statement.
+There is nothing to roll back; transactional changes are removed from the trans cache.
drop table t1, t2;
create temporary table tt (a int unique);
create table ti (a int) engine=innodb;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
index e5efc26f0cb..fd036643b4b 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
@@ -635,7 +635,9 @@ COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
COERCIBILITY(s1) d3;
DROP TEMPORARY TABLE tmp1;
END
-master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
+master-bin.000001 # Query # # use `bug39182`; CREATE TEMPORARY TABLE tmp1
+SELECT * FROM t1 WHERE a LIKE CONCAT("%", NAME_CONST('s1',_utf8'test' COLLATE 'utf8_unicode_ci'), "%")
+master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE tmp1
DROP PROCEDURE p1;
DROP TABLE t1;
DROP DATABASE bug39182;
@@ -774,16 +776,13 @@ drop table t1;
reset master;
drop table if exists t3;
create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
-show master status;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 347
+File master-bin.000001
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
-show master status /* must show new binlog index after rotating */;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 107
+*** show new binlog index after rotating ***
+File master-bin.000002
drop table t3;
#
# Bug #45998: database crashes when running "create as select"
diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
index 43108222866..43108222866 100755..100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
diff --git a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
index 19ddcf49080..79f09b2d1ee 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
@@ -42,3 +42,22 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS t
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
DROP DATABASE `drop-temp+table-test`;
+RESET MASTER;
+CREATE TABLE t1 ( i text );
+CREATE TEMPORARY TABLE ttmp1 ( i text );
+SET @@session.binlog_format=ROW;
+INSERT INTO t1 VALUES ('1');
+SELECT @@session.binlog_format;
+@@session.binlog_format
+ROW
+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 ( i text )
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE ttmp1 ( i text )
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`
+RESET MASTER;
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
index 9bf6f4de144..7c83c1c13a5 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
@@ -110,8 +110,6 @@ delete from t2;
reset master;
insert into t1 values(9);
insert into t2 select * from t1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
@@ -126,8 +124,6 @@ reset master;
insert into t1 values(10);
begin;
insert into t2 select * from t1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
@@ -245,8 +241,6 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
create table t0 (n int);
insert t0 select * from t1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
set autocommit=1;
insert into t0 select GET_LOCK("lock1",null);
Warnings:
@@ -288,7 +282,7 @@ master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engi
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert t1 values (1)
-master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; create table t0 (n int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert t0 select * from t1
diff --git a/mysql-test/suite/binlog/r/binlog_truncate_innodb.result b/mysql-test/suite/binlog/r/binlog_truncate_innodb.result
index ab237898a74..8beeeb1a428 100644
--- a/mysql-test/suite/binlog/r/binlog_truncate_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_truncate_innodb.result
@@ -1,3 +1,6 @@
+SET @old_binlog_format=@@binlog_format;
+SET BINLOG_FORMAT=ROW;
+RESET MASTER;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3);
@@ -9,6 +12,45 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
+# Even though the isolation level might be permissive, truncate
+# table follows a stricter isolation as its locking is based on
+# (exclusive) metadata locks.
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3);
@@ -22,6 +64,43 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3);
@@ -35,6 +114,196 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3);
+SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+**** Truncate of empty table shall be logged
+TRUNCATE TABLE t1;
+SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+TRUNCATE TABLE t2;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
+DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3);
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+**** Truncate of empty table shall be logged
+TRUNCATE TABLE t1;
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+TRUNCATE TABLE t2;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
+DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
+SET BINLOG_FORMAT=STATEMENT;
+RESET MASTER;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3);
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+**** Truncate of empty table shall be logged
+TRUNCATE TABLE t1;
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+TRUNCATE TABLE t2;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
+DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+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 t2 SELECT * FROM t1
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
+# Truncate is not supported for SBR if the isolation level is
+# READ UNCOMMITTED or READ COMMITTED. These specific isolation
+# levels are tested elsewhere.
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3);
@@ -48,6 +317,41 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+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 t2 SELECT * FROM t1
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3);
@@ -61,3 +365,39 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+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 t2 SELECT * FROM t1
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
+SET BINLOG_FORMAT=@old_binlog_format;
diff --git a/mysql-test/suite/binlog/r/binlog_truncate_myisam.result b/mysql-test/suite/binlog/r/binlog_truncate_myisam.result
index 9f01c015178..1f5b206fd6f 100644
--- a/mysql-test/suite/binlog/r/binlog_truncate_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_truncate_myisam.result
@@ -1,3 +1,5 @@
+SET @old_binlog_format=@@binlog_format;
+SET BINLOG_FORMAT=ROW;
RESET MASTER;
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
CREATE TABLE t2 (a INT) ENGINE=MyISAM;
@@ -10,3 +12,91 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+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.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
+SET BINLOG_FORMAT=STATEMENT;
+RESET MASTER;
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2),(3);
+**** Truncate of empty table shall be logged
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
+DROP TABLE t1,t2;
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+# Connection: default
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+# Connection: truncate
+TRUNCATE TABLE t1;
+# Connection: default
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+COMMIT;
+# Connection: truncate
+# Reaping TRUNCATE TABLE
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4
+# Connection: default
+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 t2 SELECT * FROM t1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+DROP TABLE t1,t2;
+SET BINLOG_FORMAT=@old_binlog_format;
diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test
index e6271ec6ccc..3f1e4e98bec 100644
--- a/mysql-test/suite/binlog/t/binlog_base64_flag.test
+++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test
@@ -150,3 +150,16 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
';
drop table t1, char63_utf8, char128_utf8;
+
+
+--echo #
+--echo # Bug #54393: crash and/or valgrind errors in
+--echo # mysql_client_binlog_statement
+--echo #
+--error ER_SYNTAX_ERROR
+BINLOG '';
+BINLOG '123';
+--error ER_SYNTAX_ERROR
+BINLOG '-2079193929';
+--error ER_SYNTAX_ERROR
+BINLOG 'xç↓%~∙D╒ƒ╡';
diff --git a/mysql-test/suite/binlog/t/binlog_innodb.test b/mysql-test/suite/binlog/t/binlog_innodb.test
index 482e787a724..8191b72d5a9 100644
--- a/mysql-test/suite/binlog/t/binlog_innodb.test
+++ b/mysql-test/suite/binlog/t/binlog_innodb.test
@@ -8,14 +8,14 @@ RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
# Should be logged as statement
UPDATE t1 SET b = 2*a WHERE a > 1;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
# Should be logged as rows
UPDATE t1 SET b = a * a WHERE a > 3;
COMMIT;
@@ -25,69 +25,69 @@ COMMIT;
SET BINLOG_FORMAT=STATEMENT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE;
UPDATE t1 SET b = 1*a WHERE a > 1;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE;
UPDATE t1 SET b = 2*a WHERE a > 2;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
UPDATE t1 SET b = 3*a WHERE a > 3;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+BEGIN;
UPDATE t1 SET b = 4*a WHERE a > 4;
COMMIT;
SET BINLOG_FORMAT=MIXED;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
UPDATE t1 SET b = 1*a WHERE a > 1;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
UPDATE t1 SET b = 2*a WHERE a > 2;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
UPDATE t1 SET b = 3*a WHERE a > 3;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+BEGIN;
UPDATE t1 SET b = 4*a WHERE a > 4;
COMMIT;
SET BINLOG_FORMAT=ROW;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
UPDATE t1 SET b = 1*a WHERE a > 1;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
UPDATE t1 SET b = 2*a WHERE a > 2;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
UPDATE t1 SET b = 3*a WHERE a > 3;
COMMIT;
-BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+BEGIN;
UPDATE t1 SET b = 4*a WHERE a > 4;
COMMIT;
diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
index 9cfa9e3e88e..f271c34d29d 100644
--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
@@ -24,7 +24,8 @@ update t1 set a=2 /* will be "killed" after work has been done */;
# for some constants like the offset of the first real event
# that is different between severs versions.
let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--let $binlog_start_point= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
+--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_point $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
@@ -49,10 +50,13 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil
# a proof the query is binlogged with an error
-
+--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 3)
+--let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
source include/show_binlog_events.inc;
---exec $MYSQL_BINLOG --force-if-open --start-position=210 --stop-position=387 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+
+
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
diff --git a/mysql-test/suite/binlog/t/binlog_row_binlog-master.opt b/mysql-test/suite/binlog/t/binlog_row_binlog-master.opt
index f8e46a44854..099f07e5d4e 100644
--- a/mysql-test/suite/binlog/t/binlog_row_binlog-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_row_binlog-master.opt
@@ -1 +1 @@
---max_binlog_size=4096
+--max_binlog_size=4096 --default-storage-engine=MyISAM
diff --git a/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt b/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt
index e76299453d3..9655b180fbd 100644
--- a/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt
@@ -1 +1 @@
---innodb_lock_wait_timeout=2
+--innodb_lock_wait_timeout=2 --default-storage-engine=MyISAM
diff --git a/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt b/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt
index f8e46a44854..099f07e5d4e 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt
@@ -1 +1 @@
---max_binlog_size=4096
+--max_binlog_size=4096 --default-storage-engine=MyISAM
diff --git a/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt b/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt
index 5d0037fdc97..5c4f0b5c198 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt
@@ -1 +1 @@
---innodb_lock_wait_timeout=2 --binlog-direct-non-transactional-updates=FALSE
+--innodb_lock_wait_timeout=2 --binlog-direct-non-transactional-updates=FALSE --default-storage-engine=MyISAM
diff --git a/mysql-test/suite/binlog/t/binlog_truncate_innodb.test b/mysql-test/suite/binlog/t/binlog_truncate_innodb.test
index be0918a43f0..56dd5bda505 100644
--- a/mysql-test/suite/binlog/t/binlog_truncate_innodb.test
+++ b/mysql-test/suite/binlog/t/binlog_truncate_innodb.test
@@ -1,20 +1,18 @@
source include/have_log_bin.inc;
source include/have_innodb.inc;
-# It is necessary to reset the master since otherwise the binlog test
-# might show the wrong binary log. The default for SHOW BINLOG EVENTS
-# is to show the first binary log, not the current one (which is
-# actually a better idea).
+let $engine = InnoDB;
+
+SET @old_binlog_format=@@binlog_format;
+SET BINLOG_FORMAT=ROW;
RESET MASTER;
-let $engine = InnoDB;
source extra/binlog_tests/binlog_truncate.test;
-# Under transaction isolation level READ UNCOMMITTED and READ
-# COMMITTED, InnoDB does not permit statement-based replication of
-# row-deleting statement. In these cases, TRUNCATE TABLE should still
-# be replicated as a statement.
+--echo # Even though the isolation level might be permissive, truncate
+--echo # table follows a stricter isolation as its locking is based on
+--echo # (exclusive) metadata locks.
let $before_truncate = SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
source extra/binlog_tests/binlog_truncate.test;
@@ -27,3 +25,20 @@ source extra/binlog_tests/binlog_truncate.test;
let $before_truncate = SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
source extra/binlog_tests/binlog_truncate.test;
+
+SET BINLOG_FORMAT=STATEMENT;
+RESET MASTER;
+
+source extra/binlog_tests/binlog_truncate.test;
+
+--echo # Truncate is not supported for SBR if the isolation level is
+--echo # READ UNCOMMITTED or READ COMMITTED. These specific isolation
+--echo # levels are tested elsewhere.
+
+let $before_truncate = SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+source extra/binlog_tests/binlog_truncate.test;
+
+let $before_truncate = SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+source extra/binlog_tests/binlog_truncate.test;
+
+SET BINLOG_FORMAT=@old_binlog_format;
diff --git a/mysql-test/suite/binlog/t/binlog_truncate_myisam.test b/mysql-test/suite/binlog/t/binlog_truncate_myisam.test
index e0e4673e876..fc28bd7c7e2 100644
--- a/mysql-test/suite/binlog/t/binlog_truncate_myisam.test
+++ b/mysql-test/suite/binlog/t/binlog_truncate_myisam.test
@@ -1,11 +1,17 @@
source include/have_log_bin.inc;
-# It is necessary to reset the master since otherwise the binlog test
-# might show the wrong binary log. The default for SHOW BINLOG EVENTS
-# is to show the first binary log, not the current one (which is
-# actually a better idea).
+SET @old_binlog_format=@@binlog_format;
+let $engine = MyISAM;
+
+SET BINLOG_FORMAT=ROW;
+RESET MASTER;
+
+source extra/binlog_tests/binlog_truncate.test;
+
+SET BINLOG_FORMAT=STATEMENT;
RESET MASTER;
-let $engine = MyISAM;
source extra/binlog_tests/binlog_truncate.test;
+
+SET BINLOG_FORMAT=@old_binlog_format;
diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def
index b6086edb2f0..35ecf52decf 100644
--- a/mysql-test/suite/binlog/t/disabled.def
+++ b/mysql-test/suite/binlog/t/disabled.def
@@ -9,6 +9,7 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
+
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/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index b4bce0b0d1b..86a61773a31 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -3521,6 +3521,7 @@ RENAME TABLE v1 TO v2;
RENAME VIEW v2 TO v1;
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 'VIEW v2 TO v1' at line 1
ALTER TABLE v2 RENAME AS v1;
+ERROR HY000: 'test.v2' is not BASE TABLE
ALTER VIEW v1 RENAME AS v2;
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 'RENAME AS v2' at line 1
DROP TABLE IF EXISTS t1, t2 ;
diff --git a/mysql-test/suite/funcs_1/r/is_basics_mixed.result b/mysql-test/suite/funcs_1/r/is_basics_mixed.result
index ce0bb69e5ee..3ac17803688 100644
--- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result
+++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result
@@ -328,7 +328,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
SELECT table_schema,table_name FROM information_schema.tables
WHERE table_schema = 'information_schema' AND table_name = 'tables';
table_schema table_name
-information_schema tables
+information_schema TABLES
SELECT * FROM information_schema.table_privileges
WHERE table_schema = 'information_schema';
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
index 1fac7ca83db..12ec7e2a33e 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
@@ -450,9 +450,9 @@ def test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof
def test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
def test tb1 f3 3 NULL YES char 0 0 NULL NULL latin1 latin1_swedish_ci char(0) select,insert,update,references
-def test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb1 f33 33 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb1 f34 34 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb1 f35 35 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
@@ -565,9 +565,9 @@ def test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se
def test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
-def test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 0088b21ee04..ea13b8619ce 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -15,8 +15,8 @@ def information_schema COLLATIONS IS_DEFAULT 4 NO varchar 3 9 NULL NULL utf8 ut
def information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) select
def information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
-def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
@@ -27,9 +27,9 @@ def information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 429496
def information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema COLUMNS EXTRA 17 NO varchar 27 81 NULL NULL utf8 utf8_general_ci varchar(27) select
def information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
-def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select
def information_schema COLUMNS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema COLUMNS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -71,14 +71,14 @@ def information_schema EVENTS SQL_MODE 12 NO varchar 8192 24576 NULL NULL utf8
def information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema EVENTS STATUS 15 NO varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select
def information_schema EVENTS TIME_ZONE 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES CHECK_TIME 35 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema FILES CREATE_TIME 33 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema FILES CREATION_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES DELETED_ROWS 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES ENGINE 10 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES EXTENT_SIZE 16 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select
@@ -88,27 +88,27 @@ def information_schema FILES FILE_NAME 2 NULL YES varchar 64 192 NULL NULL utf8
def information_schema FILES FILE_TYPE 3 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select
def information_schema FILES FREE_EXTENTS 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES FULLTEXT_KEYS 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES LAST_ACCESS_TIME 22 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema FILES LAST_UPDATE_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema FILES LOGFILE_GROUP_NAME 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES LOGFILE_GROUP_NUMBER 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
-def information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES RECOVER_TIME 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES ROW_FORMAT 26 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select
def information_schema FILES STATUS 37 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select
def information_schema FILES TABLESPACE_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES TABLE_CATALOG 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES TABLE_NAME 7 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES TABLE_SCHEMA 6 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES TOTAL_EXTENTS 15 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES TRANSACTION_COUNTER 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -140,29 +140,29 @@ def information_schema PARAMETERS ROUTINE_TYPE 15 NO varchar 9 27 NULL NULL utf
def information_schema PARAMETERS SPECIFIC_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema PARAMETERS SPECIFIC_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PARAMETERS SPECIFIC_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema PARTITIONS CREATE_TIME 19 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS NODEGROUP 24 NO varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select
def information_schema PARTITIONS PARTITION_COMMENT 23 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select
def information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
def information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
def information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select
def information_schema PARTITIONS PARTITION_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS SUBPARTITION_EXPRESSION 11 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
def information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select
def information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PARTITIONS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema PARTITIONS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -254,33 +254,33 @@ def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NUL
def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES CHECK_TIME 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select
def information_schema TABLES CREATE_TIME 15 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES ENGINE 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select
def information_schema TABLES TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema TABLES TABLE_COMMENT 21 NO varchar 2048 6144 NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema TABLES TABLE_TYPE 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLESPACES ENGINE 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLESPACES LOGFILE_GROUP_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLESPACES TABLESPACE_COMMENT 9 NULL YES varchar 2048 6144 NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema TABLESPACES TABLESPACE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema TABLESPACES TABLESPACE_TYPE 3 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result
index b2a798c938c..8cb865e68db 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_memory.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result
@@ -437,9 +437,9 @@ def test tb1 f27 19 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof
def test tb1 f28 20 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb1 f29 21 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
def test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references
-def test tb1 f30 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb1 f31 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb1 f32 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f30 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb1 f31 23 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f32 24 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb1 f33 25 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb1 f34 26 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb1 f35 27 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
@@ -540,9 +540,9 @@ def test tb3 f143 20 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se
def test tb3 f144 21 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f145 22 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f146 23 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
-def test tb3 f147 24 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f147 24 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb3 f150 27 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb3 f151 28 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb3 f152 29 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result
index b7c972c7238..e4c86f7ca94 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result
@@ -479,9 +479,9 @@ def test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof
def test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
def test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references
-def test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb1 f33 33 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb1 f34 34 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb1 f35 35 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
@@ -602,9 +602,9 @@ def test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se
def test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
-def test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
index bd548ac0a25..1ab2b3513f0 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
@@ -97,13 +97,13 @@ def mysql host Select_priv 3 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('
def mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
-def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references
+def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references
def mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL latin1 latin1_swedish_ci varchar(255) select,insert,update,references
-def mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
def mysql plugin dl 2 NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
def mysql plugin name 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL longblob select,insert,update,references
diff --git a/mysql-test/suite/funcs_1/r/is_engines_innodb.result b/mysql-test/suite/funcs_1/r/is_engines_innodb.result
index 5713b417cd1..57e53b60bbd 100644
--- a/mysql-test/suite/funcs_1/r/is_engines_innodb.result
+++ b/mysql-test/suite/funcs_1/r/is_engines_innodb.result
@@ -1,7 +1,7 @@
SELECT * FROM information_schema.engines
WHERE ENGINE = 'InnoDB';
ENGINE InnoDB
-SUPPORT YES
+SUPPORT DEFAULT
COMMENT Supports transactions, row-level locking, and foreign keys
TRANSACTIONS YES
XA YES
diff --git a/mysql-test/suite/funcs_1/r/is_engines_myisam.result b/mysql-test/suite/funcs_1/r/is_engines_myisam.result
index 2af9b3ce329..7e42c864187 100644
--- a/mysql-test/suite/funcs_1/r/is_engines_myisam.result
+++ b/mysql-test/suite/funcs_1/r/is_engines_myisam.result
@@ -2,7 +2,7 @@ SELECT * FROM information_schema.engines
WHERE ENGINE = 'MyISAM';
ENGINE MyISAM
SUPPORT DEFAULT
-COMMENT Default engine as of MySQL 3.23 with great performance
+COMMENT MyISAM storage engine
TRANSACTIONS NO
XA NO
SAVEPOINTS NO
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 2f7342088f8..7ed23c3a5c1 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -3522,6 +3522,7 @@ RENAME TABLE v1 TO v2;
RENAME VIEW v2 TO v1;
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 'VIEW v2 TO v1' at line 1
ALTER TABLE v2 RENAME AS v1;
+ERROR HY000: 'test.v2' is not BASE TABLE
ALTER VIEW v1 RENAME AS v2;
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 'RENAME AS v2' at line 1
DROP TABLE IF EXISTS t1, t2 ;
diff --git a/mysql-test/suite/funcs_1/r/myisam_views.result b/mysql-test/suite/funcs_1/r/myisam_views.result
index b77ea8a4bd9..ca4dba9f337 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views.result
@@ -4024,6 +4024,7 @@ RENAME TABLE v1 TO v2;
RENAME VIEW v2 TO v1;
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 'VIEW v2 TO v1' at line 1
ALTER TABLE v2 RENAME AS v1;
+ERROR HY000: 'test.v2' is not BASE TABLE
ALTER VIEW v1 RENAME AS v2;
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 'RENAME AS v2' at line 1
DROP TABLE IF EXISTS t1, t2 ;
diff --git a/mysql-test/suite/funcs_1/r/ndb_views.result b/mysql-test/suite/funcs_1/r/ndb_views.result
index 10cb7613f47..6c5a10845a0 100644
--- a/mysql-test/suite/funcs_1/r/ndb_views.result
+++ b/mysql-test/suite/funcs_1/r/ndb_views.result
@@ -3521,6 +3521,7 @@ RENAME TABLE v1 TO v2;
RENAME VIEW v2 TO v1;
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 'VIEW v2 TO v1' at line 1
ALTER TABLE v2 RENAME AS v1;
+ERROR HY000: 'test.v2' is not BASE TABLE
ALTER VIEW v1 RENAME AS v2;
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 'RENAME AS v2' at line 1
DROP TABLE IF EXISTS t1, t2 ;
diff --git a/mysql-test/suite/funcs_1/views/func_view.inc b/mysql-test/suite/funcs_1/views/func_view.inc
index 4aed5845a84..660efde8927 100644
--- a/mysql-test/suite/funcs_1/views/func_view.inc
+++ b/mysql-test/suite/funcs_1/views/func_view.inc
@@ -171,7 +171,7 @@ CREATE TABLE t1_selects
disable_result ENUM('Yes','No') NOT NULL default 'No',
PRIMARY KEY(id),
UNIQUE (my_select)
-);
+) ENGINE=MyISAM;
# MODES to be checked
CREATE TABLE t1_modes
@@ -180,7 +180,7 @@ CREATE TABLE t1_modes
my_mode VARCHAR(200) NOT NULL,
PRIMARY KEY(id),
UNIQUE (my_mode)
-);
+) ENGINE=MyISAM;
--enable_query_log
# The table to be used in the FROM parts of the SELECTs
diff --git a/mysql-test/suite/funcs_1/views/views_master.inc b/mysql-test/suite/funcs_1/views/views_master.inc
index 4f8439efc3a..906f1f03b3b 100644
--- a/mysql-test/suite/funcs_1/views/views_master.inc
+++ b/mysql-test/suite/funcs_1/views/views_master.inc
@@ -298,7 +298,7 @@ RENAME TABLE v1 TO v2;
# RENAME VIEW is not available even when we try it via rename table.
--error ER_PARSE_ERROR
RENAME VIEW v2 TO v1;
-#--error ER_WRONG_OBJECT
+--error ER_WRONG_OBJECT
ALTER TABLE v2 RENAME AS v1;
--error ER_PARSE_ERROR
ALTER VIEW v1 RENAME AS v2;
diff --git a/mysql-test/suite/ibmdb2i/include/have_i54.inc b/mysql-test/suite/ibmdb2i/include/have_i54.inc
index 7054e196153..7054e196153 100755..100644
--- a/mysql-test/suite/ibmdb2i/include/have_i54.inc
+++ b/mysql-test/suite/ibmdb2i/include/have_i54.inc
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result
index 8276b401073..8276b401073 100755..100644
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result
+++ b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result
index 311e800e1b0..311e800e1b0 100755..100644
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result
+++ b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test
index ea29b5abcd4..ea29b5abcd4 100755..100644
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test
+++ b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test
index da69b5d9148..da69b5d9148 100755..100644
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test
+++ b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result
index e43f70a2365..1aeca2c226a 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb/r/innodb-index.result
@@ -918,9 +918,9 @@ ERROR HY000: Too big row
alter table t1 row_format=compact;
create index t1u on t1 (u(1));
drop table t1;
-set global innodb_file_per_table=0;
-set global innodb_file_format=Antelope;
-set global innodb_file_format_max=Antelope;
+set global innodb_file_per_table=1;
+set global innodb_file_format=Barracuda;
+set global innodb_file_format_max=Barracuda;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(
diff --git a/mysql-test/suite/innodb/r/innodb-semi-consistent.result b/mysql-test/suite/innodb/r/innodb-semi-consistent.result
index ca0e362ef80..989cb818cec 100644
--- a/mysql-test/suite/innodb/r/innodb-semi-consistent.result
+++ b/mysql-test/suite/innodb/r/innodb-semi-consistent.result
@@ -13,6 +13,7 @@ set autocommit=0;
update t1 set a=10 where a=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
+commit;
set session transaction isolation level read committed;
update t1 set a=10 where a=5;
select * from t1 where a=2 for update;
diff --git a/mysql-test/suite/innodb/r/innodb-zip.result b/mysql-test/suite/innodb/r/innodb-zip.result
index 6c93f4bb6ca..da2be2bb07d 100644
--- a/mysql-test/suite/innodb/r/innodb-zip.result
+++ b/mysql-test/suite/innodb/r/innodb-zip.result
@@ -1,3 +1,4 @@
+set session innodb_strict_mode=0;
set global innodb_file_per_table=off;
set global innodb_file_format=`0`;
create table t0(a int primary key) engine=innodb row_format=compressed;
@@ -393,8 +394,8 @@ table_schema table_name row_format
test t8 Compact
test t9 Redundant
drop table t8, t9;
-set global innodb_file_per_table=0;
-set global innodb_file_format=Antelope;
+set global innodb_file_per_table=1;
+set global innodb_file_format=Barracuda;
set global innodb_file_per_table=on;
set global innodb_file_format=`Barracuda`;
set global innodb_file_format_max=`Antelope`;
diff --git a/mysql-test/suite/innodb/r/innodb_bug38231.result b/mysql-test/suite/innodb/r/innodb_bug38231.result
index 41a40542b84..195775f74c8 100644
--- a/mysql-test/suite/innodb/r/innodb_bug38231.result
+++ b/mysql-test/suite/innodb/r/innodb_bug38231.result
@@ -1,11 +1 @@
SET storage_engine=InnoDB;
-INSERT INTO bug38231_2 VALUES (1), (10), (300);
-SET autocommit=0;
-SELECT * FROM bug38231_2 FOR UPDATE;
-a
-1
-10
-300
-TRUNCATE TABLE bug38231_2;
-COMMIT;
-DROP TABLE bug38231_2;
diff --git a/mysql-test/suite/innodb/r/innodb_bug52745.result b/mysql-test/suite/innodb/r/innodb_bug52745.result
index d746fb427b5..16dd356997e 100644
--- a/mysql-test/suite/innodb/r/innodb_bug52745.result
+++ b/mysql-test/suite/innodb/r/innodb_bug52745.result
@@ -125,6 +125,6 @@ Warning 1264 Out of range value for column 'col78' at row 1
Warning 1265 Data truncated for column 'col79' at row 1
Warning 1264 Out of range value for column 'col84' at row 1
DROP TABLE bug52745;
-SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_format_max=Antelope;
-SET GLOBAL innodb_file_per_table=0;
+SET GLOBAL innodb_file_per_table=1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug53591.result b/mysql-test/suite/innodb/r/innodb_bug53591.result
index d3f8dfeafc2..8573fb60718 100644
--- a/mysql-test/suite/innodb/r/innodb_bug53591.result
+++ b/mysql-test/suite/innodb/r/innodb_bug53591.result
@@ -11,6 +11,6 @@ Error 139 Too big row
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
Error 1030 Got error 139 from storage engine
DROP TABLE bug53591;
-SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_format_max=Antelope;
-SET GLOBAL innodb_file_per_table=0;
+SET GLOBAL innodb_file_per_table=1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result
new file mode 100644
index 00000000000..90ab812f2ae
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug54044.result
@@ -0,0 +1,3 @@
+CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
+AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
+ERROR HY000: Can't create table 'test.table_54044' (errno: -1)
diff --git a/mysql-test/suite/innodb/r/innodb_file_format.result b/mysql-test/suite/innodb/r/innodb_file_format.result
index 70cfc9e4f47..447e13f0d60 100644
--- a/mysql-test/suite/innodb/r/innodb_file_format.result
+++ b/mysql-test/suite/innodb/r/innodb_file_format.result
@@ -1,6 +1,6 @@
select @@innodb_file_format;
@@innodb_file_format
-Antelope
+Barracuda
select @@innodb_file_format_check;
@@innodb_file_format_check
1
@@ -17,14 +17,14 @@ Barracuda
set global innodb_file_format=default;
select @@innodb_file_format;
@@innodb_file_format
-Antelope
+Barracuda
set global innodb_file_format=on;
ERROR 42000: Variable 'innodb_file_format' can't be set to the value of 'ON'
set global innodb_file_format=off;
ERROR 42000: Variable 'innodb_file_format' can't be set to the value of 'off'
select @@innodb_file_format;
@@innodb_file_format
-Antelope
+Barracuda
set global innodb_file_format_max=antelope;
set global innodb_file_format_max=barracuda;
set global innodb_file_format_max=cheetah;
@@ -46,5 +46,5 @@ Antelope
set global innodb_file_format_max=antelope;
set global innodb_file_format_check=off;
ERROR HY000: Variable 'innodb_file_format_check' is a read only variable
-SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_format_max=Antelope;
diff --git a/mysql-test/suite/innodb/r/innodb_information_schema.result b/mysql-test/suite/innodb/r/innodb_information_schema.result
index ad8729804df..1737dab2ff0 100644
--- a/mysql-test/suite/innodb/r/innodb_information_schema.result
+++ b/mysql-test/suite/innodb/r/innodb_information_schema.result
@@ -63,4 +63,4 @@ RUNNING 4 0 0 7 1 0 REPEATABLE READ 1 1
trx_isolation_level trx_unique_checks trx_foreign_key_checks
SERIALIZABLE 0 0
trx_state trx_isolation_level trx_last_foreign_key_error
-RUNNING SERIALIZABLE `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`)
+RUNNING REPEATABLE READ `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`)
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 124370fa630..9a677f83080 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -1590,6 +1590,9 @@ SELECT * FROM t1;
a b
1 12
ROLLBACK;
+# Switch to connection con2
+ROLLBACK;
+# Switch to connection con1
# 2. test for serialized update:
CREATE TABLE t2 (a INT);
TRUNCATE t1;
@@ -1764,6 +1767,37 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED t1 index c3,c2 c2 14 NULL 5
DROP TABLE t1;
End of 5.1 tests
+#
+# Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+#
+# Check that a TRUNCATE TABLE statement, needing an exclusive meta
+# data lock, waits for a shared metadata lock owned by a concurrent
+# transaction.
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+BEGIN;
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+# Connection con1
+TRUNCATE TABLE t1;;
+# Connection default
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+ROLLBACK;
+# Connection con1
+# Reaping TRUNCATE TABLE
+SELECT * FROM t1;
+a
+# Disconnect con1
+# Connection default
+DROP TABLE t1;
drop table if exists t1, t2, t3;
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -2434,6 +2468,84 @@ ENGINE=InnoDB;
INSERT INTO t1 VALUES (0, 77, 1, 3);
UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
DROP TABLE t1;
+#
+# Bug#50389 Using intersect does not return all rows
+#
+CREATE TABLE t1 (
+f1 INT(10) NOT NULL,
+f2 INT(10),
+f3 INT(10),
+f4 TINYINT(4),
+f5 VARCHAR(50),
+PRIMARY KEY (f1),
+KEY idx1 (f2,f5,f4),
+KEY idx2 (f2,f4)
+) ENGINE=InnoDB;
+LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1;
+SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+3470988,3305175,3329875,3817277,3856380,3796193,
+3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+f1 f2 f3 f4 f5
+3305175 1221457 0 0 abcdefghijklmnopwrst
+3329875 1221457 1382427 0 abcdefghijklmnopwrst
+3336022 1221457 0 0 abcdefghijklmnopwrst
+3346860 1221457 0 0 abcdefghijklmnopwrst
+3772880 1221457 0 0 abcdefghijklmnopwrst
+3784744 1221457 1382427 0 abcdefghijklmnopwrst
+3796193 1221457 0 0 abcdefghijklmnopwrst
+4228206 1221457 0 0 abcdefghijklmnopwrst
+4494153 1221457 0 0 abcdefghijklmnopwrst
+4559596 1221457 0 0 abcdefghijklmnopwrst
+EXPLAIN SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+3470988,3305175,3329875,3817277,3856380,3796193,
+3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where
+DROP TABLE t1;
+#
+# Bug#51431 Wrong sort order after import of dump file
+#
+CREATE TABLE t1 (
+f1 INT(11) NOT NULL,
+f2 int(11) NOT NULL,
+f3 int(11) NOT NULL,
+f4 tinyint(1) NOT NULL,
+PRIMARY KEY (f1),
+UNIQUE KEY (f2, f3),
+KEY (f4)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1),
+(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1),
+(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1),
+(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1),
+(26,1,9921,1), (27,1,9922,1);
+FLUSH TABLES;
+SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+f1 f2 f3 f4
+27 1 9922 1
+26 1 9921 1
+25 1 9920 1
+24 1 9919 1
+23 1 9918 1
+EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where
+DROP TABLE t1;
+#
+# Bug#54117 crash in thr_multi_unlock, temporary table
+#
+CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB;
+LOCK TABLES t1 READ;
+ALTER TABLE t1 COMMENT 'test';
+UNLOCK TABLES;
+DROP TABLE t1;
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-44030-master.opt b/mysql-test/suite/innodb/t/innodb-autoinc-44030-master.opt
new file mode 100644
index 00000000000..303ec1be1d0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-autoinc-44030-master.opt
@@ -0,0 +1,3 @@
+--default-storage-engine=MyISAM
+--innodb-strict-mode=0
+--innodb-file-per-table=0
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-master.opt b/mysql-test/suite/innodb/t/innodb-autoinc-master.opt
new file mode 100644
index 00000000000..303ec1be1d0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-autoinc-master.opt
@@ -0,0 +1,3 @@
+--default-storage-engine=MyISAM
+--innodb-strict-mode=0
+--innodb-file-per-table=0
diff --git a/mysql-test/suite/innodb/t/innodb-master.opt b/mysql-test/suite/innodb/t/innodb-master.opt
index 4901efb416c..8b247193a4e 100644
--- a/mysql-test/suite/innodb/t/innodb-master.opt
+++ b/mysql-test/suite/innodb/t/innodb-master.opt
@@ -1 +1,4 @@
--binlog_cache_size=32768 --innodb_lock_wait_timeout=1
+--default-storage-engine=MyISAM
+--innodb-strict-mode=0
+--innodb-file-per-table=0
diff --git a/mysql-test/suite/innodb/t/innodb-semi-consistent.test b/mysql-test/suite/innodb/t/innodb-semi-consistent.test
index 61ad7815ca9..28bf532ff1f 100644
--- a/mysql-test/suite/innodb/t/innodb-semi-consistent.test
+++ b/mysql-test/suite/innodb/t/innodb-semi-consistent.test
@@ -23,6 +23,7 @@ set session transaction isolation level repeatable read;
set autocommit=0;
-- error ER_LOCK_WAIT_TIMEOUT
update t1 set a=10 where a=5;
+commit;
connection a;
commit;
connection b;
diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view-master.opt b/mysql-test/suite/innodb/t/innodb-system-table-view-master.opt
new file mode 100644
index 00000000000..303ec1be1d0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-system-table-view-master.opt
@@ -0,0 +1,3 @@
+--default-storage-engine=MyISAM
+--innodb-strict-mode=0
+--innodb-file-per-table=0
diff --git a/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt b/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt
index acf3b8729ed..041b063645b 100644
--- a/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt
+++ b/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt
@@ -1 +1,3 @@
---innodb-use-sys-malloc=true
+--default-storage-engine=MyISAM
+--loose-innodb-use-sys-malloc=true
+--loose-innodb-use-sys-malloc=true
diff --git a/mysql-test/suite/innodb/t/innodb-zip.test b/mysql-test/suite/innodb/t/innodb-zip.test
index 3acd7e42fa6..8e00a8b019b 100644
--- a/mysql-test/suite/innodb/t/innodb-zip.test
+++ b/mysql-test/suite/innodb/t/innodb-zip.test
@@ -3,9 +3,12 @@
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
let $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
+let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
+
+set session innodb_strict_mode=0;
set global innodb_file_per_table=off;
set global innodb_file_format=`0`;
-
+
create table t0(a int primary key) engine=innodb row_format=compressed;
create table t00(a int primary key) engine=innodb
key_block_size=4 row_format=compressed;
@@ -342,3 +345,4 @@ drop table normal_table, zip_table;
eval set global innodb_file_format=$format;
eval set global innodb_file_per_table=$per_table;
eval set global innodb_file_format_max=$innodb_file_format_max_orig;
+eval set session innodb_strict_mode=$innodb_strict_mode_orig;
diff --git a/mysql-test/suite/innodb/t/innodb_bug38231.test b/mysql-test/suite/innodb/t/innodb_bug38231.test
index a0a10bbd100..0d4262b4473 100644
--- a/mysql-test/suite/innodb/t/innodb_bug38231.test
+++ b/mysql-test/suite/innodb/t/innodb_bug38231.test
@@ -71,30 +71,7 @@ UNLOCK TABLES;
DROP TABLE bug38231_1;
-# test that TRUNCATE works with row-level locks
-
-DROP TABLE IF EXISTS bug38231_2;
-CREATE TABLE bug38231_2 (a INT);
-
-- enable_query_log
-- enable_result_log
-INSERT INTO bug38231_2 VALUES (1), (10), (300);
-
--- connect (con4,localhost,root,,)
-
--- connection con4
-SET autocommit=0;
-SELECT * FROM bug38231_2 FOR UPDATE;
-
-- connection default
-TRUNCATE TABLE bug38231_2;
-
--- connection con4
-COMMIT;
-
--- connection default
-
--- disconnect con4
-
-DROP TABLE bug38231_2;
diff --git a/mysql-test/suite/innodb/t/innodb_bug47167.test b/mysql-test/suite/innodb/t/innodb_bug47167.test
index 622182acefa..8fcd129cf94 100644
--- a/mysql-test/suite/innodb/t/innodb_bug47167.test
+++ b/mysql-test/suite/innodb/t/innodb_bug47167.test
@@ -2,6 +2,7 @@
# It tests setting the global variable "innodb_file_format_max" (
# originally "innodb_file_format_check") with a user-Defined Variable.
+--source include/not_embedded.inc
--source include/have_innodb.inc
# Save the value (Antelope) in 'innodb_file_format_max' to
diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test
new file mode 100644
index 00000000000..a6722ed6399
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug54044.test
@@ -0,0 +1,11 @@
+# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type
+# during create table, so it will not trigger assertion failure.
+
+--source include/have_innodb.inc
+
+# This 'create table' operation should fail because of
+# using NULL datatype
+--error ER_CANT_CREATE_TABLE
+CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
+ AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
+
diff --git a/mysql-test/suite/innodb/t/innodb_file_format.test b/mysql-test/suite/innodb/t/innodb_file_format.test
index 26c3646c0dd..aa411258da0 100644
--- a/mysql-test/suite/innodb/t/innodb_file_format.test
+++ b/mysql-test/suite/innodb/t/innodb_file_format.test
@@ -1,3 +1,4 @@
+-- source include/not_embedded.inc
-- source include/have_innodb.inc
let $innodb_file_format_orig=`select @@innodb_file_format`;
diff --git a/mysql-test/suite/innodb/t/innodb_mysql-master.opt b/mysql-test/suite/innodb/t/innodb_mysql-master.opt
index 205c733455d..c46f5079568 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_mysql-master.opt
@@ -1 +1 @@
---innodb-lock-wait-timeout=2
+--innodb-lock-wait-timeout=2 --default-storage-engine=MyISAM
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
index 09e076c0506..495d5c014ce 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -676,6 +676,81 @@ UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
DROP TABLE t1;
+--echo #
+--echo # Bug#50389 Using intersect does not return all rows
+--echo #
+
+CREATE TABLE t1 (
+ f1 INT(10) NOT NULL,
+ f2 INT(10),
+ f3 INT(10),
+ f4 TINYINT(4),
+ f5 VARCHAR(50),
+ PRIMARY KEY (f1),
+ KEY idx1 (f2,f5,f4),
+ KEY idx2 (f2,f4)
+) ENGINE=InnoDB;
+
+LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1;
+
+SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+ 3470988,3305175,3329875,3817277,3856380,3796193,
+ 3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+
+EXPLAIN SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+ 3470988,3305175,3329875,3817277,3856380,3796193,
+ 3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#51431 Wrong sort order after import of dump file
+--echo #
+
+CREATE TABLE t1 (
+ f1 INT(11) NOT NULL,
+ f2 int(11) NOT NULL,
+ f3 int(11) NOT NULL,
+ f4 tinyint(1) NOT NULL,
+ PRIMARY KEY (f1),
+ UNIQUE KEY (f2, f3),
+ KEY (f4)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1),
+(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1),
+(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1),
+(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1),
+(26,1,9921,1), (27,1,9922,1);
+
+FLUSH TABLES;
+
+SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#54117 crash in thr_multi_unlock, temporary table
+--echo #
+
+CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB;
+
+LOCK TABLES t1 READ;
+ALTER TABLE t1 COMMENT 'test';
+UNLOCK TABLES;
+
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_format.result b/mysql-test/suite/ndb/r/ndb_binlog_format.result
index 909d122bfc6..b6022b61746 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_format.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_format.result
@@ -8,8 +8,6 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
START TRANSACTION;
INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f;
diff --git a/mysql-test/suite/ndb/t/disabled.def b/mysql-test/suite/ndb/t/disabled.def
index 4c5c792f4ef..d38f60d6a54 100644
--- a/mysql-test/suite/ndb/t/disabled.def
+++ b/mysql-test/suite/ndb/t/disabled.def
@@ -10,8 +10,9 @@
#
##############################################################################
-ndb_partition_error2 : Bug#40989 ndb_partition_error2 needs maintenance
+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
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
diff --git a/mysql-test/suite/parts/r/partition_alter3_innodb.result b/mysql-test/suite/parts/r/partition_alter3_innodb.result
index cb104d4be54..dc6008842a3 100644
--- a/mysql-test/suite/parts/r/partition_alter3_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter3_innodb.result
@@ -57,6 +57,7 @@ t1 CREATE TABLE `t1` (
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
t1.frm
+t1.ibd
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where
@@ -78,6 +79,7 @@ t1 CREATE TABLE `t1` (
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (YEAR(f_date)) */
+t1#P#p0.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -96,6 +98,7 @@ t1 CREATE TABLE `t1` (
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (DAYOFYEAR(f_date)) */
+t1#P#p0.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -112,6 +115,7 @@ t1 CREATE TABLE `t1` (
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (YEAR(f_date)) */
+t1#P#p0.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -137,6 +141,9 @@ t1 CREATE TABLE `t1` (
(PARTITION p0 ENGINE = InnoDB,
PARTITION part1 ENGINE = InnoDB,
PARTITION part7 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -161,6 +168,10 @@ t1 CREATE TABLE `t1` (
PARTITION part1 ENGINE = InnoDB,
PARTITION part7 ENGINE = InnoDB,
PARTITION part2 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -186,6 +197,14 @@ t1 CREATE TABLE `t1` (
PARTITION p5 ENGINE = InnoDB,
PARTITION p6 ENGINE = InnoDB,
PARTITION p7 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#p4.ibd
+t1#P#p5.ibd
+t1#P#p6.ibd
+t1#P#p7.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -222,6 +241,13 @@ t1 CREATE TABLE `t1` (
PARTITION p4 ENGINE = InnoDB,
PARTITION p5 ENGINE = InnoDB,
PARTITION p6 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#p4.ibd
+t1#P#p5.ibd
+t1#P#p6.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -244,6 +270,12 @@ t1 CREATE TABLE `t1` (
PARTITION part2 ENGINE = InnoDB,
PARTITION p4 ENGINE = InnoDB,
PARTITION p5 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#p4.ibd
+t1#P#p5.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -265,6 +297,11 @@ t1 CREATE TABLE `t1` (
PARTITION part7 ENGINE = InnoDB,
PARTITION part2 ENGINE = InnoDB,
PARTITION p4 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#p4.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -285,6 +322,10 @@ t1 CREATE TABLE `t1` (
PARTITION part1 ENGINE = InnoDB,
PARTITION part7 ENGINE = InnoDB,
PARTITION part2 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -304,6 +345,9 @@ t1 CREATE TABLE `t1` (
(PARTITION p0 ENGINE = InnoDB,
PARTITION part1 ENGINE = InnoDB,
PARTITION part7 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -322,6 +366,8 @@ t1 CREATE TABLE `t1` (
/*!50100 PARTITION BY HASH (YEAR(f_date))
(PARTITION p0 ENGINE = InnoDB,
PARTITION part1 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -339,6 +385,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (YEAR(f_date))
(PARTITION p0 ENGINE = InnoDB) */
+t1#P#p0.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
@@ -359,6 +406,7 @@ t1 CREATE TABLE `t1` (
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
t1.frm
+t1.ibd
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where
@@ -398,6 +446,7 @@ t1 CREATE TABLE `t1` (
`f_charbig` varchar(1000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
t1.frm
+t1.ibd
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where
@@ -420,6 +469,7 @@ t1 CREATE TABLE `t1` (
`f_charbig` varchar(1000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (f_int1) */
+t1#P#p0.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -448,6 +498,9 @@ t1 CREATE TABLE `t1` (
(PARTITION p0 ENGINE = InnoDB,
PARTITION part1 ENGINE = InnoDB,
PARTITION part7 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -472,6 +525,10 @@ t1 CREATE TABLE `t1` (
PARTITION part1 ENGINE = InnoDB,
PARTITION part7 ENGINE = InnoDB,
PARTITION part2 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -500,6 +557,14 @@ t1 CREATE TABLE `t1` (
PARTITION p5 ENGINE = InnoDB,
PARTITION p6 ENGINE = InnoDB,
PARTITION p7 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#p4.ibd
+t1#P#p5.ibd
+t1#P#p6.ibd
+t1#P#p7.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -534,6 +599,13 @@ t1 CREATE TABLE `t1` (
PARTITION p4 ENGINE = InnoDB,
PARTITION p5 ENGINE = InnoDB,
PARTITION p6 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#p4.ibd
+t1#P#p5.ibd
+t1#P#p6.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -559,6 +631,12 @@ t1 CREATE TABLE `t1` (
PARTITION part2 ENGINE = InnoDB,
PARTITION p4 ENGINE = InnoDB,
PARTITION p5 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#p4.ibd
+t1#P#p5.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -583,6 +661,11 @@ t1 CREATE TABLE `t1` (
PARTITION part7 ENGINE = InnoDB,
PARTITION part2 ENGINE = InnoDB,
PARTITION p4 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#p4.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -606,6 +689,10 @@ t1 CREATE TABLE `t1` (
PARTITION part1 ENGINE = InnoDB,
PARTITION part7 ENGINE = InnoDB,
PARTITION part2 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -628,6 +715,9 @@ t1 CREATE TABLE `t1` (
(PARTITION p0 ENGINE = InnoDB,
PARTITION part1 ENGINE = InnoDB,
PARTITION part7 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
+t1#P#part7.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -649,6 +739,8 @@ t1 CREATE TABLE `t1` (
/*!50100 PARTITION BY KEY (f_int1)
(PARTITION p0 ENGINE = InnoDB,
PARTITION part1 ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1#P#part1.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -669,6 +761,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (f_int1)
(PARTITION p0 ENGINE = InnoDB) */
+t1#P#p0.ibd
t1.frm
t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
@@ -692,6 +785,7 @@ t1 CREATE TABLE `t1` (
`f_charbig` varchar(1000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
t1.frm
+t1.ibd
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where
diff --git a/mysql-test/suite/parts/r/partition_basic_innodb.result b/mysql-test/suite/parts/r/partition_basic_innodb.result
index 21c5d70e6e3..c6a89e970b3 100644
--- a/mysql-test/suite/parts/r/partition_basic_innodb.result
+++ b/mysql-test/suite/parts/r/partition_basic_innodb.result
@@ -77,6 +77,8 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
t1.frm
t1.par
@@ -532,6 +534,11 @@ t1 CREATE TABLE `t1` (
PARTITIONS 5 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
+t1#P#p2.ibd
+t1#P#p3.ibd
+t1#P#p4.ibd
t1.frm
t1.par
@@ -1002,6 +1009,14 @@ t1 CREATE TABLE `t1` (
PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */
unified filelist
+t1#P#part0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part3.ibd
+t1#P#part_1.ibd
+t1#P#part_2.ibd
+t1#P#part_3.ibd
+t1#P#part_N.ibd
t1.frm
t1.par
@@ -1468,6 +1483,12 @@ t1 CREATE TABLE `t1` (
PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta.ibd
+t1#P#partb.ibd
+t1#P#partc.ibd
+t1#P#partd.ibd
+t1#P#parte.ibd
+t1#P#partf.ibd
t1.frm
t1.par
@@ -1930,6 +1951,14 @@ SUBPARTITIONS 2
PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta#SP#partasp0.ibd
+t1#P#parta#SP#partasp1.ibd
+t1#P#partb#SP#partbsp0.ibd
+t1#P#partb#SP#partbsp1.ibd
+t1#P#partc#SP#partcsp0.ibd
+t1#P#partc#SP#partcsp1.ibd
+t1#P#partd#SP#partdsp0.ibd
+t1#P#partd#SP#partdsp1.ibd
t1.frm
t1.par
@@ -2405,6 +2434,14 @@ SUBPARTITION BY KEY (f_int1)
SUBPARTITION subpart42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#subpart11.ibd
+t1#P#part1#SP#subpart12.ibd
+t1#P#part2#SP#subpart21.ibd
+t1#P#part2#SP#subpart22.ibd
+t1#P#part3#SP#subpart31.ibd
+t1#P#part3#SP#subpart32.ibd
+t1#P#part4#SP#subpart41.ibd
+t1#P#part4#SP#subpart42.ibd
t1.frm
t1.par
@@ -2882,6 +2919,14 @@ SUBPARTITION BY HASH (f_int1 + 1)
SUBPARTITION sp42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#sp11.ibd
+t1#P#part1#SP#sp12.ibd
+t1#P#part2#SP#sp21.ibd
+t1#P#part2#SP#sp22.ibd
+t1#P#part3#SP#sp31.ibd
+t1#P#part3#SP#sp32.ibd
+t1#P#part4#SP#sp41.ibd
+t1#P#part4#SP#sp42.ibd
t1.frm
t1.par
@@ -3345,6 +3390,15 @@ SUBPARTITIONS 3
PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */
unified filelist
+t1#P#part1#SP#part1sp0.ibd
+t1#P#part1#SP#part1sp1.ibd
+t1#P#part1#SP#part1sp2.ibd
+t1#P#part2#SP#part2sp0.ibd
+t1#P#part2#SP#part2sp1.ibd
+t1#P#part2#SP#part2sp2.ibd
+t1#P#part3#SP#part3sp0.ibd
+t1#P#part3#SP#part3sp1.ibd
+t1#P#part3#SP#part3sp2.ibd
t1.frm
t1.par
@@ -3802,6 +3856,8 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
t1.frm
t1.par
@@ -4257,6 +4313,11 @@ t1 CREATE TABLE `t1` (
PARTITIONS 5 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
+t1#P#p2.ibd
+t1#P#p3.ibd
+t1#P#p4.ibd
t1.frm
t1.par
@@ -4727,6 +4788,14 @@ t1 CREATE TABLE `t1` (
PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */
unified filelist
+t1#P#part0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part3.ibd
+t1#P#part_1.ibd
+t1#P#part_2.ibd
+t1#P#part_3.ibd
+t1#P#part_N.ibd
t1.frm
t1.par
@@ -5193,6 +5262,12 @@ t1 CREATE TABLE `t1` (
PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta.ibd
+t1#P#partb.ibd
+t1#P#partc.ibd
+t1#P#partd.ibd
+t1#P#parte.ibd
+t1#P#partf.ibd
t1.frm
t1.par
@@ -5655,6 +5730,14 @@ SUBPARTITIONS 2
PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta#SP#partasp0.ibd
+t1#P#parta#SP#partasp1.ibd
+t1#P#partb#SP#partbsp0.ibd
+t1#P#partb#SP#partbsp1.ibd
+t1#P#partc#SP#partcsp0.ibd
+t1#P#partc#SP#partcsp1.ibd
+t1#P#partd#SP#partdsp0.ibd
+t1#P#partd#SP#partdsp1.ibd
t1.frm
t1.par
@@ -6128,6 +6211,14 @@ SUBPARTITION BY KEY (f_int2)
SUBPARTITION subpart42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#subpart11.ibd
+t1#P#part1#SP#subpart12.ibd
+t1#P#part2#SP#subpart21.ibd
+t1#P#part2#SP#subpart22.ibd
+t1#P#part3#SP#subpart31.ibd
+t1#P#part3#SP#subpart32.ibd
+t1#P#part4#SP#subpart41.ibd
+t1#P#part4#SP#subpart42.ibd
t1.frm
t1.par
@@ -6601,6 +6692,14 @@ SUBPARTITION BY HASH (f_int2 + 1)
SUBPARTITION sp42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#sp11.ibd
+t1#P#part1#SP#sp12.ibd
+t1#P#part2#SP#sp21.ibd
+t1#P#part2#SP#sp22.ibd
+t1#P#part3#SP#sp31.ibd
+t1#P#part3#SP#sp32.ibd
+t1#P#part4#SP#sp41.ibd
+t1#P#part4#SP#sp42.ibd
t1.frm
t1.par
@@ -7064,6 +7163,15 @@ SUBPARTITIONS 3
PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */
unified filelist
+t1#P#part1#SP#part1sp0.ibd
+t1#P#part1#SP#part1sp1.ibd
+t1#P#part1#SP#part1sp2.ibd
+t1#P#part2#SP#part2sp0.ibd
+t1#P#part2#SP#part2sp1.ibd
+t1#P#part2#SP#part2sp2.ibd
+t1#P#part3#SP#part3sp0.ibd
+t1#P#part3#SP#part3sp1.ibd
+t1#P#part3#SP#part3sp2.ibd
t1.frm
t1.par
@@ -7527,6 +7635,8 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
t1.frm
t1.par
@@ -8019,6 +8129,11 @@ t1 CREATE TABLE `t1` (
PARTITIONS 5 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
+t1#P#p2.ibd
+t1#P#p3.ibd
+t1#P#p4.ibd
t1.frm
t1.par
@@ -8526,6 +8641,14 @@ t1 CREATE TABLE `t1` (
PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */
unified filelist
+t1#P#part0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part3.ibd
+t1#P#part_1.ibd
+t1#P#part_2.ibd
+t1#P#part_3.ibd
+t1#P#part_N.ibd
t1.frm
t1.par
@@ -9029,6 +9152,12 @@ t1 CREATE TABLE `t1` (
PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta.ibd
+t1#P#partb.ibd
+t1#P#partc.ibd
+t1#P#partd.ibd
+t1#P#parte.ibd
+t1#P#partf.ibd
t1.frm
t1.par
@@ -9528,6 +9657,14 @@ SUBPARTITIONS 2
PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta#SP#partasp0.ibd
+t1#P#parta#SP#partasp1.ibd
+t1#P#partb#SP#partbsp0.ibd
+t1#P#partb#SP#partbsp1.ibd
+t1#P#partc#SP#partcsp0.ibd
+t1#P#partc#SP#partcsp1.ibd
+t1#P#partd#SP#partdsp0.ibd
+t1#P#partd#SP#partdsp1.ibd
t1.frm
t1.par
@@ -10040,6 +10177,14 @@ SUBPARTITION BY KEY (f_int1)
SUBPARTITION subpart42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#subpart11.ibd
+t1#P#part1#SP#subpart12.ibd
+t1#P#part2#SP#subpart21.ibd
+t1#P#part2#SP#subpart22.ibd
+t1#P#part3#SP#subpart31.ibd
+t1#P#part3#SP#subpart32.ibd
+t1#P#part4#SP#subpart41.ibd
+t1#P#part4#SP#subpart42.ibd
t1.frm
t1.par
@@ -10554,6 +10699,14 @@ SUBPARTITION BY HASH (f_int1 + 1)
SUBPARTITION sp42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#sp11.ibd
+t1#P#part1#SP#sp12.ibd
+t1#P#part2#SP#sp21.ibd
+t1#P#part2#SP#sp22.ibd
+t1#P#part3#SP#sp31.ibd
+t1#P#part3#SP#sp32.ibd
+t1#P#part4#SP#sp41.ibd
+t1#P#part4#SP#sp42.ibd
t1.frm
t1.par
@@ -11054,6 +11207,15 @@ SUBPARTITIONS 3
PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */
unified filelist
+t1#P#part1#SP#part1sp0.ibd
+t1#P#part1#SP#part1sp1.ibd
+t1#P#part1#SP#part1sp2.ibd
+t1#P#part2#SP#part2sp0.ibd
+t1#P#part2#SP#part2sp1.ibd
+t1#P#part2#SP#part2sp2.ibd
+t1#P#part3#SP#part3sp0.ibd
+t1#P#part3#SP#part3sp1.ibd
+t1#P#part3#SP#part3sp2.ibd
t1.frm
t1.par
@@ -11547,6 +11709,8 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
t1.frm
t1.par
@@ -12039,6 +12203,11 @@ t1 CREATE TABLE `t1` (
PARTITIONS 5 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
+t1#P#p2.ibd
+t1#P#p3.ibd
+t1#P#p4.ibd
t1.frm
t1.par
@@ -12546,6 +12715,14 @@ t1 CREATE TABLE `t1` (
PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */
unified filelist
+t1#P#part0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part3.ibd
+t1#P#part_1.ibd
+t1#P#part_2.ibd
+t1#P#part_3.ibd
+t1#P#part_N.ibd
t1.frm
t1.par
@@ -13049,6 +13226,12 @@ t1 CREATE TABLE `t1` (
PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta.ibd
+t1#P#partb.ibd
+t1#P#partc.ibd
+t1#P#partd.ibd
+t1#P#parte.ibd
+t1#P#partf.ibd
t1.frm
t1.par
@@ -13548,6 +13731,14 @@ SUBPARTITIONS 2
PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta#SP#partasp0.ibd
+t1#P#parta#SP#partasp1.ibd
+t1#P#partb#SP#partbsp0.ibd
+t1#P#partb#SP#partbsp1.ibd
+t1#P#partc#SP#partcsp0.ibd
+t1#P#partc#SP#partcsp1.ibd
+t1#P#partd#SP#partdsp0.ibd
+t1#P#partd#SP#partdsp1.ibd
t1.frm
t1.par
@@ -14060,6 +14251,14 @@ SUBPARTITION BY KEY (f_int1)
SUBPARTITION subpart42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#subpart11.ibd
+t1#P#part1#SP#subpart12.ibd
+t1#P#part2#SP#subpart21.ibd
+t1#P#part2#SP#subpart22.ibd
+t1#P#part3#SP#subpart31.ibd
+t1#P#part3#SP#subpart32.ibd
+t1#P#part4#SP#subpart41.ibd
+t1#P#part4#SP#subpart42.ibd
t1.frm
t1.par
@@ -14574,6 +14773,14 @@ SUBPARTITION BY HASH (f_int1 + 1)
SUBPARTITION sp42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#sp11.ibd
+t1#P#part1#SP#sp12.ibd
+t1#P#part2#SP#sp21.ibd
+t1#P#part2#SP#sp22.ibd
+t1#P#part3#SP#sp31.ibd
+t1#P#part3#SP#sp32.ibd
+t1#P#part4#SP#sp41.ibd
+t1#P#part4#SP#sp42.ibd
t1.frm
t1.par
@@ -15074,6 +15281,15 @@ SUBPARTITIONS 3
PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */
unified filelist
+t1#P#part1#SP#part1sp0.ibd
+t1#P#part1#SP#part1sp1.ibd
+t1#P#part1#SP#part1sp2.ibd
+t1#P#part2#SP#part2sp0.ibd
+t1#P#part2#SP#part2sp1.ibd
+t1#P#part2#SP#part2sp2.ibd
+t1#P#part3#SP#part3sp0.ibd
+t1#P#part3#SP#part3sp1.ibd
+t1#P#part3#SP#part3sp2.ibd
t1.frm
t1.par
@@ -15567,6 +15783,8 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
t1.frm
t1.par
@@ -16075,6 +16293,11 @@ t1 CREATE TABLE `t1` (
PARTITIONS 5 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
+t1#P#p2.ibd
+t1#P#p3.ibd
+t1#P#p4.ibd
t1.frm
t1.par
@@ -16598,6 +16821,14 @@ t1 CREATE TABLE `t1` (
PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */
unified filelist
+t1#P#part0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part3.ibd
+t1#P#part_1.ibd
+t1#P#part_2.ibd
+t1#P#part_3.ibd
+t1#P#part_N.ibd
t1.frm
t1.par
@@ -17117,6 +17348,12 @@ t1 CREATE TABLE `t1` (
PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta.ibd
+t1#P#partb.ibd
+t1#P#partc.ibd
+t1#P#partd.ibd
+t1#P#parte.ibd
+t1#P#partf.ibd
t1.frm
t1.par
@@ -17632,6 +17869,14 @@ SUBPARTITIONS 2
PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta#SP#partasp0.ibd
+t1#P#parta#SP#partasp1.ibd
+t1#P#partb#SP#partbsp0.ibd
+t1#P#partb#SP#partbsp1.ibd
+t1#P#partc#SP#partcsp0.ibd
+t1#P#partc#SP#partcsp1.ibd
+t1#P#partd#SP#partdsp0.ibd
+t1#P#partd#SP#partdsp1.ibd
t1.frm
t1.par
@@ -18160,6 +18405,14 @@ SUBPARTITION BY KEY (f_int1)
SUBPARTITION subpart42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#subpart11.ibd
+t1#P#part1#SP#subpart12.ibd
+t1#P#part2#SP#subpart21.ibd
+t1#P#part2#SP#subpart22.ibd
+t1#P#part3#SP#subpart31.ibd
+t1#P#part3#SP#subpart32.ibd
+t1#P#part4#SP#subpart41.ibd
+t1#P#part4#SP#subpart42.ibd
t1.frm
t1.par
@@ -18690,6 +18943,14 @@ SUBPARTITION BY HASH (f_int1 + 1)
SUBPARTITION sp42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#sp11.ibd
+t1#P#part1#SP#sp12.ibd
+t1#P#part2#SP#sp21.ibd
+t1#P#part2#SP#sp22.ibd
+t1#P#part3#SP#sp31.ibd
+t1#P#part3#SP#sp32.ibd
+t1#P#part4#SP#sp41.ibd
+t1#P#part4#SP#sp42.ibd
t1.frm
t1.par
@@ -19206,6 +19467,15 @@ SUBPARTITIONS 3
PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */
unified filelist
+t1#P#part1#SP#part1sp0.ibd
+t1#P#part1#SP#part1sp1.ibd
+t1#P#part1#SP#part1sp2.ibd
+t1#P#part2#SP#part2sp0.ibd
+t1#P#part2#SP#part2sp1.ibd
+t1#P#part2#SP#part2sp2.ibd
+t1#P#part3#SP#part3sp0.ibd
+t1#P#part3#SP#part3sp1.ibd
+t1#P#part3#SP#part3sp2.ibd
t1.frm
t1.par
@@ -19720,6 +19990,8 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
t1.frm
t1.par
@@ -20212,6 +20484,11 @@ t1 CREATE TABLE `t1` (
PARTITIONS 5 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
+t1#P#p2.ibd
+t1#P#p3.ibd
+t1#P#p4.ibd
t1.frm
t1.par
@@ -20719,6 +20996,14 @@ t1 CREATE TABLE `t1` (
PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */
unified filelist
+t1#P#part0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part3.ibd
+t1#P#part_1.ibd
+t1#P#part_2.ibd
+t1#P#part_3.ibd
+t1#P#part_N.ibd
t1.frm
t1.par
@@ -21222,6 +21507,12 @@ t1 CREATE TABLE `t1` (
PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta.ibd
+t1#P#partb.ibd
+t1#P#partc.ibd
+t1#P#partd.ibd
+t1#P#parte.ibd
+t1#P#partf.ibd
t1.frm
t1.par
@@ -21721,6 +22012,14 @@ SUBPARTITIONS 2
PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta#SP#partasp0.ibd
+t1#P#parta#SP#partasp1.ibd
+t1#P#partb#SP#partbsp0.ibd
+t1#P#partb#SP#partbsp1.ibd
+t1#P#partc#SP#partcsp0.ibd
+t1#P#partc#SP#partcsp1.ibd
+t1#P#partd#SP#partdsp0.ibd
+t1#P#partd#SP#partdsp1.ibd
t1.frm
t1.par
@@ -22231,6 +22530,14 @@ SUBPARTITION BY KEY (f_int2)
SUBPARTITION subpart42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#subpart11.ibd
+t1#P#part1#SP#subpart12.ibd
+t1#P#part2#SP#subpart21.ibd
+t1#P#part2#SP#subpart22.ibd
+t1#P#part3#SP#subpart31.ibd
+t1#P#part3#SP#subpart32.ibd
+t1#P#part4#SP#subpart41.ibd
+t1#P#part4#SP#subpart42.ibd
t1.frm
t1.par
@@ -22741,6 +23048,14 @@ SUBPARTITION BY HASH (f_int2 + 1)
SUBPARTITION sp42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#sp11.ibd
+t1#P#part1#SP#sp12.ibd
+t1#P#part2#SP#sp21.ibd
+t1#P#part2#SP#sp22.ibd
+t1#P#part3#SP#sp31.ibd
+t1#P#part3#SP#sp32.ibd
+t1#P#part4#SP#sp41.ibd
+t1#P#part4#SP#sp42.ibd
t1.frm
t1.par
@@ -23241,6 +23556,15 @@ SUBPARTITIONS 3
PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */
unified filelist
+t1#P#part1#SP#part1sp0.ibd
+t1#P#part1#SP#part1sp1.ibd
+t1#P#part1#SP#part1sp2.ibd
+t1#P#part2#SP#part2sp0.ibd
+t1#P#part2#SP#part2sp1.ibd
+t1#P#part2#SP#part2sp2.ibd
+t1#P#part3#SP#part3sp0.ibd
+t1#P#part3#SP#part3sp1.ibd
+t1#P#part3#SP#part3sp2.ibd
t1.frm
t1.par
@@ -23734,6 +24058,8 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
t1.frm
t1.par
@@ -24226,6 +24552,11 @@ t1 CREATE TABLE `t1` (
PARTITIONS 5 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
+t1#P#p2.ibd
+t1#P#p3.ibd
+t1#P#p4.ibd
t1.frm
t1.par
@@ -24733,6 +25064,14 @@ t1 CREATE TABLE `t1` (
PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */
unified filelist
+t1#P#part0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part3.ibd
+t1#P#part_1.ibd
+t1#P#part_2.ibd
+t1#P#part_3.ibd
+t1#P#part_N.ibd
t1.frm
t1.par
@@ -25236,6 +25575,12 @@ t1 CREATE TABLE `t1` (
PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta.ibd
+t1#P#partb.ibd
+t1#P#partc.ibd
+t1#P#partd.ibd
+t1#P#parte.ibd
+t1#P#partf.ibd
t1.frm
t1.par
@@ -25735,6 +26080,14 @@ SUBPARTITIONS 2
PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta#SP#partasp0.ibd
+t1#P#parta#SP#partasp1.ibd
+t1#P#partb#SP#partbsp0.ibd
+t1#P#partb#SP#partbsp1.ibd
+t1#P#partc#SP#partcsp0.ibd
+t1#P#partc#SP#partcsp1.ibd
+t1#P#partd#SP#partdsp0.ibd
+t1#P#partd#SP#partdsp1.ibd
t1.frm
t1.par
@@ -26245,6 +26598,14 @@ SUBPARTITION BY KEY (f_int2)
SUBPARTITION subpart42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#subpart11.ibd
+t1#P#part1#SP#subpart12.ibd
+t1#P#part2#SP#subpart21.ibd
+t1#P#part2#SP#subpart22.ibd
+t1#P#part3#SP#subpart31.ibd
+t1#P#part3#SP#subpart32.ibd
+t1#P#part4#SP#subpart41.ibd
+t1#P#part4#SP#subpart42.ibd
t1.frm
t1.par
@@ -26755,6 +27116,14 @@ SUBPARTITION BY HASH (f_int2 + 1)
SUBPARTITION sp42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#sp11.ibd
+t1#P#part1#SP#sp12.ibd
+t1#P#part2#SP#sp21.ibd
+t1#P#part2#SP#sp22.ibd
+t1#P#part3#SP#sp31.ibd
+t1#P#part3#SP#sp32.ibd
+t1#P#part4#SP#sp41.ibd
+t1#P#part4#SP#sp42.ibd
t1.frm
t1.par
@@ -27255,6 +27624,15 @@ SUBPARTITIONS 3
PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */
unified filelist
+t1#P#part1#SP#part1sp0.ibd
+t1#P#part1#SP#part1sp1.ibd
+t1#P#part1#SP#part1sp2.ibd
+t1#P#part2#SP#part2sp0.ibd
+t1#P#part2#SP#part2sp1.ibd
+t1#P#part2#SP#part2sp2.ibd
+t1#P#part3#SP#part3sp0.ibd
+t1#P#part3#SP#part3sp1.ibd
+t1#P#part3#SP#part3sp2.ibd
t1.frm
t1.par
@@ -27748,6 +28126,8 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
t1.frm
t1.par
@@ -28256,6 +28636,11 @@ t1 CREATE TABLE `t1` (
PARTITIONS 5 */
unified filelist
+t1#P#p0.ibd
+t1#P#p1.ibd
+t1#P#p2.ibd
+t1#P#p3.ibd
+t1#P#p4.ibd
t1.frm
t1.par
@@ -28779,6 +29164,14 @@ t1 CREATE TABLE `t1` (
PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */
unified filelist
+t1#P#part0.ibd
+t1#P#part1.ibd
+t1#P#part2.ibd
+t1#P#part3.ibd
+t1#P#part_1.ibd
+t1#P#part_2.ibd
+t1#P#part_3.ibd
+t1#P#part_N.ibd
t1.frm
t1.par
@@ -29298,6 +29691,12 @@ t1 CREATE TABLE `t1` (
PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta.ibd
+t1#P#partb.ibd
+t1#P#partc.ibd
+t1#P#partd.ibd
+t1#P#parte.ibd
+t1#P#partf.ibd
t1.frm
t1.par
@@ -29813,6 +30212,14 @@ SUBPARTITIONS 2
PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */
unified filelist
+t1#P#parta#SP#partasp0.ibd
+t1#P#parta#SP#partasp1.ibd
+t1#P#partb#SP#partbsp0.ibd
+t1#P#partb#SP#partbsp1.ibd
+t1#P#partc#SP#partcsp0.ibd
+t1#P#partc#SP#partcsp1.ibd
+t1#P#partd#SP#partdsp0.ibd
+t1#P#partd#SP#partdsp1.ibd
t1.frm
t1.par
@@ -30339,6 +30746,14 @@ SUBPARTITION BY KEY (f_int2)
SUBPARTITION subpart42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#subpart11.ibd
+t1#P#part1#SP#subpart12.ibd
+t1#P#part2#SP#subpart21.ibd
+t1#P#part2#SP#subpart22.ibd
+t1#P#part3#SP#subpart31.ibd
+t1#P#part3#SP#subpart32.ibd
+t1#P#part4#SP#subpart41.ibd
+t1#P#part4#SP#subpart42.ibd
t1.frm
t1.par
@@ -30865,6 +31280,14 @@ SUBPARTITION BY HASH (f_int2 + 1)
SUBPARTITION sp42 ENGINE = InnoDB)) */
unified filelist
+t1#P#part1#SP#sp11.ibd
+t1#P#part1#SP#sp12.ibd
+t1#P#part2#SP#sp21.ibd
+t1#P#part2#SP#sp22.ibd
+t1#P#part3#SP#sp31.ibd
+t1#P#part3#SP#sp32.ibd
+t1#P#part4#SP#sp41.ibd
+t1#P#part4#SP#sp42.ibd
t1.frm
t1.par
@@ -31381,6 +31804,15 @@ SUBPARTITIONS 3
PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */
unified filelist
+t1#P#part1#SP#part1sp0.ibd
+t1#P#part1#SP#part1sp1.ibd
+t1#P#part1#SP#part1sp2.ibd
+t1#P#part2#SP#part2sp0.ibd
+t1#P#part2#SP#part2sp1.ibd
+t1#P#part2#SP#part2sp2.ibd
+t1#P#part3#SP#part3sp0.ibd
+t1#P#part3#SP#part3sp1.ibd
+t1#P#part3#SP#part3sp2.ibd
t1.frm
t1.par
diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
index 73dc1178a54..55256894743 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@ -25,7 +25,7 @@ wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES
wait/synch/rwlock/sql/LOCK_sys_init_connect YES YES
wait/synch/rwlock/sql/LOCK_sys_init_slave YES YES
wait/synch/rwlock/sql/LOGGER::LOCK_logger YES YES
-wait/synch/rwlock/sql/MDL_context::waiting_for_lock YES YES
+wait/synch/rwlock/sql/MDL_context::LOCK_waiting_for YES YES
wait/synch/rwlock/sql/MDL_lock::rwlock YES YES
wait/synch/rwlock/sql/Query_cache_query::lock YES YES
wait/synch/rwlock/sql/THR_LOCK_servers YES YES
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index 3c0a4a58e08..00619595749 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -25,3 +25,5 @@ drop table test.ghost;
select * from performance_schema.FILE_INSTANCES
where file_name like "%ghost%";
FILE_NAME EVENT_NAME OPEN_COUNT
+select * from performance_schema.no_such_table;
+ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist
diff --git a/mysql-test/suite/perfschema/r/myisam_file_io.result b/mysql-test/suite/perfschema/r/myisam_file_io.result
index 66c37c7d6d8..5d710d9183d 100644
--- a/mysql-test/suite/perfschema/r/myisam_file_io.result
+++ b/mysql-test/suite/perfschema/r/myisam_file_io.result
@@ -4,6 +4,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
update performance_schema.SETUP_CONSUMERS
set enabled='YES';
truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+flush status;
drop table if exists test.no_index_tab;
create table test.no_index_tab ( a varchar(255), b int ) engine=myisam;
insert into no_index_tab set a = 'foo', b = 1;
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result
index 17b57ba2e46..2d0d82ef19c 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result
@@ -26,7 +26,7 @@ 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 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_table";
Tables_in_performance_schema (user_table)
@@ -57,7 +57,7 @@ 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 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_view";
Tables_in_performance_schema (user_view)
@@ -86,7 +86,7 @@ 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 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -115,7 +115,7 @@ 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 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -144,7 +144,7 @@ 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 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: 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/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result
index 06862009493..f2fe8c727b2 100644
--- a/mysql-test/suite/perfschema/r/query_cache.result
+++ b/mysql-test/suite/perfschema/r/query_cache.result
@@ -4,6 +4,7 @@ insert into t1 values (1), (2), (3);
SET GLOBAL query_cache_size=1355776;
flush query cache;
reset query cache;
+flush status;
select * from t1;
a
1
diff --git a/mysql-test/suite/perfschema/r/thread_cache.result b/mysql-test/suite/perfschema/r/thread_cache.result
new file mode 100644
index 00000000000..de4d19f9c64
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/thread_cache.result
@@ -0,0 +1,34 @@
+SET @saved_thread_cache_size = @@global.thread_cache_size;
+set global thread_cache_size = 0;
+show variables like "thread_cache_size";
+Variable_name Value
+thread_cache_size 0
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+set global thread_cache_size = 100;
+show variables like "thread_cache_size";
+Variable_name Value
+thread_cache_size 100
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+set global thread_cache_size = @saved_thread_cache_size;
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index 755648036ac..dfa865e8702 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 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
@@ -10,15 +10,14 @@
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA
# Miscelaneous
--source include/not_embedded.inc
--source include/have_perfschema.inc
---source include/not_var_link.inc
#
# Bug#45496 Performance schema: assertion fails in
@@ -77,3 +76,10 @@ drop table test.ghost;
select * from performance_schema.FILE_INSTANCES
where file_name like "%ghost%";
+#
+# Bug#52586 Misleading error message on attempt to access
+# a P_S table using a wrong name
+
+--error ER_NO_SUCH_TABLE
+select * from performance_schema.no_such_table;
+
diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.test b/mysql-test/suite/perfschema/t/myisam_file_io.test
index 53d2ea6dbe6..0861e8f4b74 100644
--- a/mysql-test/suite/perfschema/t/myisam_file_io.test
+++ b/mysql-test/suite/perfschema/t/myisam_file_io.test
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 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
@@ -10,8 +10,8 @@
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA
@@ -29,6 +29,9 @@ update performance_schema.SETUP_CONSUMERS
truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+# Reset lost counters to a known state
+flush status;
+
# Code to test
--disable_warnings
diff --git a/mysql-test/suite/perfschema/t/no_threads-master.opt b/mysql-test/suite/perfschema/t/no_threads-master.opt
index b15ab02821d..0dfb498094a 100644
--- a/mysql-test/suite/perfschema/t/no_threads-master.opt
+++ b/mysql-test/suite/perfschema/t/no_threads-master.opt
@@ -1 +1 @@
---one-thread --thread-handling=no-threads --loose-performance-schema-max-thread_instances=10
+--one-thread --thread-handling=no-threads --loose-performance-schema-max-thread_instances=10 --default-storage-engine=MyISAM --skip-innodb
diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test
index a50b3b99650..95f78d290ee 100644
--- a/mysql-test/suite/perfschema/t/query_cache.test
+++ b/mysql-test/suite/perfschema/t/query_cache.test
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 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
@@ -10,8 +10,8 @@
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA
@@ -33,6 +33,8 @@ SET GLOBAL query_cache_size=1355776;
flush query cache;
reset query cache;
+# Reset Qcache_* to a known state
+flush status;
select * from t1;
diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test
new file mode 100644
index 00000000000..8c3271ba406
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/thread_cache.test
@@ -0,0 +1,134 @@
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# Setup
+
+SET @saved_thread_cache_size = @@global.thread_cache_size;
+
+set global thread_cache_size = 0;
+
+show variables like "thread_cache_size";
+
+connect (con1, localhost, root, , );
+
+let $con1_ID=`select connection_id()`;
+
+let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ 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
+ where ID = connection_id()`;
+
+connection default;
+
+--disable_query_log
+eval select ($con2_ID - $con1_ID) into @id_increment;
+eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+# Expect 1, connection_id() is incremented for each new connection
+select @id_increment;
+# Expect 1, THREAD_ID is incremented for each new connection
+select @thread_id_increment;
+
+disconnect con2;
+
+connect (con3, localhost, root, , );
+
+let $con3_ID=`select connection_id()`;
+
+let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ where ID = connection_id()`;
+
+disconnect con3;
+disconnect con1;
+
+connection default;
+
+--disable_query_log
+eval select ($con3_ID - $con2_ID) into @id_increment;
+eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+select @id_increment;
+select @thread_id_increment;
+
+set global thread_cache_size = 100;
+
+show variables like "thread_cache_size";
+
+connect (con1, localhost, root, , );
+
+let $con1_ID=`select connection_id()`;
+
+let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ 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
+ where ID = connection_id()`;
+
+connection default;
+
+--disable_query_log
+eval select ($con2_ID - $con1_ID) into @id_increment;
+eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+select @id_increment;
+select @thread_id_increment;
+
+disconnect con2;
+
+connect (con3, localhost, root, , );
+
+let $con3_ID=`select connection_id()`;
+
+let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+ where ID = connection_id()`;
+
+disconnect con3;
+disconnect con1;
+
+connection default;
+
+--disable_query_log
+eval select ($con3_ID - $con2_ID) into @id_increment;
+eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+# When caching threads, the pthread that executed con2 was parked in the
+# cache on disconnect, and then picked up con3.
+
+# Still expect a new connection_id()
+select @id_increment;
+
+# And expect a new instrumentation: the THREAD_ID of old connections should not be reused.
+select @thread_id_increment;
+
+set global thread_cache_size = @saved_thread_cache_size;
+
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 1ed7e0116a2..a65ee7d208e 100644
--- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
+++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
@@ -72,8 +72,6 @@ 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_concurrency_error.result b/mysql-test/suite/rpl/r/rpl_concurrency_error.result
index 013f02c3a86..eb303c46f28 100644
--- a/mysql-test/suite/rpl/r/rpl_concurrency_error.result
+++ b/mysql-test/suite/rpl/r/rpl_concurrency_error.result
@@ -29,8 +29,6 @@ UPDATE t SET f = 'magenta 2' WHERE f = 'red';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t VALUES (5 + (2 * 10),"brown");
INSERT INTO n VALUES (now(),"brown");
-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.
COMMIT;
ROLLBACK;
Warnings:
@@ -58,8 +56,6 @@ UPDATE t SET f = 'dark blue 2' WHERE f = 'red';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t VALUES (6 + (2 * 10),"brown");
INSERT INTO n VALUES (now(),"brown");
-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.
COMMIT;
COMMIT;
show binlog events from <binlog_start>;
@@ -83,8 +79,6 @@ UPDATE t SET f = 'magenta 1' WHERE f = 'red';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t VALUES (5 + (1 * 10),"brown");
INSERT INTO n VALUES (now(),"brown");
-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.
COMMIT;
ROLLBACK;
Warnings:
@@ -110,8 +104,6 @@ UPDATE t SET f = 'dark blue 1' WHERE f = 'red';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t VALUES (6 + (1 * 10),"brown");
INSERT INTO n VALUES (now(),"brown");
-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.
COMMIT;
COMMIT;
show binlog events from <binlog_start>;
diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result
new file mode 100644
index 00000000000..69c20078531
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_current_user.result
@@ -0,0 +1,205 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+
+# On slave2
+# Connect slave2 to slave
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;,
+MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root';
+START SLAVE;
+
+# [On master]
+DROP VIEW IF EXISTS v_user;
+DROP VIEW IF EXISTS v_tables_priv;
+DROP VIEW IF EXISTS v_procs_priv;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS my_grant;
+DROP PROCEDURE IF EXISTS my_revoke;
+DROP FUNCTION IF EXISTS my_user;
+DROP EVENT IF EXISTS e1;
+CREATE TABLE t1(c1 char(100));
+CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
+CREATE PROCEDURE p1() SELECT 1;
+# bug48321_1-01234 has the max length(16) of user.
+GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
+
+# Make sure the max lengths of user and host
+# the user name is too lengh
+GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost';
+ERROR HY000: String '01234567890123456' is too long for user name (should be no longer than 16)
+# the host name is too lengh
+GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890';
+ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60)
+
+# User 'bug48321_1-01234' connects to master by conn1
+# [On conn1]
+# Verify 'REVOKE ALL' statement
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER();
+Comparing tables master:test.v_user and slave:test.v_user
+Comparing tables master:test.v_user and slave2:test.v_user
+
+# Verify 'GRANT ... ON TABLE ...' statement
+GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
+Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
+Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
+
+# Verify 'GRANT ... ON PROCEDURE...' statement
+GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER();
+Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
+Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
+
+# Verify 'GRANT ... ON *.* ...' statement
+GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION;
+Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
+Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
+
+# Verify 'REVOKE ... ON TABLE ...' statement
+REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
+Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
+Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
+
+# Verify 'REVOKE ... ON PROCEDURE...' statement
+REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER();
+Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
+Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
+
+# Verify 'REVOKE ... ON *.* ...' statement
+REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER();
+Comparing tables master:test.v_user and slave:test.v_user
+Comparing tables master:test.v_user and slave2:test.v_user
+
+# Verify 'GRANT ...' statement in the procedure
+CREATE PROCEDURE my_grant()
+GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
+call my_grant;
+Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
+Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
+
+# Verify 'REVOKE ... ON TABLE ...' statement in the procedure
+CREATE PROCEDURE my_revoke()
+REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
+call my_revoke;
+Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
+Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
+
+# Verify 'RENAME USER ...' statement
+RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost';
+Comparing tables master:test.v_user and slave:test.v_user
+Comparing tables master:test.v_user and slave2:test.v_user
+
+# Verify 'DROP USER ...' statement
+GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost';
+DROP USER CURRENT_USER();
+Comparing tables master:test.v_user and slave:test.v_user
+Comparing tables master:test.v_user and slave2:test.v_user
+
+# Verify 'ALTER EVENT...' statement
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
+# Explicitly assign CURRENT_USER() to definer
+ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
+Comparing tables master:test.v_event and slave:test.v_event
+Comparing tables master:test.v_event and slave2:test.v_event
+
+# Session user will be set as definer, if the statement does not assign
+# a definer
+ALTER EVENT e1 ENABLE;
+Comparing tables master:test.v_event and slave:test.v_event
+Comparing tables master:test.v_event and slave2:test.v_event
+
+# Verify that this patch does not affect the calling of CURRENT_USER()
+# in the other statements
+# [On master]
+INSERT INTO t1 VALUES(CURRENT_USER()), ('1234');
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SELECT * FROM t1;
+c1
+root@localhost
+1234
+# [On slave]
+SELECT * FROM t1;
+c1
+@
+1234
+# [On slave2]
+SELECT * FROM t1;
+c1
+@
+1234
+# [On master]
+UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234';
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SELECT * FROM t1;
+c1
+root@localhost
+root@localhost
+# [On slave]
+SELECT * FROM t1;
+c1
+@
+@
+# [On slave2]
+SELECT * FROM t1;
+c1
+@
+@
+# [On master]
+DELETE FROM t1 WHERE c1=CURRENT_USER();
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SELECT * FROM t1;
+c1
+# [On slave]
+SELECT * FROM t1;
+c1
+# [On slave2]
+SELECT * FROM t1;
+c1
+# [On master]
+CREATE TABLE t2(c1 char(100));
+CREATE FUNCTION my_user() RETURNS VARCHAR(64)
+SQL SECURITY INVOKER
+BEGIN
+INSERT INTO t2 VALUES(CURRENT_USER());
+RETURN CURRENT_USER();
+END |
+INSERT INTO t1 VALUES(my_user());
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SELECT * FROM t1;
+c1
+root@localhost
+SELECT * FROM t2;
+c1
+root@localhost
+# [On slave]
+SELECT * FROM t1;
+c1
+@
+SELECT * FROM t2;
+c1
+@
+# [On slave2]
+SELECT * FROM t1;
+c1
+@
+SELECT * FROM t2;
+c1
+@
+
+# END
+DROP TABLE t1, t2;
+DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event;
+DROP PROCEDURE p1;
+DROP PROCEDURE my_grant;
+DROP PROCEDURE my_revoke;
+DROP FUNCTION my_user;
+DROP EVENT e1;
diff --git a/mysql-test/suite/rpl/r/rpl_drop_temp.result b/mysql-test/suite/rpl/r/rpl_drop_temp.result
index 03fbaa2256f..726b8f2fe54 100644
--- a/mysql-test/suite/rpl/r/rpl_drop_temp.result
+++ b/mysql-test/suite/rpl/r/rpl_drop_temp.result
@@ -26,3 +26,24 @@ CREATE TEMPORARY TABLE tmp3 (a int);
DROP TEMPORARY TABLE tmp3;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 ( i INT );
+SHOW STATUS LIKE 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
+CREATE TEMPORARY TABLE ttmp1 ( i INT );
+SET SESSION binlog_format=ROW;
+SHOW STATUS LIKE 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
+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 ( i INT )
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE ttmp1 ( i INT )
+master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index dd0a2d89d54..daef153cdef 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -750,7 +750,7 @@ test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat
USE test_rpl;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
-test_rpl e2 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
==========MASTER==========
SELECT COUNT(*) FROM t1;
COUNT(*)
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
index 3ebe54df9dc..1ad34fbe961 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
@@ -19,7 +19,7 @@ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE SQL_THREAD;
*** Single statement on both transactional and non-transactional tables. ***
Got one of the listed errors
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE SQL_THREAD;
source include/diff_master_slave.inc;
########################################################################################
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
new file mode 100644
index 00000000000..c752e836ebb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
@@ -0,0 +1,1513 @@
+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;
+#########################################################################
+# CONFIGURATION
+#########################################################################
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+SET @commands= 'configure';
+CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb;
+CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
+Warnings:
+Note 1051 Unknown table 'nt_tmp_2'
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
+Warnings:
+Note 1051 Unknown table 'nt_tmp_1'
+CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
+Warnings:
+Note 1051 Unknown table 'tt_tmp_2'
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
+Warnings:
+Note 1051 Unknown table 'tt_tmp_1'
+CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS nt_2;
+Warnings:
+Note 1051 Unknown table 'nt_2'
+CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS nt_1;
+Warnings:
+Note 1051 Unknown table 'nt_1'
+CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS tt_2;
+Warnings:
+Note 1051 Unknown table 'tt_2'
+CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb;
+SET @commands= '';
+#########################################################################
+# 1 - Tables dropped by "DROP TEMPORARY TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-T-Temp';
+DROP TEMPORARY TABLE tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-Xe-Temp';
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-Xe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TXe-Temp';
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-TXe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-NXe-Temp';
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-NXe-Temp';
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TN-Temp';
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TT-Temp';
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-NN-Temp';
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ERROR 42S02: Unknown table 'nt_tmp_2'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ERROR 42S02: Unknown table 'nt_tmp_2'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 2 - Tables dropped by "DROP TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-T';
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-N';
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Xe';
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-Xe';
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TXe';
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-TXe';
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-NXe';
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-NXe';
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TN';
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TT';
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-NN';
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-N-TN-Temp';
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TN-Temp';
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-T';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-N';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-TXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-NXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-NXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TN';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TT';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-NN';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-N-TN-Temp';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TN-Temp';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 3 - CREATE TEMPORARY TABLE
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 4 - CHANGING TEMPORARY TABLES
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+###################################################################################
+# CHECK CONSISTENCY
+###################################################################################
+#########################################################################
+# CLEAN
+#########################################################################
+SET @commands= 'clean';
+DROP TABLE IF EXISTS tt_xx_1;
+DROP TABLE IF EXISTS nt_xx_1;
+DROP TABLE IF EXISTS nt_2;
+DROP TABLE IF EXISTS nt_1;
+DROP TABLE IF EXISTS tt_2;
+DROP TABLE IF EXISTS tt_1;
+SET @commands= '';
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
index e7e4e1b8aa4..f3a0254f6a4 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
@@ -393,15 +393,13 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
@@ -409,15 +407,13 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
@@ -425,23 +421,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_3)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_3)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
@@ -449,23 +435,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -473,35 +449,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1));
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_5)
-master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-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 # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_5)
-master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-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 # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -509,23 +463,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_4)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_4)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e-
@@ -533,23 +477,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -557,35 +491,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1));
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_5)
-master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_5)
-master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -604,15 +516,13 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> tNe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
@@ -630,16 +540,14 @@ INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1);
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1)
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NeT-trig << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1)
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -647,20 +555,14 @@ INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1))
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1))
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -668,16 +570,14 @@ INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1);
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1)
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1)
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -685,24 +585,14 @@ INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1))
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1))
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -3711,8 +3601,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -3725,8 +3614,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (133, 2)
@@ -3745,10 +3633,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -3761,10 +3646,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T N-trig C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (134, 2)
@@ -3785,12 +3667,7 @@ fc_i_nt_5_suc (135, 4)
fc_i_nt_5_suc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(135,4)
master-bin.000001 # Query # # COMMIT
-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-
@@ -3803,12 +3680,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T N-func C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(135,4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (135, 2)
@@ -3827,16 +3699,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (136, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-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-
@@ -3849,16 +3715,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T N-proc C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (136, 2)
@@ -3877,8 +3737,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -3891,8 +3750,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (137, 2)
@@ -3911,10 +3769,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -3927,10 +3782,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-trig C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (138, 2)
@@ -3951,12 +3803,7 @@ fc_i_nt_5_suc (139, 4)
fc_i_nt_5_suc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(139,4)
master-bin.000001 # Query # # COMMIT
-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-
@@ -3969,12 +3816,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-func C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(139,4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (139, 2)
@@ -3993,16 +3835,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (140, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4015,16 +3851,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-proc C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (140, 2)
@@ -4045,8 +3875,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4059,8 +3888,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(141,2)
@@ -4081,10 +3909,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4097,10 +3922,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-trig C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(142,2)
@@ -4123,12 +3945,7 @@ fc_i_nt_5_suc (143, 4)
fc_i_nt_5_suc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(143,4)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4141,12 +3958,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-func C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(143,4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(143,2)
@@ -4167,16 +3979,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (144, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4189,16 +3995,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-proc C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(144,2)
@@ -4217,8 +4017,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4232,8 +4031,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',145), NAME_CONST('in_stmt_id',1))
@@ -4253,10 +4051,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4270,10 +4065,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-trig C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',146), NAME_CONST('in_stmt_id',1))
@@ -4295,12 +4087,7 @@ fc_i_nt_5_suc (147, 4)
fc_i_nt_5_suc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(147,4)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4314,12 +4101,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-func C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(147,4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',147), NAME_CONST('in_stmt_id',1))
@@ -4339,16 +4121,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (148, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4362,16 +4138,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-proc C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148), NAME_CONST('in_stmt_id',1))
@@ -4487,8 +4257,7 @@ INSERT INTO nt_1(trans_id, stmt_id) VALUES (152, 4), (150, 4);
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (152, 4), (150, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> Ne << -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-
@@ -4501,8 +4270,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T Ne C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (152, 4), (150, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (152, 2)
@@ -4531,8 +4299,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4544,8 +4311,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4561,10 +4327,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4576,10 +4339,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T N-trig R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T N-trig R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4597,12 +4357,7 @@ fc_i_nt_5_suc (155, 4)
fc_i_nt_5_suc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(155,4)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4614,12 +4369,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T N-func R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(155,4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T N-func R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4635,16 +4385,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (156, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4656,16 +4400,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T N-proc R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T N-proc R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4681,8 +4419,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4694,8 +4431,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4711,10 +4447,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4726,10 +4459,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-trig R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-trig R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4747,12 +4477,7 @@ fc_i_nt_5_suc (159, 4)
fc_i_nt_5_suc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(159,4)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4764,12 +4489,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-func R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(159,4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-func R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4785,16 +4505,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (160, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4806,16 +4520,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-proc R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-proc R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4833,8 +4541,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4846,8 +4553,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-func N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4865,10 +4571,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4880,10 +4583,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-trig R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-trig R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4903,12 +4603,7 @@ fc_i_nt_5_suc (163, 4)
fc_i_nt_5_suc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(163,4)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4920,12 +4615,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-func R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(163,4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-func R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4943,16 +4633,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (164, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-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-
@@ -4964,16 +4648,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-proc R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-proc R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -4989,8 +4667,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -5002,8 +4679,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -5019,10 +4695,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -5034,10 +4707,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-trig R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-trig R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -5055,12 +4725,7 @@ fc_i_nt_5_suc (167, 4)
fc_i_nt_5_suc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(167,4)
master-bin.000001 # Query # # COMMIT
-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-
@@ -5072,12 +4737,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-func R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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 # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(167,4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-func R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -5093,16 +4753,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (168, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-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-
@@ -5114,16 +4768,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-proc R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168), NAME_CONST('in_stmt_id',1))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168), NAME_CONST('in_stmt_id',1) + 1)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-proc R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -5233,8 +4881,7 @@ INSERT INTO nt_1(trans_id, stmt_id) VALUES (172, 4), (170, 4);
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (172, 4), (170, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> Ne << -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-
@@ -5246,8 +4893,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B T Ne R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (172, 4), (170, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B T Ne R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -5673,16 +5319,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (185, 2);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -5699,16 +5339,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (185, 4)
@@ -5723,16 +5357,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (186, 2);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-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- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -5749,16 +5377,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (186, 4)
@@ -5773,16 +5395,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (187, 2);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-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- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -5801,16 +5417,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-func C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(187,4)
@@ -5825,16 +5435,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (188, 2);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-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- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
@@ -5852,16 +5456,10 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188), NAME_CONST('in_stmt_id',1))
@@ -6237,16 +5835,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (201, 2);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6262,16 +5854,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -6283,16 +5869,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (202, 2);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-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- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6308,16 +5888,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-proc R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-proc R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -6329,16 +5903,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (203, 2);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-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- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6354,16 +5922,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-trig R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-trig R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -6375,16 +5937,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
CALL pc_i_nt_5_suc (204, 2);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-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- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6402,16 +5958,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-func R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+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) + 1)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-func R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -6434,8 +5984,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6452,8 +6001,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B tN T C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (205, 4)
@@ -6762,8 +6310,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6780,8 +6327,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B tNe T C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (213, 4)
@@ -6986,8 +6532,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -7003,8 +6548,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tN T R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B tN T R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -7240,8 +6784,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -7257,8 +6800,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tNe T R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B tNe T R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -8439,8 +7981,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -8457,8 +7998,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tN N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (261, 4)
@@ -8477,8 +8017,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8492,8 +8031,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B nT N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
@@ -8517,8 +8055,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8536,8 +8073,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_3)
master-bin.000001 # Update_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.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_3)
@@ -8561,8 +8097,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8580,8 +8115,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_4)
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.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_4)
@@ -8607,8 +8141,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8632,8 +8165,7 @@ master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
@@ -8661,8 +8193,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8680,8 +8211,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_4)
master-bin.000001 # Update_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.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_4)
@@ -8705,8 +8235,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8724,8 +8253,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_3)
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.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_3)
@@ -8753,8 +8281,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8778,8 +8305,7 @@ master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_5)
@@ -8810,8 +8336,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -8828,8 +8353,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tNe N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (269, 4)
@@ -9035,8 +8559,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9055,8 +8578,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tN N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (275, 4)
@@ -9075,8 +8597,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9088,8 +8609,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B nT N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B nT N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9109,8 +8629,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9126,8 +8645,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_3)
master-bin.000001 # Update_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.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B NT N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9147,8 +8665,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9164,8 +8681,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_4)
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.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B NT-trig N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9187,8 +8703,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9206,8 +8721,7 @@ master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B NT-func N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9227,8 +8741,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9244,8 +8757,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_4)
master-bin.000001 # Update_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.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B TN N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9265,8 +8777,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9282,8 +8793,7 @@ master-bin.000001 # Table_map # # table_id: # (test.nt_3)
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.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B TN-trig N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9307,8 +8817,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9328,8 +8837,7 @@ master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B TN-func N R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9354,8 +8862,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9374,8 +8881,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tNe N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (283, 4)
@@ -9597,8 +9103,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9611,8 +9116,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (289, 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N tN C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9953,8 +9457,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9967,8 +9470,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (297, 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N tNe C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10177,8 +9679,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10193,8 +9694,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (303, 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N tN R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10481,8 +9981,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10497,8 +9996,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (311, 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N tNe R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10792,8 +10290,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> S1 << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10823,8 +10320,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2)
@@ -10850,8 +10346,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5)
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10877,8 +10372,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2)
@@ -11931,8 +11425,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11956,8 +11449,7 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> B tN CT T R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_14 (a int) engine=Innodb
diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
index e7e4e1b8aa4..0a1a776d37c 100644
--- a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
@@ -393,15 +393,13 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
@@ -409,15 +407,13 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
@@ -425,23 +421,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_3)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_3)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
@@ -449,23 +435,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -473,35 +449,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1));
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_5)
-master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-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 # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_5)
-master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-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 # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -509,23 +463,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_4)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_4)
-master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e-
@@ -533,23 +477,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1);
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
@@ -557,35 +491,13 @@ master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1));
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_5)
-master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.tt_5)
-master-bin.000001 # Table_map # # table_id: # (test.tt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
master-bin.000001 # Xid # # COMMIT /* XID */
-e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -604,15 +516,13 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> tNe << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
@@ -630,16 +540,14 @@ INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1);
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1)
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NeT-trig << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_4)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1)
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -647,20 +555,14 @@ INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1))
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1))
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -668,16 +570,14 @@ INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1);
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1)
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_3)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1)
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -685,24 +585,14 @@ INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1))
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_5)
-master-bin.000001 # Table_map # # table_id: # (test.nt_6)
-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
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1))
+master-bin.000001 # Query # # ROLLBACK
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
@@ -6434,8 +6324,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6452,8 +6341,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B tN T C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (205, 4)
@@ -6762,8 +6650,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6780,8 +6667,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> B tNe T C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (213, 4)
@@ -6986,8 +6872,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -7003,8 +6888,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tN T R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B tN T R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -7240,8 +7124,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -7257,8 +7140,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tNe T R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B tNe T R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -8439,8 +8321,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -8457,8 +8338,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tN N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (261, 4)
@@ -8810,8 +8690,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -8828,8 +8707,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tNe N C << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (269, 4)
@@ -9035,8 +8913,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9055,8 +8932,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tN N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (275, 4)
@@ -9354,8 +9230,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9374,8 +9249,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
-b-b-b-b-b-b-b-b-b-b-b- >> B tNe N R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (283, 4)
@@ -9597,8 +9471,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9611,8 +9484,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (289, 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N tN C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -9953,8 +9825,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9967,8 +9838,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (297, 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N tNe C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10177,8 +10047,7 @@ master-bin.000001 # Query # # COMMIT
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10193,8 +10062,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (303, 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N tN R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10481,8 +10349,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNIO
Got one of the listed errors
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10497,8 +10364,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (311, 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> B N tNe R << -e-e-e-e-e-e-e-e-e-e-e-
@@ -11931,8 +11797,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11956,8 +11821,7 @@ master-bin.000001 # Query # # ROLLBACK
-b-b-b-b-b-b-b-b-b-b-b- >> B tN CT T R << -b-b-b-b-b-b-b-b-b-b-b-
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.nt_1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_14 (a int) engine=Innodb
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 ab02432b0d4..7c1ef59d9bd 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
@@ -391,8 +391,6 @@ master-bin.000001 # Query # # COMMIT
#
-b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1
@@ -407,8 +405,6 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
@@ -423,8 +419,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b-
UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
@@ -439,8 +433,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1);
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
@@ -455,8 +447,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1));
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
@@ -471,8 +461,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b-
UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
@@ -487,8 +475,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1);
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
@@ -503,8 +489,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1));
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
@@ -6076,8 +6060,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1
@@ -6518,8 +6500,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1
@@ -7845,8 +7825,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1
@@ -8311,8 +8289,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1
@@ -8811,8 +8787,6 @@ master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1
@@ -9297,8 +9271,6 @@ master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1
@@ -10557,7 +10529,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
@@ -10966,8 +10937,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1
diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
index 6f98c25c335..90ccae5d738 100644
--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result
+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
@@ -24,7 +24,8 @@ a
1
[on slave]
---- Wait until slave stops with an error ----
-Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 347 (expected "duplicate key" error)
+Last_SQL_Error (expected "duplicate key" error)
+Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos END_LOG_POS
SELECT * FROM t1;
a
1
diff --git a/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
new file mode 100644
index 00000000000..fa9412de67e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
@@ -0,0 +1,1539 @@
+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;
+#########################################################################
+# CONFIGURATION
+#########################################################################
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+SET @commands= 'configure';
+CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb;
+CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
+Warnings:
+Note 1051 Unknown table 'nt_tmp_2'
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
+Warnings:
+Note 1051 Unknown table 'nt_tmp_1'
+CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
+Warnings:
+Note 1051 Unknown table 'tt_tmp_2'
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
+Warnings:
+Note 1051 Unknown table 'tt_tmp_1'
+CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS nt_2;
+Warnings:
+Note 1051 Unknown table 'nt_2'
+CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS nt_1;
+Warnings:
+Note 1051 Unknown table 'nt_1'
+CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS tt_2;
+Warnings:
+Note 1051 Unknown table 'tt_2'
+CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb;
+SET @commands= '';
+#########################################################################
+# 1 - Tables dropped by "DROP TEMPORARY TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-T-Temp';
+DROP TEMPORARY TABLE tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-Xe-Temp';
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-Xe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TXe-Temp';
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-TXe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-NXe-Temp';
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-NXe-Temp';
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TN-Temp';
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TT-Temp';
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-NN-Temp';
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ERROR 42S02: Unknown table 'nt_tmp_2'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ERROR 42S02: Unknown table 'nt_tmp_2'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 2 - Tables dropped by "DROP TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-T';
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-N';
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Xe';
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-Xe';
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TXe';
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-TXe';
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-NXe';
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-NXe';
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TN';
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TT';
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-NN';
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-N-TN-Temp';
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TN-Temp';
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-T';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-N';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-TXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-NXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-NXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TN';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TT';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-NN';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-N-TN-Temp';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE `nt_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TN-Temp';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 3 - CREATE TEMPORARY TABLE
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 4 - CHANGING TEMPORARY TABLES
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_xx_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+###################################################################################
+# CHECK CONSISTENCY
+###################################################################################
+#########################################################################
+# CLEAN
+#########################################################################
+SET @commands= 'clean';
+DROP TABLE IF EXISTS tt_xx_1;
+DROP TABLE IF EXISTS nt_xx_1;
+DROP TABLE IF EXISTS nt_2;
+DROP TABLE IF EXISTS nt_1;
+DROP TABLE IF EXISTS tt_2;
+DROP TABLE IF EXISTS tt_1;
+SET @commands= '';
diff --git a/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result b/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result
index abeb92a7d21..cb095ad561e 100644
--- a/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result
+++ b/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result
@@ -7,11 +7,11 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (c1 char(50))
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Xid # # COMMIT /* XID */
DROP TABLE t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
diff --git a/mysql-test/suite/rpl/r/rpl_savepoint.result b/mysql-test/suite/rpl/r/rpl_savepoint.result
new file mode 100644
index 00000000000..e1462f435a3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_savepoint.result
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+#
+# Bug#50124 Rpl failure on DROP table with concurrent txn/non-txn
+# DML flow and SAVEPOINT
+#
+# Connection master
+DROP TABLE IF EXISTS tt, nt;
+CREATE TABLE tt (i INT) ENGINE = InnoDB;
+CREATE TABLE nt (i INT) ENGINE = MyISAM;
+FLUSH LOGS;
+START TRANSACTION;
+INSERT INTO nt VALUES (1);
+SAVEPOINT insert_statement;
+INSERT INTO tt VALUES (1);
+# Connection master1
+# Sending:
+DROP TABLE tt;
+# Connection master
+ROLLBACK TO SAVEPOINT insert_statement;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+COMMIT;
+# Connection master1
+# Reaping: DROP TABLE tt
+FLUSH LOGS;
+# Connection master
+DROP TABLE nt;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result
index d6513d838c3..5feba69b64d 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_skip.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result
@@ -8,15 +8,15 @@ start slave;
STOP SLAVE;
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
-CREATE TABLE t1 (a INT, b INT);
-CREATE TABLE t2 (c INT, d INT);
+CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
UPDATE t1,t2 SET b = d, d = b * 2 WHERE a = c;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT)
-master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (c INT, d INT)
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 0af76e93ab4..42f7a9c7ed8 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -1215,18 +1215,23 @@ lock table t2 write;
# Sending 'insert into t1 (a) values (f1())'...
insert into t1 (a) values (f1());
# Waitng for 'insert into t1 ...' to get blocked on table lock...
-# Sending 'drop function f1'. It will abort the table lock wait.
-drop function f1;
+# Sending 'drop function f1'. It will wait till insert finishes.
+drop function f1;;
# --> connection default
+# Check that 'drop function f1' gets blocked.
# Now let's let 'insert' go through...
unlock tables;
-# --> connection con1
+# --> connection master
# Reaping 'insert into t1 (a) values (f1())'...
-ERROR 42000: FUNCTION test.f1 does not exist
+# --> connection master1
+# Reaping 'drop function f1'
+# --> connection master
select * from t1;
a
+1
select * from t1;
a
+1
drop table t1, t2;
drop function f1;
ERROR 42000: FUNCTION test.f1 does not exist
diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
index bec91a96194..1ad34fbe961 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
@@ -32,18 +32,12 @@ BEGIN;
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
-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.
BEGIN;
Got one of the listed errors
Got one of the listed errors
-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.
BEGIN;
Got one of the listed errors
Got one of the listed errors
-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.
source include/diff_master_slave.inc;
########################################################################################
# 3 - BEGIN - COMMIT
@@ -55,8 +49,6 @@ BEGIN;
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
-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.
COMMIT;
source include/diff_master_slave.inc;
########################################################################################
@@ -69,8 +61,6 @@ BEGIN;
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
-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;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@@ -109,8 +99,6 @@ BEGIN;
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
-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 TO sv;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@@ -123,19 +111,11 @@ TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
TRUNCATE TABLE t3;
BEGIN;
-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.
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
-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.
-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.
COMMIT;
BEGIN;
-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.
Got one of the listed errors
COMMIT;
source include/diff_master_slave.inc;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result
index b0df9516b7c..6d9759b3562 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result
@@ -19,7 +19,8 @@ a
1
[on slave]
---- Wait until slave stops with an error ----
-Last_SQL_Error = Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' (expected "duplicate key" error)
+Last_SQL_Error (expected "duplicate key" error)
+Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)'
SELECT * FROM t1;
a
1
diff --git a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
new file mode 100644
index 00000000000..c752e836ebb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
@@ -0,0 +1,1513 @@
+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;
+#########################################################################
+# CONFIGURATION
+#########################################################################
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+SET @commands= 'configure';
+CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb;
+CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
+Warnings:
+Note 1051 Unknown table 'nt_tmp_2'
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
+Warnings:
+Note 1051 Unknown table 'nt_tmp_1'
+CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
+Warnings:
+Note 1051 Unknown table 'tt_tmp_2'
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
+Warnings:
+Note 1051 Unknown table 'tt_tmp_1'
+CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS nt_2;
+Warnings:
+Note 1051 Unknown table 'nt_2'
+CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS nt_1;
+Warnings:
+Note 1051 Unknown table 'nt_1'
+CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS tt_2;
+Warnings:
+Note 1051 Unknown table 'tt_2'
+CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb;
+SET @commands= '';
+#########################################################################
+# 1 - Tables dropped by "DROP TEMPORARY TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-T-Temp';
+DROP TEMPORARY TABLE tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-Xe-Temp';
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-Xe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TXe-Temp';
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-TXe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-NXe-Temp';
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-NXe-Temp';
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TN-Temp';
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-TT-Temp';
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-NN-Temp';
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ERROR 42S02: Unknown table 'nt_tmp_2'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note 1051 Unknown table 'tt_xx_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note 1051 Unknown table 'tt_1'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ERROR 42S02: Unknown table 'nt_tmp_2'
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 2 - Tables dropped by "DROP TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-T';
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-N';
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Xe';
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-Xe';
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TXe';
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-TXe';
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-NXe';
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-NXe';
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TN';
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TT';
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-NN';
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-N-TN-Temp';
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-TN-Temp';
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-T';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-N';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-TXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-NXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-NXe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note 1051 Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TN';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TT';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_1, tt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-NN';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE nt_1, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-N-TN-Temp';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-TN-Temp';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 3 - CREATE TEMPORARY TABLE
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+#########################################################################
+# 4 - CHANGING TEMPORARY TABLES
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001 # Query # # ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+###################################################################################
+# CHECK CONSISTENCY
+###################################################################################
+#########################################################################
+# CLEAN
+#########################################################################
+SET @commands= 'clean';
+DROP TABLE IF EXISTS tt_xx_1;
+DROP TABLE IF EXISTS nt_xx_1;
+DROP TABLE IF EXISTS nt_2;
+DROP TABLE IF EXISTS nt_1;
+DROP TABLE IF EXISTS tt_2;
+DROP TABLE IF EXISTS tt_1;
+SET @commands= '';
diff --git a/mysql-test/suite/rpl/r/rpl_stm_innodb.result b/mysql-test/suite/rpl/r/rpl_stm_innodb.result
index 825238c66fe..f99457faaf0 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_innodb.result
@@ -66,7 +66,7 @@ SHOW CREATE TABLE mysqltest1.tmp2;
Table Create Table
tmp2 CREATE TEMPORARY TABLE `tmp2` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
######### Must return no rows here #########
SELECT COUNT(*) FROM mysqltest1.t1;
COUNT(*)
diff --git a/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result b/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
index e204d67181a..417da0e2237 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
@@ -1,10 +1,10 @@
RESET MASTER;
-CREATE TABLE t1 (c1 char(50));
+CREATE TABLE t1 (c1 char(50)) ENGINE=MyISAM;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (c1 char(50))
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (c1 char(50)) ENGINE=MyISAM
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`c1`) ;file_id=#
diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
index a5219662881..300932b7b8d 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
@@ -391,8 +391,6 @@ master-bin.000001 # Query # # COMMIT
#
-b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1
@@ -407,8 +405,6 @@ master-bin.000001 # Query # # COMMIT
-b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
@@ -423,8 +419,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b-
UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
@@ -439,8 +433,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1);
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
@@ -455,8 +447,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1));
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
@@ -471,8 +461,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b-
UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
@@ -487,8 +475,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1);
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
@@ -503,8 +489,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
-b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1));
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
@@ -3615,8 +3599,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4)
@@ -3649,8 +3631,6 @@ 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-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4)
@@ -3755,8 +3735,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4)
@@ -3789,8 +3767,6 @@ 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-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4)
@@ -3897,8 +3873,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4)
@@ -3933,8 +3907,6 @@ 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-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4)
@@ -4043,8 +4015,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4)
@@ -4079,8 +4049,6 @@ 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-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4)
@@ -4329,8 +4297,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4)
@@ -4365,8 +4331,6 @@ 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-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4)
@@ -4477,8 +4441,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4)
@@ -4513,8 +4475,6 @@ 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-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4)
@@ -4627,8 +4587,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4)
@@ -4665,8 +4623,6 @@ 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-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4)
@@ -4781,8 +4737,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4)
@@ -4819,8 +4773,6 @@ 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-trig << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4)
@@ -6244,8 +6196,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1
@@ -6686,8 +6636,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1
@@ -8029,8 +7977,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1
@@ -8069,8 +8015,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4)
@@ -8105,8 +8049,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4)
@@ -8141,8 +8083,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4)
@@ -8177,8 +8117,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4)
@@ -8213,8 +8151,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4)
@@ -8249,8 +8185,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4)
@@ -8285,8 +8219,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4)
@@ -8392,8 +8324,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (271, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (271, 4)
@@ -8427,8 +8357,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (272, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (272, 4)
@@ -8462,8 +8390,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (273, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (273, 4)
@@ -8497,8 +8423,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (274, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (274, 4)
@@ -8539,8 +8463,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1
@@ -8581,8 +8503,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4)
@@ -8619,8 +8539,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4)
@@ -8657,8 +8575,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4)
@@ -8695,8 +8611,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4)
@@ -8733,8 +8647,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4)
@@ -8771,8 +8683,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4)
@@ -8809,8 +8719,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4)
@@ -8922,8 +8830,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (285, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (285, 4)
@@ -8959,8 +8865,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (286, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (286, 4)
@@ -8996,8 +8900,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (287, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (287, 4)
@@ -9033,8 +8935,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (288, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (288, 4)
@@ -9083,8 +8983,6 @@ master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1
@@ -9569,8 +9467,6 @@ master-bin.000001 # Query # # COMMIT
-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1
@@ -10158,8 +10054,6 @@ 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 << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 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
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4)
@@ -10216,8 +10110,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
-e-e-e-e-e-e-e-e-e-e-e- >> S1 << -e-e-e-e-e-e-e-e-e-e-e-
-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5);
-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_1(trans_id, stmt_id) VALUES (320, 5)
@@ -10845,7 +10737,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
@@ -10949,7 +10840,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
INSERT INTO nt_xx_10(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement 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_xx_10(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1
@@ -11262,8 +11152,6 @@ 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- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1
diff --git a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
index 96829a1b1ec..eb1d6689bfc 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
@@ -52,8 +52,6 @@ include/start_slave.inc
set @@global.debug="+d,stop_slave_middle_group";
set @@global.debug="+d,incomplete_group_in_relay_log";
update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
Last_SQL_Error true
Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
index 118d31d78c8..36e06d1edd1 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -96,7 +96,7 @@ Note 1051 Unknown table 't1'
flush logs;
stop slave;
reset slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; /* to stop right before DROP */;
show tables /* t1 must exist */;
Tables_in_test
t1
diff --git a/mysql-test/suite/rpl/r/rpl_temp_temporary.result b/mysql-test/suite/rpl/r/rpl_temp_temporary.result
deleted file mode 100644
index 3911bd8a773..00000000000
--- a/mysql-test/suite/rpl/r/rpl_temp_temporary.result
+++ /dev/null
@@ -1,240 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-########################################################################
-# VERIFY ITEMS 1 and 2
-########################################################################
-#
-# Create temporary tables to verify when statements involving temporary
-# tables are classified as safe or unsafe by printing out the warning
-# messages.
-#
-CREATE TABLE t_myisam(id int) engine= MyIsam;
-INSERT INTO t_myisam VALUES(1);
-CREATE TABLE t_innodb(id int) engine= Innodb;
-INSERT INTO t_innodb VALUES(1);
-CREATE TEMPORARY TABLE t_myisam_temp(id int) engine= MyIsam;
-INSERT INTO t_myisam_temp VALUES(1);
-CREATE TEMPORARY TABLE t_innodb_temp(id int) engine= Innodb;
-INSERT INTO t_innodb_temp VALUES(1);
-BEGIN;
-INSERT INTO t_myisam SELECT * FROM t_myisam_temp;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
-INSERT INTO t_innodb SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_innodb_temp;
-ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-BEGIN;
-INSERT INTO t_myisam SELECT * FROM t_innodb_temp;
-Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
-INSERT INTO t_innodb SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_innodb_temp;
-ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-########################################################################
-# VERIFY ITEM 3
-########################################################################
-#
-# When there is a temporary table we can switch between the mixed and
-# row formats. However, we cannot switch to the statement format.
-#
-SET BINLOG_FORMAT=MIXED;
-SET BINLOG_FORMAT=ROW;
-SET BINLOG_FORMAT=MIXED;
-SET BINLOG_FORMAT=STATEMENT;
-ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
-#
-# When there is a temporary table we can switch between the mixed and
-# row formats. However, we cannot swith to the statement format.
-#
-SET BINLOG_FORMAT=MIXED;
-DROP TABLE t_myisam_temp, t_innodb_temp, t_myisam, t_innodb;
-show binlog events from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam SELECT * FROM t_myisam_temp
-master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_myisam_temp
-master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_innodb_temp
-master-bin.000001 # Query # # ROLLBACK
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam SELECT * FROM t_innodb_temp
-master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_myisam_temp
-master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb SELECT * FROM t_innodb_temp
-master-bin.000001 # Query # # ROLLBACK
-master-bin.000001 # Query # # use `test`; DROP TABLE `t_myisam`,`t_innodb` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t_myisam_temp`,`t_innodb_temp` /* generated by server */
-########################################################################
-# VERIFY ITEMS 4 and 5
-########################################################################
-#
-BEGIN;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-INSERT INTO tmp1 VALUES(1);
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-INSERT INTO tmp2 VALUES(1);
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp1;
-DROP TEMPORARY TABLE tmp2;
-DROP TEMPORARY TABLE tmp3;
-COMMIT;
-show binlog events from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1)
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1
-master-bin.000001 # Query # # use `test`; INSERT INTO tmp2 VALUES(1)
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1
-master-bin.000001 # Query # # use `test`; INSERT INTO tmp3 VALUES(1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp3
-master-bin.000001 # Query # # COMMIT
-BEGIN;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-INSERT INTO tmp1 VALUES(1);
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-INSERT INTO tmp2 VALUES(1);
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp1;
-DROP TEMPORARY TABLE tmp2;
-DROP TEMPORARY TABLE tmp3;
-ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-show binlog events from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1)
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1
-master-bin.000001 # Query # # use `test`; INSERT INTO tmp2 VALUES(1)
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1
-master-bin.000001 # Query # # use `test`; INSERT INTO tmp3 VALUES(1)
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp2
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE tmp3
-master-bin.000001 # Query # # ROLLBACK
-########################################################################
-# VERIFY ITEM 6
-########################################################################
-SET BINLOG_FORMAT=STATEMENT;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-SET BINLOG_FORMAT=ROW;
-DROP TEMPORARY TABLE tmp1;
-BEGIN;
-INSERT INTO tmp2 VALUES(1);
-DROP TEMPORARY TABLE tmp2;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp3;
-COMMIT;
-show binlog events from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp3` /* generated by server */
-master-bin.000001 # Query # # COMMIT
-SET BINLOG_FORMAT=STATEMENT;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-SET BINLOG_FORMAT=ROW;
-DROP TEMPORARY TABLE tmp1;
-BEGIN;
-INSERT INTO tmp2 VALUES(1);
-DROP TEMPORARY TABLE tmp2;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp3;
-ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-show binlog events from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
-master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp3` /* generated by server */
-master-bin.000001 # Query # # ROLLBACK
-########################################################################
-# VERIFY ITEM 7
-########################################################################
-SET BINLOG_FORMAT=STATEMENT;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM;
-CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb;
-BEGIN;
-INSERT INTO t_myisam VALUES(CONNECTION_ID());
-INSERT INTO tmp1 VALUES(1);
-INSERT INTO t_myisam VALUES(1);
-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.
-INSERT INTO t_innodb VALUES(1);
-INSERT INTO t_myisam VALUES(CONNECTION_ID());
-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.
-INSERT INTO t_innodb VALUES(1);
-COMMIT;
-show binlog events from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001 # Query # # use `test`; CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM
-master-bin.000001 # Query # # use `test`; CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(CONNECTION_ID())
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(1)
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam VALUES(CONNECTION_ID())
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1)
-master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1)
-master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1)
-master-bin.000001 # Xid # # COMMIT /* XID */
-########################################################################
-# VERIFY ITEM 8
-########################################################################
-SET BINLOG_FORMAT=MIXED;
-BEGIN;
-CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb;
-INSERT INTO t_innodb VALUES(1);
-INSERT INTO t_innodb VALUES(1);
-ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-show binlog events from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb
-master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1)
-master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1)
-master-bin.000001 # Query # # ROLLBACK
-###################################################################################
-# CHECK CONSISTENCY
-###################################################################################
-###################################################################################
-# CLEAN UP
-###################################################################################
-DROP TABLE t_myisam;
-DROP TABLE t_innodb;
diff --git a/mysql-test/suite/rpl/t/rpl_current_user.cnf b/mysql-test/suite/rpl/t/rpl_current_user.cnf
new file mode 100644
index 00000000000..999ee727a88
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_current_user.cnf
@@ -0,0 +1,9 @@
+!include ../my.cnf
+
+[mysqld.3]
+server-id=3
+log-bin=slave-bin
+
+[ENV]
+SLAVE_MYPORT1= @mysqld.3.port
+SLAVE_MYSOCK1= @mysqld.3.socket
diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test
new file mode 100644
index 00000000000..79816ef6c95
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_current_user.test
@@ -0,0 +1,239 @@
+##############################################################################
+# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER,
+# REVOKE, GRANT, ALTER EVENT
+#
+# Calling CURRENT_USER() results into inconsistency between slave and master,
+# as the slave SQL thread has different user with common users.
+#
+# After the patch for bug#48321, session's user will be written into query log
+# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT',
+# 'ALTER EVENT'.
+#
+##############################################################################
+source include/master-slave.inc;
+source include/have_binlog_format_statement.inc;
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+
+--echo
+--echo # On slave2
+connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
+connection slave2;
+
+--echo # Connect slave2 to slave
+--replace_result $SLAVE_MYPORT SLAVE_MYPORT;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT,
+ MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root';
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+
+--echo
+--echo # [On master]
+connection master;
+--disable_warnings
+DROP VIEW IF EXISTS v_user;
+DROP VIEW IF EXISTS v_tables_priv;
+DROP VIEW IF EXISTS v_procs_priv;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS my_grant;
+DROP PROCEDURE IF EXISTS my_revoke;
+DROP FUNCTION IF EXISTS my_user;
+DROP EVENT IF EXISTS e1;
+--enable_warnings
+CREATE TABLE t1(c1 char(100));
+CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
+CREATE PROCEDURE p1() SELECT 1;
+--echo # bug48321_1-01234 has the max length(16) of user.
+GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
+
+--echo
+--echo # Make sure the max lengths of user and host
+--echo # the user name is too lengh
+--error 1470
+GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost';
+--echo # the host name is too lengh
+--error 1470
+GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890';
+
+--echo
+--echo # User 'bug48321_1-01234' connects to master by conn1
+connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,);
+connection conn1;
+--echo # [On conn1]
+--echo # Verify 'REVOKE ALL' statement
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER();
+let $diff_table= test.v_user;
+let $diff_server_list= master, slave, slave2;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'GRANT ... ON TABLE ...' statement
+connection conn1;
+GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
+let $diff_table= test.v_tables_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'GRANT ... ON PROCEDURE...' statement
+connection conn1;
+GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER();
+let $diff_table= test.v_procs_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'GRANT ... ON *.* ...' statement
+connection conn1;
+GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'REVOKE ... ON TABLE ...' statement
+connection conn1;
+REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
+let $diff_table= test.v_tables_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'REVOKE ... ON PROCEDURE...' statement
+connection conn1;
+REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER();
+let $diff_table= test.v_procs_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'REVOKE ... ON *.* ...' statement
+connection conn1;
+REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER();
+let $diff_table= test.v_user;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'GRANT ...' statement in the procedure
+connection conn1;
+CREATE PROCEDURE my_grant()
+ GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
+call my_grant;
+let $diff_table= test.v_tables_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure
+connection conn1;
+CREATE PROCEDURE my_revoke()
+ REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
+call my_revoke;
+let $diff_table= test.v_tables_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'RENAME USER ...' statement
+connection conn1;
+RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost';
+let $diff_table= test.v_user;
+source include/rpl_diff_tables.inc;
+
+disconnect conn1;
+
+--echo
+--echo # Verify 'DROP USER ...' statement
+connection master;
+GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost';
+connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,);
+connection conn1;
+DROP USER CURRENT_USER();
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'ALTER EVENT...' statement
+connection master;
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
+
+--echo # Explicitly assign CURRENT_USER() to definer
+ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
+let $diff_table= test.v_event;
+source include/rpl_diff_tables.inc;
+
+connection master;
+--echo
+--echo # Session user will be set as definer, if the statement does not assign
+--echo # a definer
+ALTER EVENT e1 ENABLE;
+sync_slave_with_master;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify that this patch does not affect the calling of CURRENT_USER()
+--echo # in the other statements
+connection master;
+--echo # [On master]
+INSERT INTO t1 VALUES(CURRENT_USER()), ('1234');
+SELECT * FROM t1;
+sync_slave_with_master;
+--echo # [On slave]
+SELECT * FROM t1;
+--echo # [On slave2]
+sync_slave_with_master slave2;
+SELECT * FROM t1;
+
+connection master;
+--echo # [On master]
+UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234';
+SELECT * FROM t1;
+sync_slave_with_master;
+--echo # [On slave]
+SELECT * FROM t1;
+sync_slave_with_master slave2;
+--echo # [On slave2]
+SELECT * FROM t1;
+
+connection master;
+--echo # [On master]
+DELETE FROM t1 WHERE c1=CURRENT_USER();
+SELECT * FROM t1;
+sync_slave_with_master;
+--echo # [On slave]
+SELECT * FROM t1;
+sync_slave_with_master slave2;
+--echo # [On slave2]
+SELECT * FROM t1;
+
+connection master;
+--echo # [On master]
+CREATE TABLE t2(c1 char(100));
+
+DELIMITER |;
+CREATE FUNCTION my_user() RETURNS VARCHAR(64)
+ SQL SECURITY INVOKER
+BEGIN
+ INSERT INTO t2 VALUES(CURRENT_USER());
+ RETURN CURRENT_USER();
+END |
+DELIMITER ;|
+
+INSERT INTO t1 VALUES(my_user());
+SELECT * FROM t1;
+SELECT * FROM t2;
+sync_slave_with_master;
+--echo # [On slave]
+SELECT * FROM t1;
+SELECT * FROM t2;
+sync_slave_with_master slave2;
+--echo # [On slave2]
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+--echo
+--echo # END
+connection master;
+DROP TABLE t1, t2;
+DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event;
+DROP PROCEDURE p1;
+DROP PROCEDURE my_grant;
+DROP PROCEDURE my_revoke;
+DROP FUNCTION my_user;
+DROP EVENT e1;
+sync_slave_with_master;
+sync_slave_with_master slave2;
+source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_drop_temp.test b/mysql-test/suite/rpl/t/rpl_drop_temp.test
index f2a4dd70da6..7bc55c53447 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_temp.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test
@@ -66,4 +66,32 @@ START SLAVE;
connection master;
sync_slave_with_master;
+
+#
+# BUG#54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW
+#
+
+-- connection master
+-- source include/master-slave-reset.inc
+-- connection master
+
+CREATE TABLE t1 ( i INT );
+--sync_slave_with_master
+SHOW STATUS LIKE 'Slave_open_temp_tables';
+
+--connect(con1,localhost,root,,)
+CREATE TEMPORARY TABLE ttmp1 ( i INT );
+SET SESSION binlog_format=ROW;
+--disconnect con1
+
+-- connection master
+--let $wait_binlog_event= DROP
+--source include/wait_for_binlog_event.inc
+--sync_slave_with_master
+SHOW STATUS LIKE 'Slave_open_temp_tables';
+
+--connection master
+--source include/show_binlog_events.inc
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt b/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test
new file mode 100644
index 00000000000..8c635202ad5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test
@@ -0,0 +1,10 @@
+###################################################################################
+# This test cases evaluates the mixture of non-transactional and transcational
+# tables. Specifically when drop temporary tables and create temporary tables
+# are used.
+###################################################################################
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source extra/rpl_tests/rpl_drop_create_temp_table.test
diff --git a/mysql-test/suite/rpl/t/rpl_mixed_row_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_mixed_row_innodb-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mixed_row_innodb-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test
index 1952be145d0..2f2db01f422 100644
--- a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test
+++ b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test
@@ -11,5 +11,3 @@ SET SESSION binlog_direct_non_transactional_updates = OFF;
--enable_query_log
let $engine_type=Innodb;
--source extra/rpl_tests/rpl_mixing_engines.test
-
---diff_files suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result suite/rpl/r/rpl_mixed_mixing_engines.result
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt
index de86b63f230..bd7728134c7 100644
--- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt
@@ -1,2 +1,2 @@
---binlog_ignore_db=test_ignore
+--binlog_ignore_db=test_ignore --default-storage-engine=MyISAM
diff --git a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt b/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt
index 45631525481..eb56e5c0a09 100644
--- a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt
@@ -1 +1 @@
---binlog_cache_size=4096 --max_binlog_cache_size=7680
+--binlog_cache_size=4096 --max_binlog_cache_size=7680 --default-storage-engine=MyISAM
diff --git a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test
new file mode 100644
index 00000000000..fc46665ddb1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test
@@ -0,0 +1,10 @@
+###################################################################################
+# This test cases evaluates the mixture of non-transactional and transcational
+# tables. Specifically when drop temporary tables and create temporary tables
+# are used.
+###################################################################################
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source extra/rpl_tests/rpl_drop_create_temp_table.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt
index e0d075c3fbd..773ec62bef2 100644
--- a/mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt
@@ -1 +1,2 @@
--skip-external-locking
+--default-storage-engine=MyISAM
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index ebb8bb6c718..f0231fa3470 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -29,9 +29,11 @@ DROP TABLE IF EXISTS t1,t2,t3;
connection master;
CREATE TABLE t1(word VARCHAR(20));
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
+--let $position= query_get_value(SHOW MASTER STATUS, Position, 1)
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
-
-
+--let $stop_position=query_get_value(SHOW MASTER STATUS, Position, 1)
+--let $stop_position1=`select $stop_position - 1`
+--let $binlog_start_pos=query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
# Test Section
# Lets start by putting some data into the tables.
@@ -167,8 +169,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
select "--- Test 2 position test --" as "";
--enable_query_log
let $MYSQLD_DATADIR= `select @@datadir;`;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=417 --stop-position=570 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$position --stop-position=$stop_position $MYSQLD_DATADIR/master-bin.000001
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -179,7 +180,7 @@ select "--- Test 3 First Remote test --" as "";
# This is broken now
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_position --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- Test 4 Second Remote test --" as "";
@@ -251,7 +252,7 @@ connection master;
select "--- Test 5 LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=106 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$binlog_start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 (mysqlbinlog does not accept input from stdin)
@@ -260,13 +261,13 @@ select "--- Test 6 reading stdin --" as "";
--enable_query_log
let $MYSQLD_DATADIR= `select @@datadir;`;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_position1 - < $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- Test 7 reading stdin w/position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --start-position=417 --stop-position=570 - < $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=$position --stop-position=$stop_position - < $MYSQLD_DATADIR/master-bin.000001
# Bug#16217 (mysql client did not know how not switch its internal charset)
--disable_query_log
diff --git a/mysql-test/suite/rpl/t/rpl_savepoint.test b/mysql-test/suite/rpl/t/rpl_savepoint.test
new file mode 100644
index 00000000000..c3d1f44d162
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_savepoint.test
@@ -0,0 +1,47 @@
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug#50124 Rpl failure on DROP table with concurrent txn/non-txn
+--echo # DML flow and SAVEPOINT
+--echo #
+
+--echo # Connection master
+connection master;
+
+--disable_warnings
+DROP TABLE IF EXISTS tt, nt;
+--enable_warnings
+
+CREATE TABLE tt (i INT) ENGINE = InnoDB;
+CREATE TABLE nt (i INT) ENGINE = MyISAM;
+FLUSH LOGS;
+START TRANSACTION;
+INSERT INTO nt VALUES (1);
+SAVEPOINT insert_statement;
+INSERT INTO tt VALUES (1);
+
+--echo # Connection master1
+connection master1;
+--echo # Sending:
+--send DROP TABLE tt
+
+--echo # Connection master
+connection master;
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = "Waiting for table" AND info = "DROP TABLE tt";
+--source include/wait_condition.inc
+ROLLBACK TO SAVEPOINT insert_statement;
+COMMIT;
+
+--echo # Connection master1
+connection master1;
+--echo # Reaping: DROP TABLE tt
+--reap
+FLUSH LOGS;
+
+--echo # Connection master
+connection master;
+DROP TABLE nt;
+--source include/master-slave-end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test
index fc0936cea09..66762d4dad0 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test
@@ -17,8 +17,8 @@ STOP SLAVE;
connection master;
SET SESSION BINLOG_FORMAT=ROW;
-CREATE TABLE t1 (a INT, b INT);
-CREATE TABLE t2 (c INT, d INT);
+CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index 8ca4ff51eda..8510f387111 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -657,17 +657,25 @@ connection master1;
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='insert into t1 (a) values (f1())';
--source include/wait_condition.inc
---echo # Sending 'drop function f1'. It will abort the table lock wait.
-drop function f1;
+--echo # Sending 'drop function f1'. It will wait till insert finishes.
+--send drop function f1;
--echo # --> connection default
connection default;
+--echo # Check that 'drop function f1' gets blocked.
+let $wait_condition=select count(*)=1 from information_schema.processlist
+where state='Waiting for table' and info='drop function f1';
+--source include/wait_condition.inc
--echo # Now let's let 'insert' go through...
unlock tables;
---echo # --> connection con1
+--echo # --> connection master
connection master;
--echo # Reaping 'insert into t1 (a) values (f1())'...
---error ER_SP_DOES_NOT_EXIST
--reap
+--echo # --> connection master1
+connection master1;
+--echo # Reaping 'drop function f1'
+--reap
+--echo # --> connection master
connection master;
select * from t1;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test
new file mode 100644
index 00000000000..b46da8a0150
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test
@@ -0,0 +1,10 @@
+###################################################################################
+# This test cases evaluates the mixture of non-transactional and transcational
+# tables. Specifically when drop temporary tables and create temporary tables
+# are used.
+###################################################################################
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source extra/rpl_tests/rpl_drop_create_temp_table.test
diff --git a/mysql-test/suite/rpl/t/rpl_stm_loaddata_concurrent.test b/mysql-test/suite/rpl/t/rpl_stm_loaddata_concurrent.test
index 2ea95a63fb5..7add76c0ef5 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_loaddata_concurrent.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_loaddata_concurrent.test
@@ -4,7 +4,7 @@
RESET MASTER;
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
-CREATE TABLE t1 (c1 char(50));
+CREATE TABLE t1 (c1 char(50)) ENGINE=MyISAM;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE t1;
-- source include/show_binlog_events.inc
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index 07d4ee37579..403069b6216 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -203,11 +203,14 @@ flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/master-bin.000001
--copy_file $MYSQL_TEST_DIR/std_data/bug47142_master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
+# this a constant bound to the bug47142_master-bin.000001 binlog file
+--let $binlog_before_drop=294;
connection slave;
stop slave;
reset slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */;
+--replace_regex /master_log_pos=[0-9]+/master_log_pos=MASTER_LOG_POS/
+eval start slave until master_log_file='master-bin.000001', master_log_pos=$binlog_before_drop /* to stop right before DROP */;
--source include/wait_for_slave_sql_to_stop.inc
show tables /* t1 must exist */;
diff --git a/mysql-test/suite/rpl/t/rpl_sync-master.opt b/mysql-test/suite/rpl/t/rpl_sync-master.opt
new file mode 100644
index 00000000000..ad327ce0454
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sync-master.opt
@@ -0,0 +1,2 @@
+--default-storage-engine=MyISAM
+--innodb-file-per-table=0
diff --git a/mysql-test/suite/rpl/t/rpl_sync-slave.opt b/mysql-test/suite/rpl/t/rpl_sync-slave.opt
index 9d8c2c80711..fba451a5b3e 100644
--- a/mysql-test/suite/rpl/t/rpl_sync-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_sync-slave.opt
@@ -1 +1 @@
---sync-relay-log-info=1 --relay-log-recovery=1 --innodb_file_format_check=1
+--sync-relay-log-info=1 --relay-log-recovery=1 --innodb_file_format_check=1 --default-storage-engine=MyISAM --innodb-file-per-table=0
diff --git a/mysql-test/suite/rpl/t/rpl_temp_temporary.test b/mysql-test/suite/rpl/t/rpl_temp_temporary.test
deleted file mode 100644
index 4eb2d16b91e..00000000000
--- a/mysql-test/suite/rpl/t/rpl_temp_temporary.test
+++ /dev/null
@@ -1,228 +0,0 @@
-################################################################################
-# BUG#51894 Replication failure with SBR on DROP TEMPORARY TABLE inside a
-# transaction
-# BUG#52616 Temp table prevents switch binlog format from STATEMENT to ROW
-#
-# This test verifies what follows:
-#
-# 1 - If the following statements are classified as unsafe:
-# 1.1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
-# 1.2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
-#
-# 2 - If the following statements are classified as safe:
-# 1.7 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp
-# 1.8 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb
-#
-# 3 - If we can switch from statement to row format.
-#
-# 4 - If statements that can manipulate a temporary table and do not cause an
-# implicit commit are kept in the boundaries of an on-going transaction. For
-# instance:
-# 4.1 - CREATE TEMPORARY TABLE
-# 4.2 - CREATE TEMPORARY TABLE LIKE
-# 4.3 - CREATE TEMPORARY TABLE SELECT * FROM
-# 4.4 - INSERT/UPDATE/DELETE (Note that only inserts are verified)
-# 4.5 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
-# 4.6 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
-# 4.7 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp
-# 4.8 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb
-#
-# 5 - If transactions that have a DROP TEMPORARY are always written to the
-# binary log regardless of the mode and the outcome: commit or rollback.
-#
-# 6 - In particular, if the current statement logging format is set to row
-# the CREATE TEMPORARY is not logged and the DROP TEMPORARY is extended with
-# the IF EXISTS clause.
-#
-# 7 - It verifies if the CONNECTION_ID along with a non-transactional
-# table is written outside the transaction boundaries and is not classified
-# as unsafe. See BUG#53075.
-#
-# 8 - It verifies if OPTION_KEEP_LOG is set and thus forcing to write the
-# trx-cache to the binary log when an rollback is issued and only trx-tables
-# were updated. See BUG#53421.
-################################################################################
-
-source include/master-slave.inc;
-source include/have_binlog_format_statement.inc;
-source include/have_innodb.inc;
-
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-
---echo ########################################################################
---echo # VERIFY ITEMS 1 and 2
---echo ########################################################################
-
---echo #
---echo # Create temporary tables to verify when statements involving temporary
---echo # tables are classified as safe or unsafe by printing out the warning
---echo # messages.
---echo #
-connection master;
-CREATE TABLE t_myisam(id int) engine= MyIsam;
-INSERT INTO t_myisam VALUES(1);
-CREATE TABLE t_innodb(id int) engine= Innodb;
-INSERT INTO t_innodb VALUES(1);
-CREATE TEMPORARY TABLE t_myisam_temp(id int) engine= MyIsam;
-INSERT INTO t_myisam_temp VALUES(1);
-CREATE TEMPORARY TABLE t_innodb_temp(id int) engine= Innodb;
-INSERT INTO t_innodb_temp VALUES(1);
-
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-BEGIN;
-INSERT INTO t_myisam SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_innodb_temp;
-ROLLBACK;
-
-BEGIN;
-INSERT INTO t_myisam SELECT * FROM t_innodb_temp;
-INSERT INTO t_innodb SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_innodb_temp;
-ROLLBACK;
-
---echo ########################################################################
---echo # VERIFY ITEM 3
---echo ########################################################################
-
---echo #
---echo # When there is a temporary table we can switch between the mixed and
---echo # row formats. However, we cannot switch to the statement format.
---echo #
-SET BINLOG_FORMAT=MIXED;
-SET BINLOG_FORMAT=ROW;
-SET BINLOG_FORMAT=MIXED;
---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
-SET BINLOG_FORMAT=STATEMENT;
-
---echo #
---echo # When there is a temporary table we can switch between the mixed and
---echo # row formats. However, we cannot swith to the statement format.
---echo #
-SET BINLOG_FORMAT=MIXED;
-DROP TABLE t_myisam_temp, t_innodb_temp, t_myisam, t_innodb;
-source include/show_binlog_events.inc;
-
---echo ########################################################################
---echo # VERIFY ITEMS 4 and 5
---echo ########################################################################
-
---echo #
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-BEGIN;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-INSERT INTO tmp1 VALUES(1);
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-INSERT INTO tmp2 VALUES(1);
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp1;
-DROP TEMPORARY TABLE tmp2;
-DROP TEMPORARY TABLE tmp3;
-COMMIT;
-source include/show_binlog_events.inc;
-
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-BEGIN;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-INSERT INTO tmp1 VALUES(1);
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-INSERT INTO tmp2 VALUES(1);
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp1;
-DROP TEMPORARY TABLE tmp2;
-DROP TEMPORARY TABLE tmp3;
-ROLLBACK;
-source include/show_binlog_events.inc;
-
---echo ########################################################################
---echo # VERIFY ITEM 6
---echo ########################################################################
-
-SET BINLOG_FORMAT=STATEMENT;
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-SET BINLOG_FORMAT=ROW;
-DROP TEMPORARY TABLE tmp1;
-BEGIN;
-INSERT INTO tmp2 VALUES(1);
-DROP TEMPORARY TABLE tmp2;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp3;
-COMMIT;
-source include/show_binlog_events.inc;
-
-SET BINLOG_FORMAT=STATEMENT;
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-SET BINLOG_FORMAT=ROW;
-DROP TEMPORARY TABLE tmp1;
-BEGIN;
-INSERT INTO tmp2 VALUES(1);
-DROP TEMPORARY TABLE tmp2;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp3;
-ROLLBACK;
-source include/show_binlog_events.inc;
-
---echo ########################################################################
---echo # VERIFY ITEM 7
---echo ########################################################################
-
-SET BINLOG_FORMAT=STATEMENT;
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM;
-CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb;
-
-BEGIN;
-INSERT INTO t_myisam VALUES(CONNECTION_ID());
-INSERT INTO tmp1 VALUES(1);
-INSERT INTO t_myisam VALUES(1);
-INSERT INTO t_innodb VALUES(1);
-INSERT INTO t_myisam VALUES(CONNECTION_ID());
-INSERT INTO t_innodb VALUES(1);
-COMMIT;
-source include/show_binlog_events.inc;
-
---echo ########################################################################
---echo # VERIFY ITEM 8
---echo ########################################################################
-#
-# Before the patch for BUG#53421, nothing were written to the binary log on
-# behalf of the transaction presented below:
-#
-SET BINLOG_FORMAT=MIXED;
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-BEGIN;
-CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb;
-INSERT INTO t_innodb VALUES(1);
-INSERT INTO t_innodb VALUES(1);
-ROLLBACK;
-source include/show_binlog_events.inc;
-
---echo ###################################################################################
---echo # CHECK CONSISTENCY
---echo ###################################################################################
-sync_slave_with_master;
-connection master;
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
---diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
-
---echo ###################################################################################
---echo # CLEAN UP
---echo ###################################################################################
-connection master;
-
-DROP TABLE t_myisam;
-DROP TABLE t_innodb;
-
-sync_slave_with_master;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
index 66eeaa6357c..b17d30fa8e4 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
@@ -30,7 +30,7 @@ FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
CHANGE MASTER TO
master_port=<MASTER_PORT1>,
master_log_file = 'master-bin.000001',
-master_log_pos = 107 ;
+master_log_pos = BINLOG_START ;
start slave;
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
DELETE FROM t1 WHERE c3 = 1;
diff --git a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def
index 2f15112515e..6bfb20f2205 100644
--- a/mysql-test/suite/rpl_ndb/t/disabled.def
+++ b/mysql-test/suite/rpl_ndb/t/disabled.def
@@ -10,5 +10,8 @@
#
##############################################################################
+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
+
# 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/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
index eb128cfa2ce..800362db67a 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
@@ -40,6 +40,7 @@ let $the_file= `SELECT @the_file` ;
# now connect the slave to the _other_ "master"
connection slave;
--replace_result $MASTER_MYPORT1 <MASTER_PORT1>
+--replace_regex /master_log_pos = [0-9]+/master_log_pos = BINLOG_START/
eval CHANGE MASTER TO
master_port=$MASTER_MYPORT1,
master_log_file = '$the_file',
diff --git a/mysql-test/suite/sys_vars/r/default_storage_engine_basic.result b/mysql-test/suite/sys_vars/r/default_storage_engine_basic.result
index 541c0b6b328..c2acc7ab5ac 100644
--- a/mysql-test/suite/sys_vars/r/default_storage_engine_basic.result
+++ b/mysql-test/suite/sys_vars/r/default_storage_engine_basic.result
@@ -1,22 +1,22 @@
SET @start_global_value = @@global.default_storage_engine;
SELECT @start_global_value;
@start_global_value
-MyISAM
+InnoDB
SET @start_session_value = @@session.default_storage_engine;
SELECT @start_session_value;
@start_session_value
-MyISAM
+InnoDB
'#--------------------FN_DYNVARS_005_01-------------------------#'
SET @@global.default_storage_engine = INNODB;
SET @@global.default_storage_engine = DEFAULT;
SELECT @@global.default_storage_engine;
@@global.default_storage_engine
-MyISAM
+InnoDB
SET @@session.default_storage_engine = INNODB;
SET @@session.default_storage_engine = DEFAULT;
SELECT @@session.default_storage_engine;
@@session.default_storage_engine
-MyISAM
+InnoDB
'#--------------------FN_DYNVARS_005_02-------------------------#'
SET @@global.default_storage_engine = MYISAM;
SELECT @@global.default_storage_engine;
@@ -110,8 +110,8 @@ SET @@default_storage_engine = @start_global_value;
SET @@global.default_storage_engine = @start_global_value;
SELECT @@global.default_storage_engine;
@@global.default_storage_engine
-MyISAM
+InnoDB
SET @@session.default_storage_engine = @start_session_value;
SELECT @@session.default_storage_engine;
@@session.default_storage_engine
-MyISAM
+InnoDB
diff --git a/mysql-test/suite/sys_vars/r/innodb_file_format_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_format_basic.result
index 58e009ea705..41369038cf6 100644
--- a/mysql-test/suite/sys_vars/r/innodb_file_format_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_file_format_basic.result
@@ -1,28 +1,28 @@
SET @start_global_value = @@global.innodb_file_format;
SELECT @start_global_value;
@start_global_value
-Antelope
+Barracuda
Valid values are 'Antelope' and 'Barracuda'
select @@global.innodb_file_format in ('Antelope', 'Barracuda');
@@global.innodb_file_format in ('Antelope', 'Barracuda')
1
select @@global.innodb_file_format;
@@global.innodb_file_format
-Antelope
+Barracuda
select @@session.innodb_file_format;
ERROR HY000: Variable 'innodb_file_format' is a GLOBAL variable
show global variables like 'innodb_file_format';
Variable_name Value
-innodb_file_format Antelope
+innodb_file_format Barracuda
show session variables like 'innodb_file_format';
Variable_name Value
-innodb_file_format Antelope
+innodb_file_format Barracuda
select * from information_schema.global_variables where variable_name='innodb_file_format';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_FILE_FORMAT Antelope
+INNODB_FILE_FORMAT Barracuda
select * from information_schema.session_variables where variable_name='innodb_file_format';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_FILE_FORMAT Antelope
+INNODB_FILE_FORMAT Barracuda
set global innodb_file_format='Antelope';
select @@global.innodb_file_format;
@@global.innodb_file_format
@@ -56,4 +56,4 @@ ERROR 42000: Variable 'innodb_file_format' can't be set to the value of 'Salmon'
SET @@global.innodb_file_format = @start_global_value;
SELECT @@global.innodb_file_format;
@@global.innodb_file_format
-Antelope
+Barracuda
diff --git a/mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result b/mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result
index 200f9166215..5e55faa99c9 100644
--- a/mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_strict_mode_basic.result
@@ -1,32 +1,32 @@
SET @start_global_value = @@global.innodb_strict_mode;
SELECT @start_global_value;
@start_global_value
-0
+1
Valid values are 'ON' and 'OFF'
select @@global.innodb_strict_mode in (0, 1);
@@global.innodb_strict_mode in (0, 1)
1
select @@global.innodb_strict_mode;
@@global.innodb_strict_mode
-0
+1
select @@session.innodb_strict_mode in (0, 1);
@@session.innodb_strict_mode in (0, 1)
1
select @@session.innodb_strict_mode;
@@session.innodb_strict_mode
-0
+1
show global variables like 'innodb_strict_mode';
Variable_name Value
-innodb_strict_mode OFF
+innodb_strict_mode ON
show session variables like 'innodb_strict_mode';
Variable_name Value
-innodb_strict_mode OFF
+innodb_strict_mode ON
select * from information_schema.global_variables where variable_name='innodb_strict_mode';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_STRICT_MODE OFF
+INNODB_STRICT_MODE ON
select * from information_schema.session_variables where variable_name='innodb_strict_mode';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_STRICT_MODE OFF
+INNODB_STRICT_MODE ON
set global innodb_strict_mode='OFF';
set session innodb_strict_mode='OFF';
select @@global.innodb_strict_mode;
@@ -117,4 +117,4 @@ INNODB_STRICT_MODE ON
SET @@global.innodb_strict_mode = @start_global_value;
SELECT @@global.innodb_strict_mode;
@@global.innodb_strict_mode
-0
+1
diff --git a/mysql-test/suite/sys_vars/r/large_files_support_basic.result b/mysql-test/suite/sys_vars/r/large_files_support_basic.result
index a33e3894ddc..e6e1729ed3f 100644
--- a/mysql-test/suite/sys_vars/r/large_files_support_basic.result
+++ b/mysql-test/suite/sys_vars/r/large_files_support_basic.result
@@ -1,20 +1,20 @@
select @@global.large_files_support;
@@global.large_files_support
-0
+1
select @@session.large_files_support;
ERROR HY000: Variable 'large_files_support' is a GLOBAL variable
show global variables like 'large_files_support';
Variable_name Value
-large_files_support OFF
+large_files_support ON
show session variables like 'large_files_support';
Variable_name Value
-large_files_support OFF
+large_files_support ON
select * from information_schema.global_variables where variable_name='large_files_support';
VARIABLE_NAME VARIABLE_VALUE
-LARGE_FILES_SUPPORT OFF
+LARGE_FILES_SUPPORT ON
select * from information_schema.session_variables where variable_name='large_files_support';
VARIABLE_NAME VARIABLE_VALUE
-LARGE_FILES_SUPPORT OFF
+LARGE_FILES_SUPPORT ON
set global large_files_support=1;
ERROR HY000: Variable 'large_files_support' is a read only variable
set session large_files_support=1;
diff --git a/mysql-test/suite/sys_vars/r/sql_select_limit_func.result b/mysql-test/suite/sys_vars/r/sql_select_limit_func.result
index 893816e6f0f..5d4daf8367b 100644
--- a/mysql-test/suite/sys_vars/r/sql_select_limit_func.result
+++ b/mysql-test/suite/sys_vars/r/sql_select_limit_func.result
@@ -62,6 +62,16 @@ a b a b
6 val6 6 val6
affected rows: 2
Expecting affected rows: 2
+SET SESSION sql_select_limit = 0;
+affected rows: 0
+SELECT * FROM t1;
+a b
+affected rows: 0
+Expecting affected rows: 0
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+a b a b
+affected rows: 0
+Expecting affected rows: 0
'#-----------------------------FN_DYNVARS_165_03---------------#'
SET SESSION sql_select_limit = 2;
affected rows: 0
diff --git a/mysql-test/suite/sys_vars/r/storage_engine_basic.result b/mysql-test/suite/sys_vars/r/storage_engine_basic.result
index 5e80f1343b7..6f10ec475a0 100644
--- a/mysql-test/suite/sys_vars/r/storage_engine_basic.result
+++ b/mysql-test/suite/sys_vars/r/storage_engine_basic.result
@@ -1,22 +1,22 @@
SET @start_global_value = @@global.storage_engine;
SELECT @start_global_value;
@start_global_value
-MyISAM
+InnoDB
SET @start_session_value = @@session.storage_engine;
SELECT @start_session_value;
@start_session_value
-MyISAM
+InnoDB
'#--------------------FN_DYNVARS_005_01-------------------------#'
SET @@global.storage_engine = INNODB;
SET @@global.storage_engine = DEFAULT;
SELECT @@global.storage_engine;
@@global.storage_engine
-MyISAM
+InnoDB
SET @@session.storage_engine = INNODB;
SET @@session.storage_engine = DEFAULT;
SELECT @@session.storage_engine;
@@session.storage_engine
-MyISAM
+InnoDB
'#--------------------FN_DYNVARS_005_02-------------------------#'
SET @@global.storage_engine = MYISAM;
SELECT @@global.storage_engine;
@@ -110,8 +110,8 @@ SET @@storage_engine = @start_global_value;
SET @@global.storage_engine = @start_global_value;
SELECT @@global.storage_engine;
@@global.storage_engine
-MyISAM
+InnoDB
SET @@session.storage_engine = @start_session_value;
SELECT @@session.storage_engine;
@@session.storage_engine
-MyISAM
+InnoDB
diff --git a/mysql-test/suite/sys_vars/t/default_storage_engine_basic.test b/mysql-test/suite/sys_vars/t/default_storage_engine_basic.test
index 17f2d2cc852..f47453eb234 100644
--- a/mysql-test/suite/sys_vars/t/default_storage_engine_basic.test
+++ b/mysql-test/suite/sys_vars/t/default_storage_engine_basic.test
@@ -15,6 +15,7 @@
# #
########################################################################
+--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/load_sysvars.inc
diff --git a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
index 7de63332844..636309a3088 100644
--- a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
@@ -77,7 +77,6 @@ SELECT @@global.innodb_fast_shutdown;
SET @@global.innodb_fast_shutdown = 1;
SELECT @@global.innodb_fast_shutdown;
## A value of 2 is used to just flush logs and then shutdown cold.
-## Not supported on Netware
SET @@global.innodb_fast_shutdown = 2;
SELECT @@global.innodb_fast_shutdown;
diff --git a/mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test
index e087cc738b0..cbf25af2442 100644
--- a/mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test
@@ -2,7 +2,7 @@
# 2010-01-25 - Added
#
-
+--source include/not_embedded.inc
--source include/have_innodb.inc
SET @start_global_value = @@global.innodb_file_format_max;
diff --git a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test
index 0b9d3ada158..e616a807a38 100644
--- a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test
+++ b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test
@@ -120,7 +120,7 @@ SELECT @@global.ndb_log_update_as_write;
#SELECT @@global.ndb_log_update_as_write;
#SET @@global.ndb_log_update_as_write = 1;
#SELECT @@global.ndb_log_update_as_write;
-## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware
+## a value of 2 is used to just flush logs and then shutdown cold.
#SET @@global.ndb_log_update_as_write = 2;
#SELECT @@global.ndb_log_update_as_write;
diff --git a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test
index 85b76cc88a4..c00ecf2e2fa 100644
--- a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test
+++ b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test
@@ -120,7 +120,7 @@ SELECT @@global.ndb_log_updated_only;
#SELECT @@global.ndb_log_updated_only;
#SET @@global.ndb_log_updated_only = 1;
#SELECT @@global.ndb_log_updated_only;
-## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware
+## a value of 2 is used to just flush logs and then shutdown cold.
#SET @@global.ndb_log_updated_only = 2;
#SELECT @@global.ndb_log_updated_only;
diff --git a/mysql-test/suite/sys_vars/t/sql_select_limit_func.test b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test
index ed582949aa0..99bc05c465c 100644
--- a/mysql-test/suite/sys_vars/t/sql_select_limit_func.test
+++ b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test
@@ -86,6 +86,14 @@ SELECT * FROM t1;
SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
--echo Expecting affected rows: 2
+SET SESSION sql_select_limit = 0;
+
+SELECT * FROM t1;
+--echo Expecting affected rows: 0
+
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo Expecting affected rows: 0
+
--echo '#-----------------------------FN_DYNVARS_165_03---------------#'
#
# Small value with LIMIT Clause
diff --git a/mysql-test/suite/sys_vars/t/storage_engine_basic.test b/mysql-test/suite/sys_vars/t/storage_engine_basic.test
index 7ec071e6414..49e8a52efea 100644
--- a/mysql-test/suite/sys_vars/t/storage_engine_basic.test
+++ b/mysql-test/suite/sys_vars/t/storage_engine_basic.test
@@ -21,6 +21,7 @@
# #
########################################################################
+--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/load_sysvars.inc
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index 5b61176b0f6..a3665e5f455 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1670,6 +1670,15 @@ SELECT * FROM t1;
--error ER_BAD_TABLE_ERROR
DROP TABLE t1;
+--echo #
+--echo # Ensure that TRUNCATE fails for non-empty archive tables.
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=ARCHIVE;
+INSERT INTO t1 VALUES (1);
+--error ER_ILLEGAL_HA
+TRUNCATE TABLE t1;
+DROP TABLE t1;
+
--echo #
--echo # BUG#46565 - repair of partition fail for archive engine
diff --git a/mysql-test/t/bootstrap-master.opt b/mysql-test/t/bootstrap-master.opt
new file mode 100644
index 00000000000..31a799e4d9b
--- /dev/null
+++ b/mysql-test/t/bootstrap-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM --skip-innodb
diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test
index db89269b35d..e98afb81ff1 100644
--- a/mysql-test/t/bootstrap.test
+++ b/mysql-test/t/bootstrap.test
@@ -8,8 +8,7 @@ drop table if exists t1;
# Add the datadir to the bootstrap command
let $MYSQLD_DATADIR= `select @@datadir`;
-let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR;
-
+let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --skip-innodb;
#
# Check that --bootstrap reads from stdin
#
@@ -20,7 +19,6 @@ EOF
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
-
#
# Check that --bootstrap of file with SQL error returns error
#
diff --git a/mysql-test/t/bug46080-master.opt b/mysql-test/t/bug46080-master.opt
index 71024d39356..1be97e178ed 100644
--- a/mysql-test/t/bug46080-master.opt
+++ b/mysql-test/t/bug46080-master.opt
@@ -1 +1 @@
---loose-performance-schema=0 --skip-grant-tables --skip-name-resolve --loose-safemalloc-mem-limit=4000000
+--loose-performance-schema=0 --skip-grant-tables --skip-name-resolve
diff --git a/mysql-test/t/bug46760.test b/mysql-test/t/bug46760.test
index f55edbbfa42..e7f57549250 100644
--- a/mysql-test/t/bug46760.test
+++ b/mysql-test/t/bug46760.test
@@ -29,7 +29,7 @@ DROP TABLE t1;
--echo # ROW_FORMAT=COMPRESSED
--echo #
-CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
+CREATE TABLE t1 (a INT) ROW_FORMAT=compressed, ENGINE=MyISAM;
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
SHOW CREATE TABLE t1;
diff --git a/mysql-test/t/commit.test b/mysql-test/t/commit.test
new file mode 100644
index 00000000000..261867bd5cc
--- /dev/null
+++ b/mysql-test/t/commit.test
@@ -0,0 +1,350 @@
+--source include/have_innodb.inc
+
+connect (con1,localhost,root,,);
+
+--echo #
+--echo # Bug#20837 Apparent change of isolation level
+--echo # during transaction
+--echo #
+--echo # Bug#53343 completion_type=1, COMMIT/ROLLBACK
+--echo # AND CHAIN don't preserve the isolation
+--echo # level
+#
+# A set of test cases that verifies operation of
+# transaction isolation level and chaining is
+# provided
+
+# init
+--echo connection default;
+connection default;
+
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+CREATE TABLE t1 (s1 INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+COMMIT;
+
+#
+# Verify that SET TRANS ISO LEVEL is not allowed
+# inside a transaction
+#
+START TRANSACTION;
+--error ER_CANT_CHANGE_TX_ISOLATION
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+COMMIT;
+
+#
+# Verify consistent output from
+# SELECT @@tx_isolation (Bug#20837)
+#
+# The transaction will be in READ UNCOMMITTED mode,
+# but SELECT @@tx_isolation should report the session
+# value, which is REPEATABLE READ
+#
+SET @@autocommit=0;
+COMMIT;
+SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+START TRANSACTION;
+SELECT @@tx_isolation;
+--echo Should be REPEATABLE READ
+SELECT * FROM t1;
+SELECT @@tx_isolation;
+--echo Should be REPEATABLE READ
+INSERT INTO t1 VALUES (-1);
+SELECT @@tx_isolation;
+--echo Should be REPEATABLE READ
+COMMIT;
+
+#
+# Verify that a change in the session variable
+# does not affect the currently started
+# transaction
+#
+START TRANSACTION;
+SELECT * FROM t1;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+
+--echo connection con1
+connection con1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1000);
+COMMIT;
+
+--echo connection default
+connection default;
+--echo We should not be able to read the '1000'
+SELECT * FROM t1;
+COMMIT;
+
+--echo Now, the '1000' should appear.
+START TRANSACTION;
+SELECT * FROM t1;
+COMMIT;
+
+# restore the session value
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+
+#
+# A set of test cases for verification that
+# isolation level during chaining works. MySQL
+# has three variants of chaining, i.e
+# COMMIT AND CHAIN, ROLLBACK AND CHAIN, and
+# the use of @completion_type
+#
+
+#
+# Verify isolation level with COMMIT AND CHAIN
+#
+# COMMIT AND CHAIN causes a new transaction to
+# begin as soon as the current ends, and the new
+# transaction will have the same tran. iso. level
+# as the first.
+#
+--echo connection default
+connection default;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+
+--echo connection con1
+connection con1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
+--echo Should be 1
+COMMIT AND CHAIN;
+
+--echo connection con1
+connection con1;
+INSERT INTO t1 VALUES (1002);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
+--echo Should be 1
+COMMIT;
+SELECT * FROM t1;
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT;
+
+#
+# Verify isolation level with ROLLBACK AND CHAIN
+#
+--echo connection default
+connection default;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+
+--echo connection con1
+connection con1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
+--echo Should be 1
+ROLLBACK AND CHAIN;
+
+--echo connection con1
+connection con1;
+INSERT INTO t1 VALUES (1002);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
+--echo Should be 1
+COMMIT;
+SELECT * FROM t1;
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT;
+
+#
+# Verify isolation level with @completion_type=1.
+# (A @@completion_type value of 1 is equivalentl to
+# explicitly adding "AND CHAIN" to COMMIT or ROLLBACK)
+#
+
+#
+# Verify that COMMIT AND NO CHAIN overrides the value
+# of @@completion_type
+#
+SET @@completion_type=1;
+
+--echo connection default
+connection default;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+
+--echo connection con1
+connection con1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT * FROM t1 WHERE s1 >= 1000;
+--echo Should see 1001
+COMMIT AND NO CHAIN;
+--echo default transaction is now in REPEATABLE READ
+
+--echo connection con1
+connection con1;
+INSERT INTO t1 VALUES (1002);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT * FROM t1 WHERE s1 >= 1000;
+--echo Should see 1001 and 1002
+
+--echo connection con1
+connection con1;
+INSERT INTO t1 VALUES (1003);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT * FROM t1 WHERE s1 >= 1000;
+--echo Should see 1001 and 1002, but NOT 1003
+COMMIT;
+
+SELECT * FROM t1;
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT AND NO CHAIN;
+SET @@completion_type=0;
+COMMIT;
+
+#
+# Verify that ROLLBACK AND NO CHAIN overrides the value
+# of @@completion_type
+#
+--echo connection default
+connection default;
+SET @@completion_type=1;
+COMMIT AND NO CHAIN;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+
+--echo connection con1
+connection con1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT * FROM t1 WHERE s1 >= 1000;
+--echo Should see 1001
+ROLLBACK AND NO CHAIN;
+--echo default transaction is now in REPEATABLE READ
+
+--echo connection con1
+connection con1;
+INSERT INTO t1 VALUES (1002);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT * FROM t1 WHERE s1 >= 1000;
+--echo Should see 1001 and 1002
+
+--echo connection con1
+connection con1;
+INSERT INTO t1 VALUES (1003);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT * FROM t1 WHERE s1 >= 1000;
+--echo Should see 1001 and 1002, but NOT 1003
+
+COMMIT;
+SELECT * FROM t1;
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT AND NO CHAIN;
+SET @@completion_type=0;
+COMMIT;
+
+#
+# Verify that in the sequence:
+# SET TRANSACTION ISOLATION LEVEL
+# SET SESSION ISOLATION LEVEL
+#
+# SET SESSION ISOLATION LEVEL has precedence over
+# SET TRANSACTION. (Note that this is _not_
+# in accordance with ISO 9075.)
+#
+--echo connection default
+connection default;
+
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+START TRANSACTION;
+SELECT * FROM t1;
+
+--echo connection con1
+connection con1;
+INSERT INTO t1 VALUES (1000);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT * FROM t1;
+--echo Should get same result as above (i.e should not read '1000')
+COMMIT;
+
+DELETE FROM t1 WHERE s1 >= 1000;
+COMMIT;
+
+
+#
+# Verify that a transaction ended with an
+# implicit commit (i.e a DDL statement), the
+# @@completetion_type setting is ignored, and
+# the next transaction's isolation level is
+# the session level.
+#
+SET @@completion_type=1;
+COMMIT AND NO CHAIN;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (1000);
+SELECT * FROM t1;
+--echo Should read '1000'
+
+--echo connection con1
+connection con1;
+INSERT INTO t1 VALUES (1001);
+COMMIT;
+
+--echo connection default
+connection default;
+SELECT * FROM t1;
+--echo Should only read the '1000' as this transaction is now in REP READ
+COMMIT AND NO CHAIN;
+
+SET @@completion_type=0;
+COMMIT AND NO CHAIN;
+
+
+#
+# Cleanup
+#
+SET @autocommit=1;
+COMMIT;
+
+disconnect con1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # End of test cases for Bug#20837
+--echo #
diff --git a/mysql-test/t/crash_commit_before-master.opt b/mysql-test/t/crash_commit_before-master.opt
index a745693594e..cd2ae9b1455 100644
--- a/mysql-test/t/crash_commit_before-master.opt
+++ b/mysql-test/t/crash_commit_before-master.opt
@@ -1,2 +1,3 @@
--skip-stack-trace --skip-core-file
-
+--default-storage-engine=MyISAM
+--innodb-file-per-table=0
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 383ba98ae6d..887ae4da404 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -102,6 +102,22 @@ create table t1 (`` int);
create table t1 (i int, index `` (i));
#
+# CREATE TABLE under LOCK TABLES
+#
+# We don't allow creation of non-temporary tables under LOCK TABLES
+# as following meta-data locking protocol in this case can lead to
+# deadlock.
+create table t1 (i int);
+lock tables t1 read;
+--error ER_TABLE_NOT_LOCKED
+create table t2 (j int);
+# OTOH creating of temporary table should be OK
+create temporary table t2 (j int);
+drop temporary table t2;
+unlock tables;
+drop table t1;
+
+#
# Test of CREATE ... SELECT with indexes
#
@@ -315,6 +331,26 @@ drop table t3;
drop database mysqltest;
#
+# CREATE TABLE LIKE under LOCK TABLES
+#
+# Similarly to ordinary CREATE TABLE we don't allow creation of
+# non-temporary tables under LOCK TABLES. Also we require source
+# table to be locked.
+create table t1 (i int);
+create table t2 (j int);
+lock tables t1 read;
+--error ER_TABLE_NOT_LOCKED
+create table t3 like t1;
+# OTOH creating of temporary table should be OK
+create temporary table t3 like t1;
+drop temporary table t3;
+# Source table should be locked
+--error ER_TABLE_NOT_LOCKED
+create temporary table t3 like t2;
+unlock tables;
+drop tables t1, t2;
+
+#
# Test default table type
#
SET SESSION storage_engine="heap";
@@ -1731,3 +1767,34 @@ DROP TABLE t1;
DROP TEMPORARY TABLE t2;
+
+--echo #
+--echo # Bug #22909 "Using CREATE ... LIKE is possible to create field
+--echo # with invalid default value"
+--echo #
+--echo # Altough original bug report suggests to use older version of MySQL
+--echo # for producing .FRM with invalid defaults we use sql_mode to achieve
+--echo # the same effect.
+--disable_warnings
+drop tables if exists t1, t2;
+--enable_warnings
+--echo # Attempt to create table with invalid default should fail in normal mode
+--error ER_INVALID_DEFAULT
+create table t1 (dt datetime default '2008-02-31 00:00:00');
+set @old_mode= @@sql_mode;
+set @@sql_mode='ALLOW_INVALID_DATES';
+--echo # The same should be possible in relaxed mode
+create table t1 (dt datetime default '2008-02-31 00:00:00');
+set @@sql_mode= @old_mode;
+--echo # In normal mode attempt to create copy of table with invalid
+--echo # default should fail
+--error ER_INVALID_DEFAULT
+create table t2 like t1;
+set @@sql_mode='ALLOW_INVALID_DATES';
+--echo # But should work in relaxed mode
+create table t2 like t1;
+--echo # Check that table definitions match
+show create table t1;
+show create table t2;
+set @@sql_mode= @old_mode;
+drop tables t1, t2;
diff --git a/mysql-test/t/ctype_utf8-master.opt b/mysql-test/t/ctype_utf8-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/ctype_utf8-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/ctype_utf8mb4-master.opt b/mysql-test/t/ctype_utf8mb4-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/ctype_utf8mb4-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/ctype_utf8mb4_innodb-master.opt b/mysql-test/t/ctype_utf8mb4_innodb-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/ctype_utf8mb4_innodb-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 7b14c332233..62d11e35922 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -10,9 +10,10 @@
#
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
-query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
-sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
-plugin_load : Bug#42144 2009-12-21 alik plugin_load fails
-partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings
+lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX
mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst
mysqlhotcopy_archive : bug#54129 2010-06-04 Horst
+plugin_load : Bug#42144 2009-12-21 alik plugin_load fails
+partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings
+query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
+sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index 5ef4a28b202..b5ca0817b6f 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -256,3 +256,20 @@ SHOW WARNINGS;
--echo # --
--echo # -- End of Bug#37431.
--echo # --
+
+
+--echo #
+--echo # Bug#54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+LOCK TABLE t1 WRITE;
+--error ER_NONUNIQ_TABLE
+DROP TABLE t1, t1;
+
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index 7a48a2e3231..f6edacfaa29 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -45,7 +45,6 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
-
--echo #
--echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string
--echo #
@@ -60,6 +59,36 @@ SET SESSION debug=DEFAULT;
DROP TABLE t1;
+-- echo #
+-- echo # Bug#41660: Sort-index_merge for non-first join table may require
+-- echo # O(#scans) memory
+-- echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+
+CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b));
+INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C;
+INSERT INTO t2 VALUES (1, 1, 'data');
+
+--echo # the example query uses LEFT JOIN only for the sake of being able to
+--echo # demonstrate the issue with a very small dataset. (left outer join
+--echo # disables the use of join buffering, so we get the second table
+--echo # re-scanned for every record in the outer table. if we used inner join,
+--echo # we would need to have thousands of records and/or more columns in both
+--echo # tables so that the join buffer is filled and re-scans are triggered).
+
+SET SESSION debug = '+d,only_one_Unique_may_be_created';
+
+--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+
+SET SESSION debug = DEFAULT;
+
+DROP TABLE t1, t2;
+
--echo #
--echo # End of 5.1 tests
--echo #
diff --git a/mysql-test/t/analyse.test b/mysql-test/t/func_analyse.test
index 05f739bfd69..05f739bfd69 100644
--- a/mysql-test/t/analyse.test
+++ b/mysql-test/t/func_analyse.test
diff --git a/mysql-test/t/func_digest.test b/mysql-test/t/func_digest.test
index 4020ef0f4fc..81f19c7e091 100644
--- a/mysql-test/t/func_digest.test
+++ b/mysql-test/t/func_digest.test
@@ -481,3 +481,16 @@ SELECT LENGTH(SHA2( '', 224 )) / 2 * 8 = 224;
SELECT LENGTH(SHA2( 'any', 256 )) / 2 * 8 = 256;
SELECT LENGTH(SHA2( 'size', 384 )) / 2 * 8 = 384;
SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512;
+
+--echo #
+--echo # Bug#54661 sha2() returns BINARY result
+--echo #
+--enable_metadata
+SET NAMES binary;
+SELECT sha2('1',224);
+SET NAMES utf8;
+SELECT sha2('1',224);
+SET NAMES latin1;
+SELECT sha2('1',224);
+--disable_metadata
+
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 61ae812d874..6efeb2866e6 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -540,5 +540,20 @@ EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
DROP TABLE t1;
--echo #
+--echo # Bug#54477: Crash on IN / CASE with NULL arguments
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+
+SELECT 1 IN (NULL, a) FROM t1;
+
+SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP;
+
+SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP;
+
+DROP TABLE t1;
+
+--echo #
--echo End of 5.1 tests
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index 741ea5533da..1204d04d9a0 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -112,5 +112,19 @@ select 'andre%' like 'andreÊ%' escape 'Ê';
#
select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê';
-#
-# End of 4.1 tests
+
+--echo End of 4.1 tests
+
+
+--echo #
+--echo # Bug #54575: crash when joining tables with unique set column
+--echo #
+CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
+CREATE TABLE t2(b INT PRIMARY KEY);
+INSERT INTO t1 VALUES ();
+INSERT INTO t2 VALUES (1), (2), (3);
+SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
+DROP TABLE t1, t2;
+
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index f90c1dc3c58..f46a20b2db4 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1224,3 +1224,26 @@ DROP TABLE t1, t2;
--echo #
--echo # End of 5.1 tests
+
+--echo #
+--echo # Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
+--echo #
+CREATE TABLE t1 (f1 int, f2 DATE);
+
+INSERT INTO t1 VALUES (1,'2004-04-19'), (1,'0000-00-00'), (1,'2004-04-18'),
+(2,'2004-05-19'), (2,'0001-01-01'), (3,'2004-04-10');
+
+SELECT MIN(f2),MAX(f2) FROM t1;
+SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 ( f1 int, f2 time);
+INSERT INTO t1 VALUES (1,'01:27:35'), (1,'06:11:01'), (2,'19:53:05'),
+(2,'21:44:25'), (3,'10:55:12'), (3,'05:45:11'), (4,'00:25:00');
+
+SELECT MIN(f2),MAX(f2) FROM t1;
+SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1;
+
+DROP TABLE t1;
+--echo #End of test#49771
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 65bf9518a5c..c808e747523 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -544,3 +544,24 @@ ORDER BY t1.f2;
DROP TABLE t1,t2;
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set
+--echo #
+
+CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (1,'f');
+
+CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1));
+INSERT INTO t2 VALUES (2,'m');
+INSERT INTO t2 VALUES (3,'m');
+INSERT INTO t2 VALUES (11,NULL);
+INSERT INTO t2 VALUES (12,'k');
+
+SELECT MAX(t1.f1) field1
+FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
+HAVING field1 < 7;
+
+DROP TABLE t1,t2;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/implicit_commit-master.opt b/mysql-test/t/implicit_commit-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/implicit_commit-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 456cacf2fe1..87022d65fcc 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1416,6 +1416,31 @@ DROP USER nonpriv;
DROP TABLE db1.t1;
DROP DATABASE db1;
+--echo
+--echo Bug#54422 query with = 'variables'
+--echo
+
+CREATE TABLE variables(f1 INT);
+SELECT COLUMN_DEFAULT, TABLE_NAME
+FROM INFORMATION_SCHEMA.COLUMNS
+WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
+DROP TABLE variables;
+
+--echo #
+--echo # Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19,
+--echo # should be 20
+--echo #
+
+CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
+
+SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION
+ FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
+
+INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+SELECT length(CAST(b AS CHAR)) FROM ubig;
+
+DROP TABLE ubig;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/innodb_mysql_lock2.test b/mysql-test/t/innodb_mysql_lock2.test
index 5111d56225a..4ad30b9f25b 100644
--- a/mysql-test/t/innodb_mysql_lock2.test
+++ b/mysql-test/t/innodb_mysql_lock2.test
@@ -3,10 +3,19 @@
# This test requires statement/mixed mode binary logging.
# Row-based mode puts weaker serializability requirements
# so weaker locks are acquired for it.
+# Also in ROW mode LOCK_S row locks won't be acquired for DML
+# and test for bug#51263 won't trigger execution path on which
+# this bug was encountered.
--source include/have_binlog_format_mixed_or_statement.inc
+# Original test case for bug#51263 needs partitioning.
+--source include/have_partition.inc
# Save the initial number of concurrent sessions.
--source include/count_sessions.inc
+--disable_query_log
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+--enable_query_log
+
--echo #
--echo # Test how do we handle locking in various cases when
--echo # we read data from InnoDB tables.
@@ -199,8 +208,7 @@ let $table= t1;
--echo # 1.1 Simple SELECT statement.
--echo #
--echo # No locks are necessary as this statement won't be written
---echo # to the binary log and thanks to how MyISAM works SELECT
---echo # will see version of the table prior to concurrent insert.
+--echo # to the binary log and InnoDB supports snapshots.
let $statement= select * from t1;
--source include/check_no_row_lock.inc
@@ -654,7 +662,7 @@ let $statement= call p2(@a);
--source include/check_no_row_lock.inc
--echo #
---echo # 5.2 Function that modifes data and uses CALL,
+--echo # 5.2 Function that modifies data and uses CALL,
--echo # which reads a table through SELECT.
--echo #
--echo # Since a call to such function is written to the binary
@@ -760,6 +768,104 @@ drop procedure p2;
drop table t1, t2, t3, t4, t5;
disconnect con1;
+
+--echo #
+--echo # Test for bug#51263 "Deadlock between transactional SELECT
+--echo # and ALTER TABLE ... REBUILD PARTITION".
+--echo #
+connect (con1,localhost,root,,test,,);
+connection default;
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+create table t1 (i int auto_increment not null primary key) engine=innodb;
+create table t2 (i int) engine=innodb;
+insert into t1 values (1), (2), (3), (4), (5);
+
+begin;
+--echo # Acquire SR metadata lock on t1 and LOCK_S row-locks on its rows.
+insert into t2 select count(*) from t1;
+
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # Sending:
+--send alter table t1 add column j int
+
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Wait until ALTER is blocked because it tries to upgrade SNW
+--echo # metadata lock to X lock.
+--echo # It should not be blocked during copying data to new version of
+--echo # table as it acquires LOCK_S locks on rows of old version, which
+--echo # are compatible with locks acquired by connection 'con1'.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist where state =
+ "Waiting for table" and info = "alter table t1 add column j int";
+--source include/wait_condition.inc
+
+--echo # The below statement will deadlock because it will try to acquire
+--echo # SW lock on t1, which will conflict with ALTER's SNW lock. And
+--echo # ALTER will be waiting for this connection to release its SR lock.
+--echo # This deadlock should be detected by an MDL subsystem and this
+--echo # statement should be aborted with an appropriate error.
+--error ER_LOCK_DEADLOCK
+insert into t1 values (6);
+--echo # Unblock ALTER TABLE.
+commit;
+
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # Reaping ALTER TABLE.
+--reap
+
+--echo # Switching to connection 'default'.
+connection default;
+
+--echo #
+--echo # Now test for scenario in which bug was reported originally.
+--echo #
+drop tables t1, t2;
+create table t1 (i int auto_increment not null primary key) engine=innodb
+ partition by hash (i) partitions 4;
+create table t2 (i int) engine=innodb;
+insert into t1 values (1), (2), (3), (4), (5);
+
+begin;
+--echo # Acquire SR metadata lock on t1.
+select * from t1;
+
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # Sending:
+--send alter table t1 rebuild partition p0
+
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Wait until ALTER is blocked because of active SR lock.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table" and info = "alter table t1 rebuild partition p0";
+--source include/wait_condition.inc
+
+--echo # The below statement should succeed as transaction
+--echo # has SR metadata lock on t1 and only going to read
+--echo # rows from it.
+insert into t2 select count(*) from t1;
+--echo # Unblock ALTER TABLE.
+commit;
+
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # Reaping ALTER TABLE.
+--reap
+
+--echo # Switching to connection 'default'.
+connection default;
+disconnect con1;
+--echo # Clean-up.
+drop tables 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/loaddata.test b/mysql-test/t/loaddata.test
index 27c4cc8a75c..06054d1990d 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -570,4 +570,36 @@ DROP TABLE t1;
connection default;
disconnect con1;
+
+--echo #
+--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
+--echo # and reverse() function
+--echo #
+
+--echo # Problem # 1 (original report): wrong parsing of ucs2 data
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+--echo # should return 2 zeroes (as the value is truncated)
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/tmpp.txt;
+
+
+--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+--echo # should return 0 and 1 (10 reversed)
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/lock_sync-master.opt b/mysql-test/t/lock_sync-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/lock_sync-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test
index 921ce991652..2f35da9d1ee 100644
--- a/mysql-test/t/lock_sync.test
+++ b/mysql-test/t/lock_sync.test
@@ -716,7 +716,7 @@ let $restore_table= ;
--source include/check_concurrent_insert.inc
--echo #
---echo # 5.2 Function that modifes data and uses CALL,
+--echo # 5.2 Function that modifies data and uses CALL,
--echo # which reads a table through SELECT.
--echo #
--echo # Since a call to such function is written to the binary
diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test
index b8c7f532cde..d8aa4e97fb3 100644
--- a/mysql-test/t/lowercase_table2.test
+++ b/mysql-test/t/lowercase_table2.test
@@ -16,7 +16,7 @@ DROP DATABASE IF EXISTS `test_$1`;
DROP DATABASE IF EXISTS mysqltest_LC2;
--enable_warnings
-CREATE TABLE T1 (a int);
+CREATE TABLE T1 (a int) ENGINE=MyISAM;
INSERT INTO T1 VALUES (1);
SHOW TABLES LIKE "T1";
SHOW TABLES LIKE "t1";
diff --git a/mysql-test/t/lowercase_view.test b/mysql-test/t/lowercase_view.test
index d6612b3e6b9..52be911cde0 100644
--- a/mysql-test/t/lowercase_view.test
+++ b/mysql-test/t/lowercase_view.test
@@ -160,4 +160,26 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
+--echo End of 5.0 tests.
+
+
+--echo #
+--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
+--echo # returns nothing
+--echo #
+
+CREATE TABLE `ttt` (
+ `f1` char(3) NOT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+
+SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
+'TTT';
+SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
+
+DROP TABLE `ttt`;
+
+
--echo End of 5.0 tests.
+
diff --git a/mysql-test/t/mdl_sync-master.opt b/mysql-test/t/mdl_sync-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/mdl_sync-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test
index 0b4b9af5bc6..19f9b396087 100644
--- a/mysql-test/t/mdl_sync.test
+++ b/mysql-test/t/mdl_sync.test
@@ -462,7 +462,11 @@ handler t1 open;
handler t1 close;
select column_name from information_schema.columns where
table_schema='test' and table_name='t1';
-select count(*) from t1;
+--echo # Disable result log to make test robust against
+--echo # effects of concurrent insert.
+--disable_result_log
+select * from t1;
+--enable_result_log
insert into t1 values (1);
--echo # Check that SNW lock is not compatible with SW lock.
--echo # Again we use ALTER TABLE which fails after opening
@@ -2407,6 +2411,7 @@ drop tables t1, t2;
--disable_warnings
drop tables if exists t0, t1, t2, t3, t4, t5;
--enable_warnings
+set debug_sync= 'RESET';
connect(deadlock_con1,localhost,root,,);
connect(deadlock_con2,localhost,root,,);
@@ -2696,6 +2701,136 @@ connection default;
drop table t2;
+--echo #
+--echo # Test that in situation when MDL subsystem detects a deadlock
+--echo # but it turns out that it can be resolved by backing-off locks
+--echo # acquired by one of participating transactions (which is
+--echo # possible when one of transactions consists only of currently
+--echo # executed statement, e.g. in autocommit mode) no error is
+--echo # reported.
+--echo #
+create table t1 (i int);
+create table t2 (j int);
+--echo # Ensure that the below SELECT stops once it has acquired metadata
+--echo # lock on table 't2'.
+set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
+--echo # Sending:
+--send select * from t2, t1
+
+--echo #
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Wait till SELECT acquires MDL on 't2' and starts waiting for signal.
+set debug_sync= 'now WAIT_FOR locked';
+--echo # Sending:
+--send lock tables t1 write, t2 write
+
+--echo #
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+--echo # Wait until LOCK TABLES acquires SNRW lock on 't1' and is blocked
+--echo # while trying to acquire SNRW lock on 't1'.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table" and info = "lock tables t1 write, t2 write";
+--source include/wait_condition.inc
+--echo # Resume SELECT execution, this should eventually unblock LOCK TABLES.
+set debug_sync= 'now SIGNAL finish';
+
+--echo #
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Reaping LOCK TABLES.
+--reap
+unlock tables;
+
+--echo #
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reaping SELECT. It succeed and not report ER_LOCK_DEADLOCK error.
+--reap
+
+drop tables t1, t2;
+
+--echo #
+--echo # Test coverage for situation in which a race has happened
+--echo # during deadlock detection process which led to unwarranted
+--echo # ER_LOCK_DEADLOCK error.
+--echo #
+create table t1 (i int);
+
+--echo # Ensure that ALTER waits once it has acquired SNW lock.
+set debug_sync='after_open_table_mdl_shared SIGNAL parked1 WAIT_FOR go1';
+--echo # Sending:
+--send alter table t1 add column j int
+
+--echo #
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Wait till ALTER acquires SNW lock and stops.
+set debug_sync='now WAIT_FOR parked1';
+--echo # Ensure that INSERT is paused once it detects that there is
+--echo # a conflicting metadata lock so it has to wait, but before
+--echo # deadlock detection is run.
+set debug_sync='mdl_acquire_lock_wait SIGNAL parked2 WAIT_FOR go2';
+--echo # Sending:
+--send insert into t1 values ()
+
+--echo #
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+--echo # Wait till INSERT is paused.
+set debug_sync='now WAIT_FOR parked2';
+--echo # Resume ALTER execution. Eventually it will release its
+--echo # metadata lock and INSERT's request for SW lock will be
+--echo # satisified.
+set debug_sync='now SIGNAL go1';
+
+--echo #
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reaping ALTER TABLE.
+--reap
+--echo # Add a new request for SNW lock to waiting graph.
+--echo # Sending:
+--send alter table t1 drop column j
+
+--echo #
+--echo # Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
+--echo # Wait until ALTER is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table" and info = "alter table t1 drop column j";
+--source include/wait_condition.inc
+--echo # Resume INSERT so it can start deadlock detection.
+--echo #
+--echo # At this point there is a discrepancy between the fact that INSERT's
+--echo # SW lock is already satisfied, but INSERT's connection is still
+--echo # marked as waiting for it. Looking for a loop in waiters graph
+--echo # without additional checks has detected a deadlock (INSERT waits
+--echo # for SW lock; which is not granted because of pending SNW lock from
+--echo # ALTER; which waits for active SW lock from INSERT). Since requests
+--echo # for SW and SNW locks have same weight ALTER was selected as a victim
+--echo # and ended with ER_LOCK_DEADLOCK error.
+set debug_sync='now SIGNAL go2';
+
+--echo #
+--echo # Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
+--echo # Reaping INSERT.
+--reap
+
+--echo #
+--echo # Switching to connection 'default'.
+connection default;
+--echo # Reaping ALTER. It should succeed and not produce ER_LOCK_DEADLOCK.
+--reap
+
+drop table t1;
+
+set debug_sync= 'RESET';
+
disconnect deadlock_con1;
disconnect deadlock_con2;
disconnect deadlock_con3;
@@ -3093,7 +3228,7 @@ set debug_sync='after_lock_tables_takes_lock SIGNAL alter_table_locked WAIT_FOR
--echo # Switching to connection 'default'.
connection default;
set debug_sync='now WAIT_FOR alter_table_locked';
-set debug_sync='before_open_table_wait_refresh SIGNAL alter_go';
+set debug_sync='mdl_acquire_lock_wait SIGNAL alter_go';
--echo # The below statement should get ER_LOCK_DEADLOCK error
--echo # (i.e. it should not allow ALTER to proceed, and then
--echo # fail due to 't1' changing its name to 't2').
@@ -3469,6 +3604,86 @@ set debug_sync= 'RESET';
drop table t1;
--echo #
+--echo # Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
+--echo #
+--echo # Ensure that a acquired lock is not given up due to a conflict.
+--echo #
+
+connect (con1,localhost,root,,test,,);
+connect (con2,localhost,root,,test,,);
+connect (con3,localhost,root,,test,,);
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+
+--echo # Connection: con1
+connection con1;
+SET debug_sync='lock_table_for_truncate SIGNAL parked_truncate WAIT_FOR go_truncate';
+send TRUNCATE TABLE t1;
+
+connection default;
+--echo # Connection: default
+SET debug_sync='now WAIT_FOR parked_truncate';
+
+connection con2;
+--echo # Connection: con2
+SET debug_sync='after_open_table_ignore_flush SIGNAL parked_show WAIT_FOR go_show';
+send SHOW FIELDS FROM t1;
+
+connection default;
+--echo # Connection: default
+SET debug_sync='now WAIT_FOR parked_show';
+
+connection con3;
+--echo # Connection: con3
+SET debug_sync='after_flush_unlock SIGNAL parked_flush WAIT_FOR go_flush';
+send FLUSH TABLES t1;
+
+connection default;
+--echo # Connection: default
+SET debug_sync='now WAIT_FOR parked_flush';
+SET debug_sync='now SIGNAL go_truncate';
+
+connection con1;
+--echo # Connection: con1
+--echo # Reaping...
+reap;
+
+connection default;
+--echo # Connection: default
+SET debug_sync= 'now SIGNAL go_show';
+
+connection con2;
+--echo # Connection: con2 (SHOW FIELDS FROM t1)
+--echo # Reaping...
+reap;
+
+connection default;
+--echo # Connection: default
+SET debug_sync= 'now SIGNAL go_flush';
+
+connection con3;
+--echo # Connection: con3 (FLUSH TABLES t1)
+--echo # Reaping...
+reap;
+
+disconnect con1;
+disconnect con2;
+disconnect con3;
+
+connection default;
+--echo # Connection: default
+SET debug_sync= 'RESET';
+DROP TABLE t1;
+
+
+--echo #
--echo # Bug#52856 concurrent show columns or show full columns causes a crash!!!
--echo #
CREATE TABLE t1(a CHAR(255));
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index a9d98da0403..a06da03cbcd 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -457,7 +457,7 @@ CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t2;
DROP TABLE t1, t2;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM t2;
DROP TABLE t2;
@@ -549,11 +549,11 @@ drop table t1;
# CREATE TABLE fails
#
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM tm1;
CHECK TABLE tm1;
CREATE TABLE t1(a INT);
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM tm1;
CHECK TABLE tm1;
CREATE TABLE t2(a BLOB);
@@ -887,6 +887,9 @@ CREATE TABLE t4 LIKE t3;
SHOW CREATE TABLE t4;
--error ER_TABLE_NOT_LOCKED
INSERT INTO t4 VALUES (4);
+--echo # Temporary tables can be created in spite of LOCK TABLES.
+--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;
@@ -913,7 +916,7 @@ DROP TABLE t4;
--echo # 2. Normal rename.
SELECT * FROM t3 ORDER BY c1;
RENAME TABLE t2 TO t5;
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM t3 ORDER BY c1;
RENAME TABLE t5 TO t2;
SELECT * FROM t3 ORDER BY c1;
@@ -931,7 +934,7 @@ UNLOCK TABLES;
--echo #
--echo # 4. Alter table rename.
ALTER TABLE t2 RENAME TO t5;
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM t3 ORDER BY c1;
ALTER TABLE t5 RENAME TO t2;
SELECT * FROM t3 ORDER BY c1;
@@ -1170,6 +1173,7 @@ SELECT @a;
SELECT * FROM t4 ORDER BY c1;
DELETE FROM t4 WHERE c1 = 33;
DROP TRIGGER t3_ai;
+UNLOCK TABLES;
--echo #
--echo # Trigger with table use on child
DELETE FROM t4 WHERE c1 = 4;
@@ -1273,11 +1277,12 @@ DROP TABLE t1, t2, t3;
#
# Bug#25038 - Waiting TRUNCATE
+# Truncate failed with error message when table was in use by MERGE.
#
# Show that truncate of child table after use of parent table works.
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2);
+CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
+CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t3;
@@ -1429,7 +1434,6 @@ FLUSH TABLES m1, t1;
UNLOCK TABLES;
DROP TABLE t1, m1;
-
#
# Bug#35068 - Assertion fails when reading from i_s.tables
# and there is incorrect merge table
@@ -1816,7 +1820,7 @@ CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,mysql_test1.t2)
INSERT INTO t1 VALUES (1);
INSERT INTO mysql_test1.t2 VALUES (2);
SELECT * FROM m1;
-#--copy_file $MYSQLTEST_VARDIR/master-data/test/m1.MRG /tmp/mysql-test-m1.MRG
+#--copy_file $MYSQLTEST_DATADIR/test/m1.MRG /tmp/mysql-test-m1.MRG
DROP TABLE t1, mysql_test1.t2, m1;
DROP DATABASE mysql_test1;
#
@@ -2105,6 +2109,14 @@ DROP FUNCTION f1;
DROP TABLE tm1, t1, t2, t3, t4, t5;
--echo #
+--echo # Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
+--echo #
+CREATE TEMPORARY TABLE t1 (c1 INT);
+ALTER TABLE t1 ENGINE=MERGE UNION(t_not_exists,t1);
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
+--echo #
--echo # Bug47098 assert in MDL_context::destroy on HANDLER
--echo # <damaged merge table> OPEN
--echo #
@@ -2186,6 +2198,33 @@ ALTER TABLE m1 ADD INDEX (c1);
UNLOCK TABLES;
DROP TABLE m1, t1;
+--echo #
+--echo # If children are to be altered, they need an explicit lock.
+--echo #
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1);
+LOCK TABLE m1 WRITE;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+ALTER TABLE t1 ADD INDEX (c1);
+LOCK TABLE m1 WRITE, t1 WRITE;
+ALTER TABLE t1 ADD INDEX (c1);
+UNLOCK TABLES;
+DROP TABLE m1, t1;
+
+--echo #
+--echo # Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter"
+--echo #
+--disable_warnings
+drop tables if exists t1, m1, m2;
+--enable_warnings
+create table t1 (i int) engine=myisam;
+create table m1 (i int) engine=mrg_myisam union=(t1) insert_method=first;
+create table m2 like m1;
+--echo # Table definitions should match
+show create table m1;
+show create table m2;
+drop tables m1, m2, t1;
+
--echo End of 6.0 tests
diff --git a/mysql-test/t/mysql-bug45236-master.opt b/mysql-test/t/mysql-bug45236-master.opt
deleted file mode 100644
index fc1887bca47..00000000000
--- a/mysql-test/t/mysql-bug45236-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-skip-safemalloc
diff --git a/mysql-test/t/mysql_delimiter_19799.sql b/mysql-test/t/mysql_delimiter_19799.sql
index 2a3d4378492..2a3d4378492 100755..100644
--- a/mysql-test/t/mysql_delimiter_19799.sql
+++ b/mysql-test/t/mysql_delimiter_19799.sql
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 83d97954222..3ea612d2ca7 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -108,6 +108,23 @@ DROP PROCEDURE testproc;
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt
+
+--echo #
+--echo # Bug #53613: mysql_upgrade incorrectly revokes
+--echo # TRIGGER privilege on given table
+--echo #
+
+GRANT USAGE ON *.* TO 'user3'@'%';
+GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
+--echo Run mysql_upgrade with all privileges on a user
+--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+SHOW GRANTS FOR 'user3'@'%';
+
+DROP USER 'user3'@'%';
+
+--echo End of 5.1 tests
+
+
#
# Test the --upgrade-system-tables option
#
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 8b250dbb586..e375cb7299f 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -36,6 +36,7 @@ load data infile '../../std_data/words.dat' into table t1;
load data infile '../../std_data/words.dat' into table t1;
load data infile '../../std_data/words.dat' into table t1;
# simple query to show more in second binlog
+--let $binlog_start_pos=query_get_value(SHOW MASTER STATUS, Position, 1)
insert into t1 values ("Alas");
flush logs;
@@ -75,7 +76,7 @@ select "--- --start-position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=1074 $MYSQLD_DATADIR/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -111,8 +112,7 @@ select "--- --start-position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --start-position=1074 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
-
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --start-position=$binlog_start_pos --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log
@@ -124,7 +124,9 @@ select "--- reading stdin --" as "";
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --start-position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
+# postion is constant to correspond to an event in pre-recorded binlog
+--let $binlog_start_pos=79
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start_pos - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
drop table t1,t2;
#
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index 1f0da6bcf54..dcd92262a83 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -21,7 +21,9 @@ create table t1 (a int auto_increment not null primary key, b char(3));
insert into t1 values(null, "a");
insert into t1 values(null, "b");
set timestamp=@a+2;
+--let $binlog_pos_760=query_get_value(SHOW MASTER STATUS, Position, 1)
insert into t1 values(null, "c");
+--let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 4)
set timestamp=@a+4;
insert into t1 values(null, "d");
insert into t1 values(null, "e");
@@ -29,6 +31,8 @@ insert into t1 values(null, "e");
flush logs;
set timestamp=@a+1; # this could happen on a slave
insert into t1 values(null, "f");
+--let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 3)
+--let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4)
# delimiters are for easier debugging in future
@@ -50,15 +54,15 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=760 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=760 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=760 --stop-position 951 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -84,11 +88,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=760 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=203 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_203 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -111,15 +115,15 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=760 --stop-position 951 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -142,11 +146,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
diff --git a/mysql-test/t/mysqldump-max-master.opt b/mysql-test/t/mysqldump-max-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/mysqldump-max-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index e6c9c8b423f..d477843b22b 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -732,3 +732,4 @@ DROP TABLE t1, t2, t3;
--echo #
--echo # End of 5.1 tests
--echo #
+
diff --git a/mysql-test/t/parser_not_embedded.test b/mysql-test/t/parser_not_embedded.test
index 8ebeb9a8301..22e9ae5a140 100644
--- a/mysql-test/t/parser_not_embedded.test
+++ b/mysql-test/t/parser_not_embedded.test
@@ -24,3 +24,78 @@ EOF
--exec $MYSQL --comment --force --table test <$MYSQLTEST_VARDIR/tmp/bug39559.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug39559.sql
+--echo # Bug#46527 "COMMIT AND CHAIN RELEASE does not make sense"
+--echo #
+--error ER_PARSE_ERROR
+COMMIT AND CHAIN RELEASE;
+
+COMMIT AND NO CHAIN RELEASE;
+disconnect default;
+connect(default, localhost, root,,);
+
+COMMIT RELEASE;
+disconnect default;
+connect(default, localhost, root,,);
+
+--error ER_PARSE_ERROR
+COMMIT CHAIN RELEASE;
+
+--error ER_PARSE_ERROR
+COMMIT NO CHAIN RELEASE;
+
+--error ER_PARSE_ERROR
+COMMIT AND NO RELEASE;
+--error ER_PARSE_ERROR
+COMMIT AND RELEASE;
+
+COMMIT NO RELEASE;
+--error ER_PARSE_ERROR
+COMMIT CHAIN NO RELEASE;
+--error ER_PARSE_ERROR
+COMMIT NO CHAIN NO RELEASE;
+
+--error ER_PARSE_ERROR
+COMMIT AND RELEASE CHAIN;
+
+COMMIT AND NO CHAIN NO RELEASE;
+
+--error ER_PARSE_ERROR
+ROLLBACK AND CHAIN RELEASE;
+
+ROLLBACK AND NO CHAIN RELEASE;
+disconnect default;
+connect(default, localhost, root,,);
+
+ROLLBACK RELEASE;
+disconnect default;
+connect(default, localhost, root,,);
+
+--error ER_PARSE_ERROR
+ROLLBACK CHAIN RELEASE;
+
+--error ER_PARSE_ERROR
+ROLLBACK NO CHAIN RELEASE;
+disconnect default;
+connect(default, localhost, root,,);
+
+--error ER_PARSE_ERROR
+ROLLBACK AND NO RELEASE;
+
+--error ER_PARSE_ERROR
+ROLLBACK AND RELEASE;
+
+ROLLBACK NO RELEASE;
+
+--error ER_PARSE_ERROR
+ROLLBACK CHAIN NO RELEASE;
+
+--error ER_PARSE_ERROR
+ROLLBACK NO CHAIN NO RELEASE;
+--error ER_PARSE_ERROR
+ROLLBACK AND RELEASE CHAIN;
+
+ROLLBACK AND NO CHAIN NO RELEASE;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 6400017dfb7..30f5894716c 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -1,3 +1,4 @@
+--source include/not_embedded.inc
--source include/have_partition.inc
--source include/have_innodb.inc
@@ -451,3 +452,19 @@ SELECT * FROM t1;
COMMIT;
DROP TABLE t1;
--enable_parsing
+
+--echo #
+--echo # Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00')
+ ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1;
+SET @old_mode = @@sql_mode;
+SET SESSION sql_mode = 'NO_ZERO_DATE';
+OPTIMIZE TABLE t1;
+SET SESSION sql_mode = @old_mode;
+DROP TABLE t1;
diff --git a/mysql-test/t/partition_innodb_semi_consistent-master.opt b/mysql-test/t/partition_innodb_semi_consistent-master.opt
index e76299453d3..9655b180fbd 100644
--- a/mysql-test/t/partition_innodb_semi_consistent-master.opt
+++ b/mysql-test/t/partition_innodb_semi_consistent-master.opt
@@ -1 +1 @@
---innodb_lock_wait_timeout=2
+--innodb_lock_wait_timeout=2 --default-storage-engine=MyISAM
diff --git a/mysql-test/t/partition_innodb_semi_consistent.test b/mysql-test/t/partition_innodb_semi_consistent.test
index 294521a45d5..7f6b3d48c63 100644
--- a/mysql-test/t/partition_innodb_semi_consistent.test
+++ b/mysql-test/t/partition_innodb_semi_consistent.test
@@ -31,6 +31,7 @@ set session transaction isolation level repeatable read;
set autocommit=0;
-- error ER_LOCK_WAIT_TIMEOUT
update t1 set a=10 where a=5;
+commit;
connection a;
#DELETE FROM t1 WHERE a=5;
commit;
@@ -101,6 +102,7 @@ connection con2;
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t1 SET b = 21 WHERE a = 1;
--disable_info
+ROLLBACK;
--echo # Switch to connection con1
connection con1;
@@ -150,6 +152,7 @@ SELECT * FROM t1;
connection con2;
--reap
SELECT * FROM t1;
+COMMIT;
--echo # Switch to connection con1
connection con1;
diff --git a/mysql-test/t/ps_3innodb-master.opt b/mysql-test/t/ps_3innodb-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/ps_3innodb-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test
index 5aa1a51a90f..bb90cbafd74 100644
--- a/mysql-test/t/rename.test
+++ b/mysql-test/t/rename.test
@@ -79,17 +79,15 @@ connection default;
--echo End of 4.1 tests
-#
-# Bug#14959: ALTER TABLE isn't able to rename a view
-#
+--echo #
+--echo # Bug#14959: "ALTER TABLE isn't able to rename a view"
+--echo # Bug#53976: "ALTER TABLE RENAME is allowed on views
+--echo # (not documented, broken)"
+--echo #
create table t1(f1 int);
create view v1 as select * from t1;
+--error ER_WRONG_OBJECT
alter table v1 rename to v2;
---error ER_NO_SUCH_TABLE
-alter table v1 rename to v2;
-rename table v2 to v1;
---error ER_TABLE_EXISTS_ERROR
-rename table v2 to v1;
drop view v1;
drop table t1;
diff --git a/mysql-test/t/rpl_mysqldump_slave.test b/mysql-test/t/rpl_mysqldump_slave.test
index 5723f1282aa..8f27646ba08 100644
--- a/mysql-test/t/rpl_mysqldump_slave.test
+++ b/mysql-test/t/rpl_mysqldump_slave.test
@@ -15,11 +15,14 @@ use test;
connection slave;
# Execute mysqldump with --dump-slave
+--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--exec $MYSQL_DUMP_SLAVE --compact --dump-slave test
# Execute mysqldump with --dump-slave and --apply-slave-statements
+--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements test
+--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--replace_result $MASTER_MYPORT MASTER_MYPORT
# Execute mysqldump with --dump-slave ,--apply-slave-statements and --include-master-host-port
--exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements --include-master-host-port test
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 1e53461f665..495b6002986 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -4117,4 +4117,38 @@ SELECT * FROM t1 WHERE 102 < c;
DROP TABLE t1;
+--echo #
+--echo # Bug #54459: Assertion failed: param.sort_length,
+--echo # file .\filesort.cc, line 149 (part II)
+--echo #
+CREATE TABLE t1(a ENUM('') NOT NULL);
+INSERT INTO t1 VALUES (), (), ();
+EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
+
+--echo #
+--echo # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on
+--echo # SELECT from VIEW with GROUP BY
+--echo #
+
+CREATE TABLE t1 (
+ col_int_key int DEFAULT NULL,
+ KEY int_key (col_int_key)
+) ;
+
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE VIEW view_t1 AS
+ SELECT t1.col_int_key AS col_int_key
+ FROM t1;
+
+SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
+
+DROP VIEW view_t1;
+DROP TABLE t1;
+
+--echo # End of test BUG#54515
diff --git a/mysql-test/t/single_delete_update.test b/mysql-test/t/single_delete_update.test
new file mode 100644
index 00000000000..e3ee13f891c
--- /dev/null
+++ b/mysql-test/t/single_delete_update.test
@@ -0,0 +1,481 @@
+#
+# Single table specific update/delete tests (mysql_update and mysql_delete)
+#
+
+--echo #
+--echo # Bug #30584: delete with order by and limit clauses does not use
+--echo # limit efficiently
+--echo #
+
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
+ (20),(21),(22),(23),(24),(25);
+
+CREATE TABLE t2(a INT, i INT PRIMARY KEY);
+INSERT INTO t2 (i) SELECT i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+
+DROP TABLE t2;
+
+--echo #
+--echo # index on field prefix:
+--echo #
+
+CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1)));
+INSERT INTO t2 (i) SELECT i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+
+DROP TABLE t2;
+
+--echo #
+--echo # constant inside ORDER BY list, should use filesort
+--echo # on a small table
+--echo #
+
+CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
+INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`;
+
+FLUSH STATUS;
+DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+--echo ## should be 5 (previous LIMIT)
+eval SELECT $cnt - COUNT(*) FROM t2 WHERE b = 10;
+
+DROP TABLE t2;
+
+--echo #
+--echo # same test as above (constant inside ORDER BY list), but with
+--echo # a larger table - should not use filesort
+--echo #
+
+CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
+INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
+
+INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`;
+
+FLUSH STATUS;
+DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+--echo ## should be 5 (previous LIMIT)
+eval SELECT $cnt - COUNT(*) FROM t2 WHERE b = 10;
+
+DROP TABLE t2;
+
+--echo #
+--echo # as above + partial index, should use filesort
+--echo #
+
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c));
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
+
+DROP TABLE t2;
+
+--echo #
+--echo # as above but index is without HA_READ_ORDER flag, should use filesort
+--echo #
+
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP;
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
+
+DROP TABLE t2;
+
+--echo #
+--echo # quick select is Index Merge, should use filesort
+--echo #
+
+CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2));
+INSERT INTO t2 (key1, key2) SELECT i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+
+FLUSH STATUS;
+DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+DROP TABLE t2;
+
+--echo #
+--echo # reverse quick select, should not use filesort
+--echo #
+
+CREATE TABLE t2(a INT, i INT PRIMARY KEY);
+INSERT INTO t2 (i) SELECT i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+
+DROP TABLE t2;
+
+--echo #
+--echo # mixed sorting direction, should use filesort
+--echo #
+
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
+INSERT INTO t2 SELECT i, i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+DELETE FROM t2 ORDER BY a, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 ORDER BY a, b DESC;
+
+DROP TABLE t2;
+
+--echo #
+--echo # LIMIT with no WHERE and DESC direction, should not use filesort
+--echo #
+
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
+INSERT INTO t2 (a, b) SELECT i, i FROM t1;
+INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2;
+
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a, b LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC;
+
+DROP TABLE t1, t2;
+
+
+--echo #
+--echo # Bug #36569: UPDATE ... WHERE ... ORDER BY... always does a filesort
+--echo # even if not required
+--echo #
+
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
+ (20),(21),(22),(23),(24),(25);
+
+CREATE TABLE t2(a INT, i INT PRIMARY KEY);
+INSERT INTO t2 (i) SELECT i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+
+DROP TABLE t2;
+
+--echo #
+--echo # index on field prefix:
+--echo #
+
+CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1)));
+INSERT INTO t2 (i) SELECT i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+
+DROP TABLE t2;
+
+--echo #
+--echo # constant inside ORDER BY list, should use filesort
+--echo # on a small table
+--echo #
+
+CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
+INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`;
+
+FLUSH STATUS;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+--echo ## should be 5 (previous LIMIT)
+SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c;
+
+DROP TABLE t2;
+
+--echo #
+--echo # same test as above (constant inside ORDER BY list), but with
+--echo # a larger table - should not use filesort
+--echo #
+
+CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
+INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
+
+INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`;
+
+FLUSH STATUS;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+--echo ## should be 5 (previous LIMIT)
+SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c;
+
+DROP TABLE t2;
+
+--echo #
+--echo # as above + partial index, should use filesort
+--echo #
+
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c));
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
+
+DROP TABLE t2;
+
+--echo #
+--echo # as above but index is without HA_READ_ORDER flag, should use filesort
+--echo #
+
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP;
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
+
+DROP TABLE t2;
+
+--echo #
+--echo # quick select is Index Merge, should use filesort
+--echo #
+
+CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2));
+INSERT INTO t2 (key1, key2) SELECT i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+
+FLUSH STATUS;
+UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
+
+DROP TABLE t2;
+
+--echo #
+--echo # reverse quick select, should not use filesort
+--echo #
+
+CREATE TABLE t2(a INT, i INT PRIMARY KEY);
+INSERT INTO t2 (i) SELECT i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
+
+DROP TABLE t2;
+
+--echo #
+--echo # mixed sorting direction, should use filesort
+--echo #
+
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
+INSERT INTO t2 SELECT i, i, i FROM t1;
+
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE c = 10 ORDER BY a, b DESC;
+
+DROP TABLE t2;
+
+--echo #
+--echo # LIMIT with no WHERE and DESC direction, should not use filesort
+--echo #
+
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
+INSERT INTO t2 (a, b) SELECT i, i FROM t1;
+INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2;
+
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a, b LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+
+FLUSH STATUS;
+UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5;
+SHOW SESSION STATUS LIKE 'Sort%';
+SHOW STATUS LIKE 'Handler_read_%';
+SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC;
+
+DROP TABLE t1, t2;
+
+
+--echo #
+--echo # Bug #53742: UPDATEs have no effect after applying patch for bug 36569
+--echo #
+
+--disable_warnings
+CREATE TABLE t1 (
+ pk INT NOT NULL AUTO_INCREMENT,
+ c1_idx CHAR(1) DEFAULT 'y',
+ c2 INT,
+ PRIMARY KEY (pk),
+ INDEX c1_idx (c1_idx)
+) ENGINE=InnoDB;
+--enable_warnings
+
+INSERT INTO t1 VALUES (), (), (), ();
+
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
+
+DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
+SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/sp_sync.test b/mysql-test/t/sp_sync.test
index 391298b604a..431db463b67 100644
--- a/mysql-test/t/sp_sync.test
+++ b/mysql-test/t/sp_sync.test
@@ -108,38 +108,35 @@ disconnect con3;
--echo # Bug #48246 assert in close_thread_table
--echo #
+CREATE TABLE t0 (b INTEGER);
CREATE TABLE t1 (a INTEGER);
CREATE FUNCTION f1(b INTEGER) RETURNS INTEGER RETURN 1;
-CREATE PROCEDURE p1() SELECT COUNT(f1(a)) FROM t1;
+CREATE PROCEDURE p1() SELECT COUNT(f1(a)) FROM t1, t0;
+INSERT INTO t0 VALUES(1);
INSERT INTO t1 VALUES(1), (2);
--echo # Connection 2
connect (con2, localhost, root);
CALL p1();
---echo # Connection default
-connection default;
-SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR called';
---echo # Sending:
---send CREATE TABLE t1 (a INTEGER)
-
---echo # Connection 2
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
-SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL called WAIT_FOR created';
---echo # This call used to cause an assertion. MDL locking conflict will
---echo # cause back-off and retry. A variable indicating if a prelocking list
---echo # exists, used to be not reset properly causing an eventual assert.
+SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked_t1 WAIT_FOR go_for_t0';
+--echo # This call used to cause an assertion. MDL deadlock with upcoming
+--echo # LOCK TABLES statement will cause back-off and retry.
+--echo # A variable indicating if a prelocking list exists, used to be not
+--echo # reset properly causing an eventual assert.
--echo # Sending:
--send CALL p1()
--echo # Connection default
connection default;
---echo # Reaping: CREATE TABLE t1 (a INTEGER)
---error ER_TABLE_EXISTS_ERROR
---reap
-SET DEBUG_SYNC= 'now SIGNAL created';
+SET DEBUG_SYNC= 'now WAIT_FOR locked_t1';
+--echo # Issue LOCK TABLES statement which will enter in MDL deadlock
+--echo # with CALL statement and as result will cause it to perform
+--echo # back-off and retry.
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL go_for_t0';
+LOCK TABLES t0 WRITE, t1 WRITE;
+UNLOCK TABLES;
--echo # Connection 2
connection con2;
@@ -151,7 +148,7 @@ connection default;
disconnect con2;
DROP PROCEDURE p1;
DROP FUNCTION f1;
-DROP TABLE t1;
+DROP TABLES t0, t1;
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test
index f162ee5cea6..972c3dd36eb 100644
--- a/mysql-test/t/sp_trans_log.test
+++ b/mysql-test/t/sp_trans_log.test
@@ -34,7 +34,10 @@ end|
reset master|
--error ER_DUP_ENTRY
insert into t2 values (bug23333(),1)|
-# the following must show there is (are) events after the query */
+# the following must show there are events after the query
+# the binlog_limit is used to hide the differences between the mixed
+# and row logging formats after BUG#53259
+let $binlog_limit= 0, 4|
source include/show_binlog_events.inc|
select count(*),@a from t1 /* must be 1,1 */|
diff --git a/mysql-test/t/strict-master.opt b/mysql-test/t/strict-master.opt
new file mode 100644
index 00000000000..96f0ce3f36c
--- /dev/null
+++ b/mysql-test/t/strict-master.opt
@@ -0,0 +1 @@
+--default-storage-engine=MyISAM
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 06aaf5dfb7f..2e442e7f897 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3921,3 +3921,28 @@ GROUP BY
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug #52711: Segfault when doing EXPLAIN SELECT with
+--echo # union...order by (select... where...)
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+
+--echo # Should not crash
+--disable_result_log
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+
+--echo # Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+--enable_result_log
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 440eca22828..fb0f58bf804 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -62,3 +62,32 @@ FROM t3 WHERE 1 = 0 GROUP BY 1;
DROP TABLE t1,t2,t3;
--echo End of 5.0 tests.
+
+--echo #
+--echo # Bug#53236 Segfault in DTCollation::set(DTCollation&)
+--echo #
+
+CREATE TABLE t1 (
+ pk INTEGER AUTO_INCREMENT,
+ col_varchar VARCHAR(1),
+ PRIMARY KEY (pk)
+)
+;
+
+INSERT INTO t1 (col_varchar)
+VALUES
+('w'),
+('m')
+;
+
+SELECT table1.pk
+FROM ( t1 AS table1 JOIN t1 AS table2 ON (table1.col_varchar =
+ table2.col_varchar) )
+WHERE ( 1, 2 ) IN ( SELECT SUBQUERY1_t1.pk AS SUBQUERY1_field1,
+ SUBQUERY1_t1.pk AS SUBQUERY1_field2
+ FROM ( t1 AS SUBQUERY1_t1 JOIN t1 AS SUBQUERY1_t2
+ ON (SUBQUERY1_t2.col_varchar =
+ SUBQUERY1_t1.col_varchar) ) )
+;
+
+drop table t1;
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index cdfa448f78a..c7a066cc203 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -102,7 +102,7 @@ SELECT * FROM v1;
LOCK TABLE t1 WRITE;
--error ER_TABLE_NOT_LOCKED
SELECT * FROM v1;
---error ER_NO_SUCH_TABLE
+--error ER_TABLE_NOT_LOCKED
TRUNCATE v1;
--error ER_TABLE_NOT_LOCKED
SELECT * FROM v1;
@@ -111,7 +111,7 @@ UNLOCK TABLES;
LOCK TABLE t1 WRITE, t2 WRITE;
--error ER_TABLE_NOT_LOCKED
SELECT * FROM v1;
---error ER_NO_SUCH_TABLE
+--error ER_TABLE_NOT_LOCKED
TRUNCATE v1;
--error ER_TABLE_NOT_LOCKED
SELECT * FROM v1;
@@ -119,14 +119,14 @@ UNLOCK TABLES;
#
LOCK TABLE v1 WRITE;
SELECT * FROM v1;
---error ER_NO_SUCH_TABLE
+--error ER_TABLE_NOT_LOCKED
TRUNCATE v1;
SELECT * FROM v1;
UNLOCK TABLES;
#
LOCK TABLE t1 WRITE, t2 WRITE, v1 WRITE;
SELECT * FROM v1;
---error ER_NO_SUCH_TABLE
+--error ER_TABLE_NOT_LOCKED
TRUNCATE v1;
SELECT * FROM v1;
UNLOCK TABLES;
diff --git a/mysql-test/t/truncate_coverage.test b/mysql-test/t/truncate_coverage.test
index b7c08b03c8b..c9c4bd90ca4 100644
--- a/mysql-test/t/truncate_coverage.test
+++ b/mysql-test/t/truncate_coverage.test
@@ -55,6 +55,12 @@ let $invisible_assignment_in_select = `SELECT @id := $ID`;
KILL QUERY @id;
--disconnect con2
--echo #
+--echo # connection default
+--connection default
+--error ER_QUERY_INTERRUPTED
+reap;
+UNLOCK TABLES;
+--echo #
--echo # connection con1
--connection con1
--echo # Release shared metadata lock by closing HANDLER.
@@ -63,9 +69,6 @@ HANDLER t1 CLOSE;
--echo #
--echo # connection default
--connection default
---error ER_QUERY_INTERRUPTED
-reap;
-UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
########
@@ -151,13 +154,20 @@ send TRUNCATE TABLE t1;
SET DEBUG_SYNC='now WAIT_FOR waiting';
let $invisible_assignment_in_select = `SELECT @id := $ID`;
KILL QUERY @id;
-COMMIT;
---disconnect con1
--echo #
--echo # connection default
--connection default
--error ER_QUERY_INTERRUPTED
reap;
+--echo #
+--echo # connection con1
+--connection con1
+--echo # Release SW lock by committing transaction.
+COMMIT;
+--disconnect con1
+--echo #
+--echo # connection default
+--connection default
UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index f6708828a6b..c515f8873d8 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -483,3 +483,23 @@ UPDATE IGNORE v1 SET a = 1;
SET SESSION sql_safe_updates = DEFAULT;
DROP TABLE t1;
DROP VIEW v1;
+
+--echo #
+--echo # Bug#54734 assert in Diagnostics_area::set_ok_status
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, not_exists;
+DROP FUNCTION IF EXISTS f1;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk;
+CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists);
+CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13;
+--error ER_VIEW_INVALID
+UPDATE v1 SET pk = 7 WHERE pk > 0;
+
+DROP VIEW v1;
+DROP FUNCTION f1;
+DROP TABLE t1;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 4ef8b1898ae..c0564a82b23 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3902,6 +3902,7 @@ drop procedure p;
--echo #
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT a FROM t1;
+--error ER_WRONG_OBJECT
ALTER TABLE v1;
DROP VIEW v1;
DROP TABLE t1;
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
index b7d31948d23..b7d31948d23 100755..100644
--- a/mysql-test/t/windows.test
+++ b/mysql-test/t/windows.test
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 4c93f5ffd57..83615c82e2a 100755..100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -29,10 +29,10 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c default_
my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c
my_lib.c my_lock.c my_lockmem.c my_malloc.c my_mess.c
my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c
- my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_sleep.c
+ my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c
my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c
my_write.c ptr_cmp.c queues.c stacktrace.c
- rijndael.c safemalloc.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
+ rijndael.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c
lf_alloc-pin.c lf_dynarray.c lf_hash.c
my_atomic.c my_getncpus.c
@@ -66,3 +66,7 @@ ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
${LIBNSL} ${LIBM} ${LIBRT})
DTRACE_INSTRUMENT(mysys)
+
+ADD_EXECUTABLE(thr_lock thr_lock.c)
+TARGET_LINK_LIBRARIES(thr_lock mysys)
+SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index d5bffd874b2..a9e3f16c548 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -29,9 +29,8 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
mf_keycaches.c my_crc32.c \
mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
- my_malloc.c my_realloc.c my_once.c mulalloc.c \
- my_alloc.c safemalloc.c my_new.cc \
- my_vle.c my_atomic.c lf_hash.c \
+ my_malloc.c my_once.c mulalloc.c \
+ my_alloc.c my_new.cc my_vle.c my_atomic.c lf_hash.c \
lf_dynarray.c lf_alloc-pin.c \
my_fopen.c my_fstream.c my_getsystime.c \
my_error.c errors.c my_div.c my_mess.c \
@@ -52,7 +51,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
my_net.c my_port.c my_sleep.c \
charset.c charset-def.c my_bitmap.c my_bit.c md5.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c \
- my_handler.c my_netware.c my_largepage.c \
+ my_handler.c my_largepage.c \
my_memmem.c stacktrace.c \
my_windac.c my_access.c base64.c my_libwrap.c \
my_rdtsc.c
diff --git a/mysys/array.c b/mysys/array.c
index a1c49c2589d..70c7a59aa3a 100644
--- a/mysys/array.c
+++ b/mysys/array.c
@@ -42,7 +42,7 @@
my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
void *init_buffer, uint init_alloc,
- uint alloc_increment CALLER_INFO_PROTO)
+ uint alloc_increment)
{
DBUG_ENTER("init_dynamic_array");
if (!alloc_increment)
@@ -67,14 +67,13 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
Since the dynamic array is usable even if allocation fails here malloc
should not throw an error
*/
- if (!(array->buffer= (uchar*) my_malloc_ci(element_size*init_alloc, MYF(0))))
+ if (!(array->buffer= (uchar*) my_malloc(element_size*init_alloc, MYF(0))))
array->max_element=0;
DBUG_RETURN(FALSE);
}
my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
- uint init_alloc,
- uint alloc_increment CALLER_INFO_PROTO)
+ uint init_alloc, uint alloc_increment)
{
/* placeholder to preserve ABI */
return my_init_dynamic_array_ci(array, element_size, init_alloc,
@@ -306,7 +305,7 @@ void delete_dynamic(DYNAMIC_ARRAY *array)
else
if (array->buffer)
{
- my_free(array->buffer,MYF(MY_WME));
+ my_free(array->buffer);
array->buffer=0;
array->elements=array->max_element=0;
}
diff --git a/mysys/charset.c b/mysys/charset.c
index 9f9d18e31a4..167d6b8ff6e 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -383,11 +383,11 @@ static my_bool my_read_charset_file(const char *filename, myf myflags)
#endif
}
- my_free(buf, myflags);
+ my_free(buf);
return FALSE;
error:
- my_free(buf, myflags);
+ my_free(buf);
return TRUE;
}
diff --git a/mysys/default.c b/mysys/default.c
index fc119bb3283..8002a1a0307 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -118,7 +118,6 @@ static int search_default_file_with_ext(Process_option_func func,
- Windows: GetWindowsDirectory()
- Windows: C:/
- Windows: Directory above where the executable is located
- - Netware: sys:/etc/
- Unix: /etc/
- Unix: /etc/mysql/
- Unix: --sysconfdir=<path> (compile-time option)
@@ -708,7 +707,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
strmov(name,config_file);
}
fn_format(name,name,"","",4);
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
{
MY_STAT stat_info;
if (!my_stat(name,&stat_info,MYF(0)))
@@ -954,7 +953,6 @@ static char *remove_end_comment(char *ptr)
return ptr;
}
-#include <help_start.h>
void my_print_default_files(const char *conf_file)
{
@@ -1034,8 +1032,6 @@ void print_defaults(const char *conf_file, const char **groups)
--defaults-extra-file=# Read this file after the global files are read.");
}
-#include <help_end.h>
-
static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs)
{
@@ -1150,10 +1146,6 @@ static const char **init_default_directories(MEM_ROOT *alloc)
errors += add_directory(alloc, fname_buffer, dirs);
}
-#elif defined(__NETWARE__)
-
- errors += add_directory(alloc, "sys:/etc/", dirs);
-
#else
errors += add_directory(alloc, "/etc/", dirs);
@@ -1172,7 +1164,7 @@ static const char **init_default_directories(MEM_ROOT *alloc)
/* Placeholder for --defaults-extra-file=<path> */
errors += add_directory(alloc, "", dirs);
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
errors += add_directory(alloc, "~/", dirs);
#endif
diff --git a/mysys/default_modify.c b/mysys/default_modify.c
index b214a1df445..edf4907cd4b 100644
--- a/mysys/default_modify.c
+++ b/mysys/default_modify.c
@@ -223,11 +223,11 @@ int modify_defaults_file(const char *file_location, const char *option,
if (my_fclose(cnf_file, MYF(MY_WME)))
DBUG_RETURN(1);
- my_free(file_buffer, MYF(0));
+ my_free(file_buffer);
DBUG_RETURN(0);
err:
- my_free(file_buffer, MYF(0));
+ my_free(file_buffer);
malloc_err:
my_fclose(cnf_file, MYF(0));
DBUG_RETURN(1); /* out of resources */
diff --git a/mysys/errors.c b/mysys/errors.c
index 37d33374fe1..9342ab2d2dd 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -18,7 +18,7 @@
#ifndef SHARED_LIBRARY
-const char * NEAR globerrs[GLOBERRS]=
+const char *globerrs[GLOBERRS]=
{
"Can't create/write to file '%s' (Errcode: %d)",
"Error reading file '%s' (Errcode: %d)",
diff --git a/mysys/hash.c b/mysys/hash.c
index 39f3ad8d31e..f54ac1a4abb 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -67,8 +67,6 @@ static my_hash_value_type calc_hash(const HASH *hash,
@param[in] get_key get the key for the hash
@param[in] free_element pointer to the function that
does cleanup
- @param[in] CALLER_INFO_PROTO flag that define the behaviour
- of the hash
@return inidicates success or failure of initialization
@retval 0 success
@retval 1 failure
@@ -77,7 +75,7 @@ my_bool
_my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
ulong size, size_t key_offset, size_t key_length,
my_hash_get_key get_key,
- void (*free_element)(void*), uint flags CALLER_INFO_PROTO)
+ void (*free_element)(void*), uint flags)
{
DBUG_ENTER("my_hash_init");
DBUG_PRINT("enter",("hash: 0x%lx size: %u", (long) hash, (uint) size));
diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c
index 7fd10703871..c264d3ac4c5 100644
--- a/mysys/lf_alloc-pin.c
+++ b/mysys/lf_alloc-pin.c
@@ -472,7 +472,7 @@ void lf_alloc_destroy(LF_ALLOCATOR *allocator)
uchar *tmp= anext_node(node);
if (allocator->destructor)
allocator->destructor(node);
- my_free((void *)node, MYF(0));
+ my_free(node);
node= tmp;
}
lf_pinbox_destroy(&allocator->pinbox);
diff --git a/mysys/lf_dynarray.c b/mysys/lf_dynarray.c
index b1cdce698a9..0941c8762bb 100644
--- a/mysys/lf_dynarray.c
+++ b/mysys/lf_dynarray.c
@@ -57,10 +57,10 @@ static void recursive_free(void **alloc, int level)
int i;
for (i= 0; i < LF_DYNARRAY_LEVEL_LENGTH; i++)
recursive_free(alloc[i], level-1);
- my_free((void *)alloc, MYF(0));
+ my_free(alloc);
}
else
- my_free(alloc[-1], MYF(0));
+ my_free(alloc[-1]);
}
void lf_dynarray_destroy(LF_DYNARRAY *array)
@@ -115,7 +115,7 @@ void *_lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx)
if (my_atomic_casptr(ptr_ptr, &ptr, alloc))
ptr= alloc;
else
- my_free(alloc, MYF(0));
+ my_free(alloc);
}
ptr_ptr= ((void **)ptr) + idx / dynarray_idxes_in_prev_level[i];
idx%= dynarray_idxes_in_prev_level[i];
@@ -139,7 +139,7 @@ void *_lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx)
if (my_atomic_casptr(ptr_ptr, &ptr, data))
ptr= data;
else
- my_free(alloc, MYF(0));
+ my_free(alloc);
}
return ((uchar*)ptr) + array->size_of_element * idx;
}
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index f478196c7c8..9c51ff1766e 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -344,7 +344,7 @@ void lf_hash_destroy(LF_HASH *hash)
if (el->hashnr & 1)
lf_alloc_direct_free(&hash->alloc, el); /* normal node */
else
- my_free((void *)el, MYF(0)); /* dummy node */
+ my_free(el); /* dummy node */
el= (LF_SLIST *)next;
}
lf_alloc_destroy(&hash->alloc);
@@ -489,7 +489,7 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
dummy->keylen= 0;
if ((cur= linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE)))
{
- my_free((void *)dummy, MYF(0));
+ my_free(dummy);
dummy= cur;
}
my_atomic_casptr((void **)node, (void **)&tmp, dummy);
diff --git a/mysys/list.c b/mysys/list.c
index aaadd686365..e68fbf519d1 100644
--- a/mysys/list.c
+++ b/mysys/list.c
@@ -61,8 +61,8 @@ void list_free(LIST *root, uint free_data)
{
next=root->next;
if (free_data)
- my_free((uchar*) root->data,MYF(0));
- my_free((uchar*) root,MYF(0));
+ my_free(root->data);
+ my_free(root);
root=next;
}
}
diff --git a/mysys/mf_cache.c b/mysys/mf_cache.c
index f0df0f3fa77..691532c0d80 100644
--- a/mysys/mf_cache.c
+++ b/mysys/mf_cache.c
@@ -71,8 +71,8 @@ my_bool open_cached_file(IO_CACHE *cache, const char* dir, const char *prefix,
{
DBUG_RETURN(0);
}
- my_free(cache->dir, MYF(MY_ALLOW_ZERO_PTR));
- my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(cache->dir);
+ my_free(cache->prefix);
DBUG_RETURN(1);
}
@@ -110,12 +110,12 @@ void close_cached_file(IO_CACHE *cache)
if (cache->file_name)
{
(void) my_delete(cache->file_name,MYF(MY_WME | ME_NOINPUT));
- my_free(cache->file_name,MYF(0));
+ my_free(cache->file_name);
}
#endif
}
- my_free(cache->dir,MYF(MY_ALLOW_ZERO_PTR));
- my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(cache->dir);
+ my_free(cache->prefix);
}
DBUG_VOID_RETURN;
}
diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c
index 1b428ded751..5a9440483e4 100644
--- a/mysys/mf_dirname.c
+++ b/mysys/mf_dirname.c
@@ -40,11 +40,7 @@ size_t dirname_length(const char *name)
continue;
}
#endif
- if (*pos == FN_LIBCHAR || *pos == '/'
-#ifdef FN_C_AFTER_DIR
- || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2
-#endif
- )
+ if (*pos == FN_LIBCHAR || *pos == '/')
gpos=pos;
}
return (size_t) (gpos+1-(char*) name);
@@ -88,8 +84,7 @@ size_t dirname_part(char *to, const char *name, size_t *to_res_length)
from_end Pointer at end of filename (normally end \0)
IMPLEMENTATION
- If MSDOS converts '/' to '\'
- If VMS converts '<' to '[' and '>' to ']'
+ If Windows converts '/' to '\'
Adds a FN_LIBCHAR to end if the result string if there isn't one
and the last isn't dev_char.
Copies data from 'from' until ASCII(0) for until from == from_end
@@ -118,18 +113,12 @@ char *convert_dirname(char *to, const char *from, const char *from_end)
if (!from_end || (from_end - from) > FN_REFLEN-2)
from_end=from+FN_REFLEN -2;
-#if FN_LIBCHAR != '/' || defined(FN_C_BEFORE_DIR_2)
+#if FN_LIBCHAR != '/'
{
for (; from != from_end && *from ; from++)
{
if (*from == '/')
*to++= FN_LIBCHAR;
-#ifdef FN_C_BEFORE_DIR_2
- else if (*from == FN_C_BEFORE_DIR_2)
- *to++= FN_C_BEFORE_DIR;
- else if (*from == FN_C_AFTER_DIR_2)
- *to++= FN_C_AFTER_DIR;
-#endif
else
{
#ifdef BACKSLASH_MBTAIL
diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c
index da7fac3de73..c872f2993c4 100644
--- a/mysys/mf_fn_ext.c
+++ b/mysys/mf_fn_ext.c
@@ -39,7 +39,7 @@ char *fn_ext(const char *name)
DBUG_ENTER("fn_ext");
DBUG_PRINT("mfunkt",("name: '%s'",name));
-#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) || defined(BASKSLASH_MBTAIL)
+#if defined(FN_DEVCHAR) || defined(BASKSLASH_MBTAIL)
{
char buff[FN_REFLEN];
size_t res_length;
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 620ac667a8b..daacc08044b 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -1831,7 +1831,7 @@ int end_io_cache(IO_CACHE *info)
info->alloced_buffer=0;
if (info->file != -1) /* File doesn't exist */
error= my_b_flush_io_cache(info,1);
- my_free((uchar*) info->buffer,MYF(MY_WME));
+ my_free(info->buffer);
info->buffer=info->read_pos=(uchar*) 0;
}
if (info->type == SEQ_READ_APPEND)
@@ -1917,7 +1917,7 @@ int main(int argc, char** argv)
total_bytes += 4+block_size;
}
close_file(&sra_cache);
- my_free(block,MYF(MY_WME));
+ my_free(block);
if (!my_stat(fname,&status,MYF(MY_WME)))
die("%s failed to stat, but I had just closed it,\
wonder how that happened");
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 9cbe3a21bce..c42c3d469e6 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -252,7 +252,7 @@ static void test_key_cache(KEY_CACHE *keycache,
#if defined(KEYCACHE_DEBUG_LOG)
static FILE *keycache_debug_log=NULL;
-static void keycache_debug_print _VARARGS((const char *fmt,...));
+static void keycache_debug_print(const char *fmt,...);
#define KEYCACHE_DEBUG_OPEN \
if (!keycache_debug_log) \
{ \
@@ -446,7 +446,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
if ((keycache->block_root= (BLOCK_LINK*) my_malloc(length,
MYF(0))))
break;
- my_large_free(keycache->block_mem, MYF(0));
+ my_large_free(keycache->block_mem);
keycache->block_mem= 0;
}
if (blocks < 8)
@@ -521,12 +521,12 @@ err:
keycache->blocks= 0;
if (keycache->block_mem)
{
- my_large_free((uchar*) keycache->block_mem, MYF(0));
+ my_large_free((uchar*) keycache->block_mem);
keycache->block_mem= NULL;
}
if (keycache->block_root)
{
- my_free((uchar*) keycache->block_root, MYF(0));
+ my_free(keycache->block_root);
keycache->block_root= NULL;
}
my_errno= error;
@@ -747,9 +747,9 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
{
if (keycache->block_mem)
{
- my_large_free((uchar*) keycache->block_mem, MYF(0));
+ my_large_free((uchar*) keycache->block_mem);
keycache->block_mem= NULL;
- my_free((uchar*) keycache->block_root, MYF(0));
+ my_free(keycache->block_root);
keycache->block_root= NULL;
}
keycache->disk_blocks= -1;
@@ -4080,7 +4080,7 @@ restart:
#endif
err:
if (cache != cache_buff)
- my_free((uchar*) cache, MYF(0));
+ my_free(cache);
if (last_errno)
errno=last_errno; /* Return first error */
DBUG_RETURN(last_errno != 0);
diff --git a/mysys/mf_keycaches.c b/mysys/mf_keycaches.c
index 999e8cc7975..ee4ad025b0b 100644
--- a/mysys/mf_keycaches.c
+++ b/mysys/mf_keycaches.c
@@ -71,7 +71,7 @@ typedef struct st_safe_hash_with_default
static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
{
DBUG_ENTER("free_assign_entry");
- my_free((uchar*) entry, MYF(0));
+ my_free(entry);
DBUG_VOID_RETURN;
}
@@ -234,7 +234,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length,
if (my_hash_insert(&hash->hash, (uchar*) entry))
{
/* This can only happen if hash got out of memory */
- my_free((char*) entry, MYF(0));
+ my_free(entry);
error= 1;
goto end;
}
diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c
index 07851ab6e92..9350babc176 100644
--- a/mysys/mf_loadpath.c
+++ b/mysys/mf_loadpath.c
@@ -42,7 +42,7 @@ char * my_load_path(char * to, const char *path,
if (is_cur)
is_cur=2; /* Remove current dir */
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
- (void) strncat(buff, path+is_cur, FN_REFLEN);
+ (void) strncat(buff, path+is_cur, FN_REFLEN-1);
else
(void) strnmov(buff, path, FN_REFLEN); /* Return org file name */
}
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index 4f7cd90e8aa..c6e6a3a429e 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -18,13 +18,8 @@
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
-#ifdef VMS
-#include <rms.h>
-#include <iodef.h>
-#include <descrip.h>
-#endif /* VMS */
-static char * NEAR_F expand_tilde(char * *path);
+static char * expand_tilde(char **path);
/* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */
/* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
@@ -52,7 +47,7 @@ void pack_dirname(char * to, const char *from)
buff_length= strlen(buff);
d_length= (size_t) (start-to);
if ((start == to ||
- (buff_length == d_length && !bcmp(buff,start,d_length))) &&
+ (buff_length == d_length && !memcmp(buff,start,d_length))) &&
*start != FN_LIBCHAR && *start)
{ /* Put current dir before */
bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1);
@@ -70,7 +65,7 @@ void pack_dirname(char * to, const char *from)
}
if (length > 1 && length < d_length)
{ /* test if /xx/yy -> ~/yy */
- if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
+ if (memcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
{
to[0]=FN_HOMELIB; /* Filename begins with ~ */
(void) strmov_overlapp(to+1,to+length);
@@ -80,7 +75,7 @@ void pack_dirname(char * to, const char *from)
{ /* Test if cwd is ~/... */
if (length > 1 && length < buff_length)
{
- if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
+ if (memcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
{
buff[0]=FN_HOMELIB;
(void) strmov_overlapp(buff+1,buff+length);
@@ -166,7 +161,7 @@ size_t cleanup_dirname(register char *to, const char *from)
*pos = FN_LIBCHAR;
if (*pos == FN_LIBCHAR)
{
- if ((size_t) (pos-start) > length && bcmp(pos-length,parent,length) == 0)
+ if ((size_t) (pos-start) > length && memcmp(pos-length,parent,length) == 0)
{ /* If .../../; skip prev */
pos-=length;
if (pos != start)
@@ -197,7 +192,7 @@ size_t cleanup_dirname(register char *to, const char *from)
end_parentdir=pos;
while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */
pos--;
- if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0)
+ if (pos[1] == FN_HOMELIB || memcmp(pos,parent,length) == 0)
{ /* Don't remove ~user/ */
pos=strmov(end_parentdir+1,parent);
*pos=FN_LIBCHAR;
@@ -206,7 +201,7 @@ size_t cleanup_dirname(register char *to, const char *from)
}
}
else if ((size_t) (pos-start) == length-1 &&
- !bcmp(start,parent+1,length-1))
+ !memcmp(start,parent+1,length-1))
start=pos; /* Starts with "../" */
else if (pos-start > 0 && pos[-1] == FN_LIBCHAR)
{
@@ -300,8 +295,7 @@ size_t normalize_dirname(char *to, const char *from)
/*
Despite the name, this actually converts the name to the system's
- format (TODO: rip out the non-working VMS stuff and name this
- properly).
+ format (TODO: name this properly).
*/
(void) intern_filename(buff, from);
length= strlen(buff); /* Fix that '/' is last */
@@ -377,7 +371,7 @@ size_t unpack_dirname(char * to, const char *from)
/* Expand tilde to home or user-directory */
/* Path is reset to point at FN_LIBCHAR after ~xxx */
-static char * NEAR_F expand_tilde(char * *path)
+static char * expand_tilde(char **path)
{
if (path[0][0] == FN_LIBCHAR)
return home_dir; /* ~/ expanded to home */
@@ -443,73 +437,10 @@ size_t unpack_filename(char * to, const char *from)
/* Used before system command's like open(), create() .. */
/* Returns used length of to; total length should be FN_REFLEN */
-size_t system_filename(char * to, const char *from)
+size_t system_filename(char *to, const char *from)
{
-#ifndef FN_C_BEFORE_DIR
return (size_t) (strmake(to,from,FN_REFLEN-1)-to);
-#else /* VMS */
-
- /* change 'dev:lib/xxx' to 'dev:[lib]xxx' */
- /* change 'dev:xxx' to 'dev:xxx' */
- /* change './xxx' to 'xxx' */
- /* change './lib/' or lib/ to '[.lib]' */
- /* change '/x/y/z to '[x.y]x' */
- /* change 'dev:/x' to 'dev:[000000]x' */
-
- int libchar_found;
- size_t length;
- char * to_pos,from_pos,pos;
- char buff[FN_REFLEN];
- DBUG_ENTER("system_filename");
-
- libchar_found=0;
- (void) strmov(buff,from); /* If to == from */
- from_pos= buff;
- if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */
- {
- pos++;
- to_pos=strnmov(to,from_pos,(size_t) (pos-from_pos));
- from_pos=pos;
- }
- else
- to_pos=to;
-
- if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR)
- from_pos+=2; /* Skip './' */
- if (strchr(from_pos,FN_LIBCHAR))
- {
- *(to_pos++) = FN_C_BEFORE_DIR;
- if (strinstr(from_pos,FN_ROOTDIR) == 1)
- {
- from_pos+=strlen(FN_ROOTDIR); /* Actually +1 but... */
- if (! strchr(from_pos,FN_LIBCHAR))
- { /* No dir, use [000000] */
- to_pos=strmov(to_pos,FN_C_ROOT_DIR);
- libchar_found++;
- }
- }
- else
- *(to_pos++)=FN_C_DIR_SEP; /* '.' gives current dir */
-
- while ((pos=strchr(from_pos,FN_LIBCHAR)))
- {
- if (libchar_found++)
- *(to_pos++)=FN_C_DIR_SEP; /* Add '.' between dirs */
- if (strinstr(from_pos,FN_PARENTDIR) == 1 &&
- from_pos+strlen(FN_PARENTDIR) == pos)
- to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */
- else
- to_pos=strnmov(to_pos,from_pos,(size_t) (pos-from_pos));
- from_pos=pos+1;
- }
- *(to_pos++)=FN_C_AFTER_DIR;
- }
- length= (size_t) (strmov(to_pos,from_pos)-to);
- DBUG_PRINT("exit",("name: '%s'",to));
- DBUG_RETURN(length);
-#endif
-} /* system_filename */
-
+}
/* Fix a filename to intern (UNIX format) */
diff --git a/mysys/mf_path.c b/mysys/mf_path.c
index d51cac732f5..92cb62e6827 100644
--- a/mysys/mf_path.c
+++ b/mysys/mf_path.c
@@ -78,9 +78,6 @@ char * my_path(char * to, const char *progname,
#define F_OK 0
#define PATH_SEP ';'
#define PROGRAM_EXTENSION ".exe"
-#elif defined(__NETWARE__)
-#define PATH_SEP ';'
-#define PROGRAM_EXTENSION ".nlm"
#else
#define PATH_SEP ':'
#endif
diff --git a/mysys/mf_sort.c b/mysys/mf_sort.c
index 686ebbc1d14..a3e7465ead0 100644
--- a/mysys/mf_sort.c
+++ b/mysys/mf_sort.c
@@ -27,7 +27,7 @@ void my_string_ptr_sort(uchar *base, uint items, size_t size)
(ptr= (uchar**) my_malloc(items*sizeof(char*),MYF(0))))
{
radixsort_for_str_ptr((uchar**) base,items,size,ptr);
- my_free((uchar*) ptr,MYF(0));
+ my_free(ptr);
}
else
#endif
diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c
index 5633182ab3a..c84987cfc96 100644
--- a/mysys/mf_tempdir.c
+++ b/mysys/mf_tempdir.c
@@ -16,7 +16,7 @@
#include "mysys_priv.h"
#include <m_string.h>
-#if defined( __WIN__) || defined(__NETWARE__)
+#if defined(__WIN__)
#define DELIM ';'
#else
#define DELIM ':'
@@ -36,7 +36,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
{
/* Get default temporary directory */
pathlist=getenv("TMPDIR"); /* Use this if possible */
-#if defined( __WIN__) || defined(__NETWARE__)
+#if defined(__WIN__)
if (!pathlist)
pathlist=getenv("TEMP");
if (!pathlist)
@@ -88,7 +88,7 @@ void free_tmpdir(MY_TMPDIR *tmpdir)
if (!tmpdir->full_list.elements)
return;
for (i=0; i<=tmpdir->max; i++)
- my_free(tmpdir->list[i], MYF(0));
+ my_free(tmpdir->list[i]);
delete_dynamic(&tmpdir->full_list);
mysql_mutex_destroy(&tmpdir->mutex);
}
diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c
index 40016210de4..e85124fb4c3 100644
--- a/mysys/mf_tempfile.c
+++ b/mysys/mf_tempfile.c
@@ -100,16 +100,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
my_errno= tmp;
}
-#elif defined(_ZTC__)
- if (!dir)
- dir=getenv("TMPDIR");
- if ((res=tempnam((char*) dir,(char *) prefix)))
- {
- strmake(to,res,FN_REFLEN-1);
- (*free)(res);
- file=my_create(to, 0, mode | O_EXCL | O_NOFOLLOW, MyFlags);
- }
-#elif defined(HAVE_MKSTEMP) && !defined(__NETWARE__)
+#elif defined(HAVE_MKSTEMP)
{
char prefix_buff[30];
uint pfx_len;
@@ -143,9 +134,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
}
#elif defined(HAVE_TEMPNAM)
{
-#if !defined(__NETWARE__)
extern char **environ;
-#endif
char *res,**old_env,*temp_env[1];
if (dir && !dir[0])
@@ -154,14 +143,14 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
to[1]= 0;
dir=to;
}
-#if !defined(__NETWARE__)
+
old_env= (char**) environ;
if (dir)
{ /* Don't use TMPDIR if dir is given */
environ=(const char**) temp_env;
temp_env[0]=0;
}
-#endif
+
if ((res=tempnam((char*) dir, (char*) prefix)))
{
strmake(to,res,FN_REFLEN-1);
@@ -176,9 +165,8 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
{
DBUG_PRINT("error",("Got error: %d from tempnam",errno));
}
-#if !defined(__NETWARE__)
+
environ=(const char**) old_env;
-#endif
}
#else
#error No implementation found for create_temp_file
diff --git a/mysys/mf_unixpath.c b/mysys/mf_unixpath.c
index 75f8de14879..ee81aae4584 100644
--- a/mysys/mf_unixpath.c
+++ b/mysys/mf_unixpath.c
@@ -16,10 +16,15 @@
#include "mysys_priv.h"
#include <m_string.h>
- /* convert filename to unix style filename */
- /* If MSDOS converts '\' to '/' */
+/**
+ Convert filename to unix style filename.
-void to_unix_path(char * to __attribute__((unused)))
+ @remark On Windows, converts '\' to '/'.
+
+ @param to A pathname.
+*/
+
+void to_unix_path(char *to __attribute__((unused)))
{
#if FN_LIBCHAR != '/'
{
diff --git a/mysys/mf_util.c b/mysys/mf_util.c
deleted file mode 100644
index 248b72b8748..00000000000
--- a/mysys/mf_util.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Utilities with are missing on some systems */
-
-#include "mysys_priv.h"
-#ifdef __ZTC__
-#include <dos.h>
-#endif
-
-#ifdef __ZTC__
-
- /* On ZORTECH C we don't have a getpid() call */
-
-int getpid(void)
-{
- return (int) _psp;
-}
-
-#ifndef M_IC80386
-
- /* Define halloc and hfree in as in MSC */
-
-void * __CDECL halloc(long count,size_t length)
-{
- return (void*) MK_FP(dos_alloc((uint) ((count*length+15) >> 4)),0);
-}
-
-void __CDECL hfree(void *ptr)
-{
- dos_free(FP_SEG(ptr));
-}
-
-#endif /* M_IC80386 */
-#endif /* __ZTC__ */
diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c
index 4a4fb466600..95c4c006b2c 100644
--- a/mysys/mf_wfile.c
+++ b/mysys/mf_wfile.c
@@ -118,7 +118,6 @@ found:
void wf_end(WF_PACK *buffer)
{
DBUG_ENTER("wf_end");
- if (buffer)
- my_free(buffer, MYF(0));
+ my_free(buffer);
DBUG_VOID_RETURN;
} /* wf_end */
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 19e51880209..903826dd975 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -120,7 +120,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
{
/* remove block from the list and free it */
*prev= mem->next;
- my_free(mem, MYF(0));
+ my_free(mem);
}
else
prev= &mem->next;
@@ -362,13 +362,13 @@ void free_root(MEM_ROOT *root, myf MyFlags)
{
old=next; next= next->next ;
if (old != root->pre_alloc)
- my_free(old,MYF(0));
+ my_free(old);
}
for (next=root->free ; next ;)
{
old=next; next= next->next;
if (old != root->pre_alloc)
- my_free(old,MYF(0));
+ my_free(old);
}
root->used=root->free=0;
if (root->pre_alloc)
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index 91370bd3727..3de05fa8664 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -150,7 +150,7 @@ void bitmap_free(MY_BITMAP *map)
if (map->mutex)
mysql_mutex_destroy(map->mutex);
#endif
- my_free((char*) map->bitmap, MYF(0));
+ my_free(map->bitmap);
map->bitmap=0;
}
DBUG_VOID_RETURN;
@@ -508,10 +508,8 @@ uint bitmap_get_first_set(const MY_BITMAP *map)
if (*byte_ptr & (1 << k))
return (i*32) + (j*8) + k;
}
- DBUG_ASSERT(0);
}
}
- DBUG_ASSERT(0);
}
}
return MY_BIT_NONE;
@@ -534,7 +532,7 @@ uint bitmap_get_first(const MY_BITMAP *map)
{
byte_ptr= (uchar*)data_ptr;
for (j=0; ; j++, byte_ptr++)
- {
+ {
if (*byte_ptr != 0xFF)
{
for (k=0; ; k++)
@@ -542,10 +540,8 @@ uint bitmap_get_first(const MY_BITMAP *map)
if (!(*byte_ptr & (1 << k)))
return (i*32) + (j*8) + k;
}
- DBUG_ASSERT(0);
}
}
- DBUG_ASSERT(0);
}
}
return MY_BIT_NONE;
diff --git a/mysys/my_clock.c b/mysys/my_clock.c
index d17f26ed316..da04feb462f 100644
--- a/mysys/my_clock.c
+++ b/mysys/my_clock.c
@@ -15,14 +15,14 @@
#include "my_global.h"
-#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__NETWARE__)
+#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#include "mysys_priv.h"
#include <sys/times.h>
#endif
long my_clock(void)
{
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
struct tms tmsbuf;
(void) times(&tmsbuf);
return (tmsbuf.tms_utime + tmsbuf.tms_stime);
diff --git a/mysys/my_compress.c b/mysys/my_compress.c
index a3d9d56915e..360390d376a 100644
--- a/mysys/my_compress.c
+++ b/mysys/my_compress.c
@@ -51,7 +51,7 @@ my_bool my_compress(uchar *packet, size_t *len, size_t *complen)
if (!compbuf)
DBUG_RETURN(*complen ? 0 : 1);
memcpy(packet,compbuf,*len);
- my_free(compbuf,MYF(MY_WME));
+ my_free(compbuf);
}
DBUG_RETURN(0);
}
@@ -73,14 +73,14 @@ uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen)
if (res != Z_OK)
{
- my_free(compbuf, MYF(MY_WME));
+ my_free(compbuf);
return 0;
}
if (*complen >= *len)
{
*complen= 0;
- my_free(compbuf, MYF(MY_WME));
+ my_free(compbuf);
DBUG_PRINT("note",("Packet got longer on compression; Not compressed"));
return 0;
}
@@ -125,11 +125,11 @@ my_bool my_uncompress(uchar *packet, size_t len, size_t *complen)
if (error != Z_OK)
{ /* Probably wrong packet */
DBUG_PRINT("error",("Can't uncompress packet, error: %d",error));
- my_free(compbuf, MYF(MY_WME));
+ my_free(compbuf);
DBUG_RETURN(1);
}
memcpy(packet, compbuf, *complen);
- my_free(compbuf, MYF(MY_WME));
+ my_free(compbuf);
}
else
*complen= len;
@@ -250,7 +250,7 @@ int unpackfrm(uchar **unpack_data, size_t *unpack_len,
if (my_uncompress(data, complen, &orglen))
{
- my_free(data, MYF(0));
+ my_free(data);
DBUG_RETURN(3);
}
diff --git a/mysys/my_copy.c b/mysys/my_copy.c
index d38507c111a..878aebd3684 100644
--- a/mysys/my_copy.c
+++ b/mysys/my_copy.c
@@ -103,10 +103,10 @@ 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 */
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */
#endif
-#if !defined(VMS) && !defined(__ZTC__)
+
if (MyFlags & MY_COPYTIME)
{
struct utimbuf timep;
@@ -114,7 +114,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
timep.modtime = stat_buff.st_mtime;
(void) utime((char*) to, &timep); /* last accessed and modified times */
}
-#endif
+
DBUG_RETURN(0);
}
diff --git a/mysys/my_delete.c b/mysys/my_delete.c
index edee1c4e875..4a23fedb5ab 100644
--- a/mysys/my_delete.c
+++ b/mysys/my_delete.c
@@ -93,23 +93,33 @@ int nt_share_delete(const char *name, myf MyFlags)
name, buf, errno));
break;
}
-
+
if (errno == ERROR_FILE_NOT_FOUND)
{
- my_errno= ENOENT; // marking, that `name' doesn't exist
+ my_errno= ENOENT; // marking, that `name' doesn't exist
}
else if (errno == 0)
{
- if (DeleteFile(buf))
- DBUG_RETURN(0);
- else if ((my_errno= GetLastError()) == 0)
- my_errno= ENOENT; // marking, that `buf' doesn't exist
- } else
- my_errno= errno;
-
+ if (DeleteFile(buf))
+ DBUG_RETURN(0);
+ /*
+ The below is more complicated than necessary. For some reason, the
+ assignment to my_errno clears the error number, which is retrieved
+ by GetLastError() (VC2005EE). Assigning to errno first, allows to
+ retrieve the correct value.
+ */
+ errno= GetLastError();
+ if (errno == 0)
+ my_errno= ENOENT; // marking, that `buf' doesn't exist
+ else
+ my_errno= errno;
+ }
+ else
+ my_errno= errno;
+
if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
- name, my_errno);
+ my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
+ name, my_errno);
DBUG_RETURN(-1);
}
#endif
diff --git a/mysys/my_error.c b/mysys/my_error.c
index e2523a39d0b..fa62cc604b6 100644
--- a/mysys/my_error.c
+++ b/mysys/my_error.c
@@ -211,7 +211,7 @@ int my_error_register(const char** (*get_errmsgs) (), int first, int last)
/* Error numbers must be unique. No overlapping is allowed. */
if (*search_meh_pp && ((*search_meh_pp)->meh_first <= last))
{
- my_free((uchar*)meh_p, MYF(0));
+ my_free(meh_p);
return 1;
}
@@ -267,7 +267,7 @@ const char **my_error_unregister(int first, int last)
/* Save the return value and free the header. */
errmsgs= meh_p->get_errmsgs();
- my_free((uchar*) meh_p, MYF(0));
+ my_free(meh_p);
return errmsgs;
}
@@ -282,7 +282,7 @@ void my_error_unregister_all(void)
/* We need this ptr, but we're about to free its container, so save it. */
saved_next= cursor->meh_next;
- my_free((uchar*) cursor, MYF(0));
+ my_free(cursor);
}
my_errmsgs_globerrs.meh_next= NULL; /* Freed in first iteration above. */
diff --git a/mysys/my_file.c b/mysys/my_file.c
index a31673b31bc..e4b7cd7779f 100644
--- a/mysys/my_file.c
+++ b/mysys/my_file.c
@@ -127,7 +127,7 @@ void my_free_open_file_info()
/* Copy data back for my_print_open_files */
memcpy((char*) my_file_info_default, my_file_info,
sizeof(*my_file_info_default)* MY_NFILE);
- my_free((char*) my_file_info, MYF(0));
+ my_free(my_file_info);
my_file_info= my_file_info_default;
my_file_limit= MY_NFILE;
}
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 3f2bc08df65..861e4380690 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -117,7 +117,7 @@ int my_fclose(FILE *fd, myf MyFlags)
if ((uint) file < my_file_limit && my_file_info[file].type != UNOPEN)
{
my_file_info[file].type = UNOPEN;
- my_free(my_file_info[file].name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(my_file_info[file].name);
}
mysql_mutex_unlock(&THR_LOCK_open);
DBUG_RETURN(err);
diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c
index c6a7af58f57..9ca22f2201e 100644
--- a/mysys/my_gethwaddr.c
+++ b/mysys/my_gethwaddr.c
@@ -47,7 +47,7 @@ my_bool my_gethwaddr(uchar *to)
uchar *buf, *next, *end, *addr;
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;
- int i, res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
+ int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
goto err;
@@ -196,7 +196,7 @@ my_bool my_gethwaddr(uchar *to)
/* Clean up memory allocation. */
if (pAdapterAddresses != &adapterAddresses)
- my_free(pAdapterAddresses, 0);
+ my_free(pAdapterAddresses);
return return_val;
}
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 1e94dd2d761..e4b199dab84 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -28,7 +28,7 @@ typedef void (*init_func_p)(const struct my_option *option, void *variable,
static void default_reporter(enum loglevel level, const char *format, ...);
my_error_reporter my_getopt_error_reporter= &default_reporter;
-static int findopt(char *, uint, const struct my_option **, char **);
+static int findopt(char *, uint, const struct my_option **, const char **);
my_bool getopt_compare_strings(const char *, const char *, uint);
static longlong getopt_ll(char *arg, const struct my_option *optp, int *err);
static ulonglong getopt_ull(char *, const struct my_option *, int *);
@@ -113,8 +113,8 @@ int handle_options(int *argc, char ***argv,
uint opt_found, argvpos= 0, length;
my_bool end_of_options= 0, must_be_var, set_maximum_value,
option_is_loose;
- char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found),
- *opt_str, key_name[FN_REFLEN];
+ char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN];
+ const char *UNINIT_VAR(prev_found);
const struct my_option *optp;
void *value;
int error, i;
@@ -185,7 +185,6 @@ int handle_options(int *argc, char ***argv,
Find first the right option. Return error in case of an ambiguous,
or unknown option
*/
- LINT_INIT(prev_found);
optp= longopts;
if (!(opt_found= findopt(opt_str, length, &optp, &prev_found)))
{
@@ -596,8 +595,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
case GET_STR_ALLOC:
if (argument == enabled_my_option)
break; /* string options don't use this default of "1" */
- if ((*((char**) value)))
- my_free((*(char**) value), MYF(MY_WME | MY_FAE));
+ my_free(*((char**) value));
if (!(*((char**) value)= my_strdup(argument, MYF(MY_WME))))
{
res= EXIT_OUT_OF_MEMORY;
@@ -696,10 +694,10 @@ ret:
static int findopt(char *optpat, uint length,
const struct my_option **opt_res,
- char **ffname)
+ const char **ffname)
{
uint count;
- struct my_option *opt= (struct my_option *) *opt_res;
+ const struct my_option *opt= *opt_res;
for (count= 0; opt->name; opt++)
{
@@ -710,8 +708,9 @@ static int findopt(char *optpat, uint length,
return 1;
if (!count)
{
+ /* We only need to know one prev */
count= 1;
- *ffname= (char *) opt->name; /* We only need to know one prev */
+ *ffname= opt->name;
}
else if (strcmp(*ffname, opt->name))
{
@@ -1033,7 +1032,7 @@ static void init_one_value(const struct my_option *option, void *variable,
*((ulonglong*) variable)= (ulonglong) value;
break;
case GET_DOUBLE:
- *((double*) variable)= (double) value;
+ *((double*) variable)= ulonglong2double(value);
break;
case GET_STR:
/*
@@ -1054,8 +1053,9 @@ static void init_one_value(const struct my_option *option, void *variable,
*/
if ((char*) (intptr) value)
{
- my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR));
- *((char**) variable)= my_strdup((char*) (intptr) value, MYF(MY_WME));
+ char **pstr= (char **) variable;
+ my_free(*pstr);
+ *pstr= my_strdup((char*) (intptr) value, MYF(MY_WME));
}
break;
default: /* dummy default to avoid compiler warnings */
@@ -1080,7 +1080,7 @@ static void fini_one_value(const struct my_option *option, void *variable,
DBUG_ENTER("fini_one_value");
switch ((option->var_type & GET_TYPE_MASK)) {
case GET_STR_ALLOC:
- my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR));
+ my_free(*((char**) variable));
*((char**) variable)= NULL;
break;
default: /* dummy default to avoid compiler warnings */
@@ -1147,8 +1147,6 @@ static uint print_name(const struct my_option *optp)
Print help for all options and variables.
*/
-#include <help_start.h>
-
void my_print_help(const struct my_option *options)
{
uint col, name_space= 22, comment_space= 57;
@@ -1330,5 +1328,3 @@ void my_print_variables(const struct my_option *options)
}
}
}
-
-#include <help_end.h>
diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c
index ea12f73fe3d..cc5d1b83efb 100644
--- a/mysys/my_getsystime.c
+++ b/mysys/my_getsystime.c
@@ -25,10 +25,6 @@
#include "mysys_priv.h"
#include "my_static.h"
-#ifdef __NETWARE__
-#include <nks/time.h>
-#endif
-
ulonglong my_getsystime()
{
#ifdef HAVE_CLOCK_GETTIME
@@ -45,10 +41,6 @@ ulonglong my_getsystime()
query_performance_frequency) + query_performance_offset);
}
return 0;
-#elif defined(__NETWARE__)
- NXTime_t tm;
- NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm);
- return (ulonglong)tm/100;
#else
/* TODO: check for other possibilities for hi-res timestamping */
struct timeval tv;
diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c
index 4182ea9826f..ace14c8a3c9 100644
--- a/mysys/my_getwd.c
+++ b/mysys/my_getwd.c
@@ -72,16 +72,6 @@ int my_getwd(char * buf, size_t size, myf MyFlags)
getwd(pathname);
strmake(buf,pathname,size-1);
}
-#elif defined(VMS)
- if (size < 2)
- DBUG_RETURN(-1);
- if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
- {
- my_errno=errno;
- my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
- DBUG_RETURN(-1);
- }
- intern_filename(buf,buf);
#else
#error "No way to get current directory"
#endif
@@ -103,27 +93,12 @@ int my_setwd(const char *dir, myf MyFlags)
int res;
size_t length;
char *start, *pos;
-#if defined(VMS)
- char buff[FN_REFLEN];
-#endif
DBUG_ENTER("my_setwd");
DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags));
start=(char *) dir;
if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0))
dir=FN_ROOTDIR;
-#ifdef VMS
- {
- pos=strmov(buff,dir);
- if (pos[-1] != FN_LIBCHAR)
- {
- pos[0]=FN_LIBCHAR; /* Mark as directory */
- pos[1]=0;
- }
- system_filename(buff,buff); /* Change to VMS format */
- dir=buff;
- }
-#endif /* VMS */
if ((res=chdir((char*) dir)) != 0)
{
my_errno=errno;
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index 3f8af553db6..48d100f2d3f 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -269,7 +269,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a+=a_length;
b+=b_length;
- break;
}
break;
case HA_KEYTYPE_INT8:
diff --git a/mysys/my_init.c b/mysys/my_init.c
index f27f3f7b3e8..dbf1bfe761c 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -19,10 +19,6 @@
#include <m_string.h>
#include <m_ctype.h>
#include <signal.h>
-#ifdef VMS
-#include <my_static.c>
-#include <m_ctype.h>
-#endif
#ifdef __WIN__
#ifdef _MSC_VER
#include <locale.h>
@@ -36,11 +32,6 @@ static my_bool win32_init_tcp_ip();
#else
#define my_win_init()
#endif
-#ifdef __NETWARE__
-static void netware_init();
-#else
-#define netware_init()
-#endif
my_bool my_init_done= 0;
/** True if @c my_basic_init() has been called. */
@@ -84,18 +75,12 @@ my_bool my_basic_init(void)
my_umask= 0660; /* Default umask for new files */
my_umask_dir= 0700; /* Default umask for new directories */
-#ifndef VMS
/* Default creation of new files */
if ((str= getenv("UMASK")) != 0)
my_umask= (int) (atoi_octal(str) | 0600);
/* Default creation of new dir's */
if ((str= getenv("UMASK_DIR")) != 0)
my_umask_dir= (int) (atoi_octal(str) | 0700);
-#endif
-
- /* $HOME is needed early to parse configuration files located in ~/ */
- if ((home_dir= getenv("HOME")) != 0)
- home_dir= intern_filename(home_dir_buff, home_dir);
init_glob_errs();
@@ -113,7 +98,6 @@ my_bool my_basic_init(void)
#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
fastmutex_global_init(); /* Must be called early */
#endif
- netware_init();
#ifdef THREAD
#if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */
@@ -122,6 +106,10 @@ my_bool my_basic_init(void)
return 1;
#endif
+ /* $HOME is needed early to parse configuration files located in ~/ */
+ if ((home_dir= getenv("HOME")) != 0)
+ home_dir= intern_filename(home_dir_buff, home_dir);
+
return 0;
}
@@ -141,6 +129,7 @@ my_bool my_init(void)
{
if (my_init_done)
return 0;
+
my_init_done= 1;
if (my_basic_init())
@@ -149,7 +138,7 @@ my_bool my_init(void)
#ifdef THREAD
if (my_thread_global_init())
return 1;
-#if !defined( __WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif
#endif /* THREAD */
@@ -157,9 +146,6 @@ my_bool my_init(void)
DBUG_ENTER("my_init");
DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
my_win_init();
-#ifdef VMS
- init_ctype(); /* Stupid linker don't link _ctype.c */
-#endif
DBUG_PRINT("exit", ("home: '%s'", home_dir));
#ifdef __WIN__
win32_init_tcp_ip();
@@ -238,12 +224,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals,
rus.ru_nvcsw, rus.ru_nivcsw);
#endif
-#if defined(__NETWARE__) && !defined(__WIN__)
- fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
-#endif
-#if defined(SAFEMALLOC)
- TERMINATE(stderr, (infoflag & MY_GIVE_INFO) != 0);
-#elif defined(__WIN__) && defined(_MSC_VER)
+#if defined(__WIN__) && defined(_MSC_VER)
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
@@ -254,10 +235,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
_CrtDumpMemoryLeaks();
#endif
}
- else if (infoflag & MY_CHECK_ERROR)
- {
- TERMINATE(stderr, 0); /* Print memory leaks on screen */
- }
if (!(infoflag & MY_DONT_FREE_DBUG))
{
@@ -280,6 +257,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
if (have_tcpip)
WSACleanup();
#endif /* __WIN__ */
+
my_init_done=0;
my_basic_init_done= 0;
} /* my_end */
@@ -528,60 +506,6 @@ static my_bool win32_init_tcp_ip()
}
#endif /* __WIN__ */
-
-#ifdef __NETWARE__
-/*
- Basic initialisation for netware
-*/
-
-static void netware_init()
-{
- char cwd[PATH_MAX], *name;
-
- DBUG_ENTER("netware_init");
-
- /* init only if we are not a client library */
- if (my_progname)
- {
-#if SUPPORTED_BY_LIBC /* Removed until supported in Libc */
- struct termios tp;
- /* Disable control characters */
- tcgetattr(STDIN_FILENO, &tp);
- tp.c_cc[VINTR] = _POSIX_VDISABLE;
- tp.c_cc[VEOF] = _POSIX_VDISABLE;
- tp.c_cc[VSUSP] = _POSIX_VDISABLE;
- tcsetattr(STDIN_FILENO, TCSANOW, &tp);
-#endif /* SUPPORTED_BY_LIBC */
-
- /* With stdout redirection */
- if (!isatty(STDOUT_FILENO))
- {
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT); /* auto close the screen */
- }
- else
- {
- setscreenmode(SCR_NO_MODE); /* keep the screen up */
- }
-
- /* Parse program name and change to base format */
- name= (char*) my_progname;
- for (; *name; name++)
- {
- if (*name == '\\')
- {
- *name = '/';
- }
- else
- {
- *name = tolower(*name);
- }
- }
- }
-
- DBUG_VOID_RETURN;
-}
-#endif /* __NETWARE__ */
-
#ifdef HAVE_PSI_INTERFACE
#if !defined(HAVE_PREAD) && !defined(_WIN32)
diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c
index e65d3a0a5f5..9f5ab01a2b7 100644
--- a/mysys/my_largepage.c
+++ b/mysys/my_largepage.c
@@ -27,7 +27,7 @@
static uint my_get_large_page_size_int(void);
static uchar* my_large_malloc_int(size_t size, myf my_flags);
-static my_bool my_large_free_int(uchar* ptr, myf my_flags);
+static my_bool my_large_free_int(uchar* ptr);
/* Gets the size of large pages from the OS */
@@ -70,7 +70,7 @@ uchar* my_large_malloc(size_t size, myf my_flags)
to my_free_lock() in case of failure
*/
-void my_large_free(uchar* ptr, myf my_flags __attribute__((unused)))
+void my_large_free(uchar* ptr)
{
DBUG_ENTER("my_large_free");
@@ -79,9 +79,8 @@ void my_large_free(uchar* ptr, myf my_flags __attribute__((unused)))
my_large_malloc_int(), i.e. my_malloc_lock() was used so we should free it
with my_free_lock()
*/
- if (!my_use_large_pages || !my_large_page_size ||
- !my_large_free_int(ptr, my_flags))
- my_free_lock(ptr, my_flags);
+ if (!my_use_large_pages || !my_large_page_size || !my_large_free_int(ptr))
+ my_free_lock(ptr);
DBUG_VOID_RETURN;
}
@@ -157,7 +156,7 @@ uchar* my_large_malloc_int(size_t size, myf my_flags)
/* Linux-specific large pages deallocator */
-my_bool my_large_free_int(uchar *ptr, myf my_flags __attribute__((unused)))
+my_bool my_large_free_int(uchar *ptr)
{
DBUG_ENTER("my_large_free_int");
DBUG_RETURN(shmdt(ptr) == 0);
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index 0113d1498df..890ff0b5dd1 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* TODO: check for overun of memory for names. */
-/* Convert MSDOS-TIME to standar time_t (still needed?) */
#include "mysys_priv.h"
#include <m_string.h>
@@ -41,11 +40,6 @@
# endif
# endif
#endif
-#ifdef VMS
-#include <rms.h>
-#include <iodef.h>
-#include <descrip.h>
-#endif
#if defined(THREAD) && defined(HAVE_READDIR_R)
#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C)
@@ -77,7 +71,7 @@ void my_dirend(MY_DIR *buffer)
ALIGN_SIZE(sizeof(MY_DIR))));
free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) +
ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))), MYF(0));
- my_free((uchar*) buffer,MYF(0));
+ my_free(buffer);
}
DBUG_VOID_RETURN;
} /* my_dirend */
@@ -131,7 +125,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
ENTRIES_START_SIZE, ENTRIES_INCREMENT))
{
- my_free((uchar*) buffer,MYF(0));
+ my_free(buffer);
goto error;
}
init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
@@ -199,9 +193,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
/*
* Convert from directory name to filename.
- * On VMS:
- * xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1
- * xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1
* On UNIX, it's simple: just make sure there is a terminating /
* Returns pointer to dst;
@@ -209,11 +200,8 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
char * directory_file_name (char * dst, const char *src)
{
-#ifndef VMS
-
/* Process as Unix format: just remove test the final slash. */
-
- char * end;
+ char *end;
if (src[0] == 0)
src= (char*) "."; /* Use empty as current */
@@ -224,125 +212,7 @@ char * directory_file_name (char * dst, const char *src)
end[1]='\0';
}
return dst;
-
-#else /* VMS */
-
- long slen;
- long rlen;
- char * ptr, rptr;
- char bracket;
- struct FAB fab = cc$rms_fab;
- struct NAM nam = cc$rms_nam;
- char esa[NAM$C_MAXRSS];
-
- if (! src[0])
- src="[.]"; /* Empty is == current dir */
-
- slen = strlen (src) - 1;
- if (src[slen] == FN_C_AFTER_DIR || src[slen] == FN_C_AFTER_DIR_2 ||
- src[slen] == FN_DEVCHAR)
- {
- /* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */
- fab.fab$l_fna = src;
- fab.fab$b_fns = slen + 1;
- fab.fab$l_nam = &nam;
- fab.fab$l_fop = FAB$M_NAM;
-
- nam.nam$l_esa = esa;
- nam.nam$b_ess = sizeof esa;
- nam.nam$b_nop |= NAM$M_SYNCHK;
-
- /* We call SYS$PARSE to handle such things as [--] for us. */
- if (SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL)
- {
- slen = nam.nam$b_esl - 1;
- if (esa[slen] == ';' && esa[slen - 1] == '.')
- slen -= 2;
- esa[slen + 1] = '\0';
- src = esa;
- }
- if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2)
- {
- /* what about when we have logical_name:???? */
- if (src[slen] == FN_DEVCHAR)
- { /* Xlate logical name and see what we get */
- (void) strmov(dst,src);
- dst[slen] = 0; /* remove colon */
- if (!(src = getenv (dst)))
- return dst; /* Can't translate */
-
- /* should we jump to the beginning of this procedure?
- Good points: allows us to use logical names that xlate
- to Unix names,
- Bad points: can be a problem if we just translated to a device
- name...
- For now, I'll punt and always expect VMS names, and hope for
- the best! */
-
- slen = strlen (src) - 1;
- if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2)
- { /* no recursion here! */
- (void) strmov(dst, src);
- return(dst);
- }
- }
- else
- { /* not a directory spec */
- (void) strmov(dst, src);
- return(dst);
- }
- }
-
- bracket = src[slen]; /* End char */
- if (!(ptr = strchr (src, bracket - 2)))
- { /* no opening bracket */
- (void) strmov (dst, src);
- return dst;
- }
- if (!(rptr = strrchr (src, '.')))
- rptr = ptr;
- slen = rptr - src;
- (void) strmake (dst, src, slen);
-
- if (*rptr == '.')
- { /* Put bracket and add */
- dst[slen++] = bracket; /* (rptr+1) after this */
- }
- else
- {
- /* If we have the top-level of a rooted directory (i.e. xx:[000000]),
- then translate the device and recurse. */
-
- if (dst[slen - 1] == ':'
- && dst[slen - 2] != ':' /* skip decnet nodes */
- && strcmp(src + slen, "[000000]") == 0)
- {
- dst[slen - 1] = '\0';
- if ((ptr = getenv (dst))
- && (rlen = strlen (ptr) - 1) > 0
- && (ptr[rlen] == FN_C_AFTER_DIR || ptr[rlen] == FN_C_AFTER_DIR_2)
- && ptr[rlen - 1] == '.')
- {
- (void) strmov(esa,ptr);
- esa[rlen - 1] = FN_C_AFTER_DIR;
- esa[rlen] = '\0';
- return (directory_file_name (dst, esa));
- }
- else
- dst[slen - 1] = ':';
- }
- (void) strmov(dst+slen,"[000000]");
- slen += 8;
- }
- (void) strmov(strmov(dst+slen,rptr+1)-1,".DIR.1");
- return dst;
- }
- (void) strmov(dst, src);
- if (dst[slen] == '/' && slen > 1)
- dst[slen] = 0;
- return dst;
-#endif /* VMS */
-} /* directory_file_name */
+}
#else
@@ -400,7 +270,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
ENTRIES_START_SIZE, ENTRIES_INCREMENT))
{
- my_free((uchar*) buffer,MYF(0));
+ my_free(buffer);
goto error;
}
init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
@@ -547,7 +417,7 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
DBUG_PRINT("error",("Got errno: %d from stat", errno));
my_errno= errno;
if (m_used) /* Free if new area */
- my_free((uchar*) stat_area,MYF(0));
+ my_free(stat_area);
error:
if (my_flags & (MY_FAE+MY_WME))
diff --git a/mysys/my_lock.c b/mysys/my_lock.c
index 1436c845286..49c94ea838c 100644
--- a/mysys/my_lock.c
+++ b/mysys/my_lock.c
@@ -22,9 +22,6 @@
#undef NO_ALARM_LOOP
#endif
#include <my_alarm.h>
-#ifdef __NETWARE__
-#include <nks/fsio.h>
-#endif
#ifdef _WIN32
#define WIN_LOCK_INFINITE -1
@@ -145,60 +142,14 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
int value;
ALARM_VARIABLES;
#endif
-#ifdef __NETWARE__
- int nxErrno;
-#endif
DBUG_ENTER("my_lock");
DBUG_PRINT("my",("fd: %d Op: %d start: %ld Length: %ld MyFlags: %d",
fd,locktype,(long) start,(long) length,MyFlags));
-#ifdef VMS
- DBUG_RETURN(0);
-#else
if (my_disable_locking)
DBUG_RETURN(0);
-#if defined(__NETWARE__)
- {
- NXSOffset_t nxLength = length;
- unsigned long nxLockFlags = 0;
-
- if (length == F_TO_EOF)
- {
- /* EOF is interpreted as a very large length. */
- nxLength = 0x7FFFFFFFFFFFFFFF;
- }
-
- if (locktype == F_UNLCK)
- {
- /* The lock flags are currently ignored by NKS. */
- if (!(nxErrno= NXFileRangeUnlock(fd, 0L, start, nxLength)))
- DBUG_RETURN(0);
- }
- else
- {
- if (locktype == F_RDLCK)
- {
- /* A read lock is mapped to a shared lock. */
- nxLockFlags = NX_RANGE_LOCK_SHARED;
- }
- else
- {
- /* A write lock is mapped to an exclusive lock. */
- nxLockFlags = NX_RANGE_LOCK_EXCL;
- }
-
- if (MyFlags & MY_DONT_WAIT)
- {
- /* Don't block on the lock. */
- nxLockFlags |= NX_RANGE_LOCK_TRYLOCK;
- }
-
- if (!(nxErrno= NXFileRangeLock(fd, nxLockFlags, start, nxLength)))
- DBUG_RETURN(0);
- }
- }
-#elif defined(_WIN32)
+#if defined(_WIN32)
{
int timeout_sec;
if (MyFlags & MY_DONT_WAIT)
@@ -257,12 +208,9 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
#endif /* HAVE_FCNTL */
#endif /* HAVE_LOCKING */
-#ifdef __NETWARE__
- my_errno = nxErrno;
-#else
- /* We got an error. We don't want EACCES errors */
+ /* We got an error. We don't want EACCES errors */
my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1;
-#endif
+
if (MyFlags & MY_WME)
{
if (locktype == F_UNLCK)
@@ -272,5 +220,4 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
}
DBUG_PRINT("error",("my_errno: %d (%d)",my_errno,errno));
DBUG_RETURN(-1);
-#endif /* ! VMS */
} /* my_lock */
diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c
index 1b582783d33..a37db6b2089 100644
--- a/mysys/my_lockmem.c
+++ b/mysys/my_lockmem.c
@@ -74,7 +74,7 @@ uchar *my_malloc_lock(uint size,myf MyFlags)
}
-void my_free_lock(uchar *ptr,myf Myflags __attribute__((unused)))
+void my_free_lock(uchar *ptr)
{
LIST *list;
struct st_mem_list *element=0;
@@ -91,8 +91,7 @@ void my_free_lock(uchar *ptr,myf Myflags __attribute__((unused)))
}
}
mysql_mutex_unlock(&THR_LOCK_malloc);
- if (element)
- my_free((uchar*) element,MYF(0));
+ my_free(element);
free(ptr); /* Free even if not locked */
}
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 13d2375eb99..fc2dc98c3c5 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 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
@@ -11,28 +11,31 @@
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 */
-
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "mysys_priv.h"
#include "mysys_err.h"
#include <m_string.h>
- /* My memory allocator */
+/**
+ Allocate a sized block of memory.
+ @param size The size of the memory block in bytes.
+ @param flags Failure action modifiers (bitmasks).
+
+ @return A pointer to the allocated memory block, or NULL on failure.
+*/
void *my_malloc(size_t size, myf my_flags)
{
void* point;
DBUG_ENTER("my_malloc");
DBUG_PRINT("my",("size: %lu my_flags: %d", (ulong) size, my_flags));
+ /* Safety */
if (!size)
- size=1; /* Safety */
+ size=1;
- point= (char *) malloc(size);
+ point= malloc(size);
DBUG_EXECUTE_IF("simulate_out_of_memory",
{
free(point);
@@ -52,33 +55,87 @@ void *my_malloc(size_t size, myf my_flags)
exit(1);
}
else if (my_flags & MY_ZEROFILL)
- bzero(point,size);
- DBUG_PRINT("exit",("ptr: 0x%lx", (long) point));
- DBUG_RETURN((void*) point);
-} /* my_malloc */
+ bzero(point, size);
+ DBUG_PRINT("exit",("ptr: %p", point));
+ DBUG_RETURN(point);
+}
+
+
+/**
+ @brief wrapper around realloc()
+
+ @param oldpoint pointer to currently allocated area
+ @param size new size requested, must be >0
+ @param my_flags flags
+
+ @note if size==0 realloc() may return NULL; my_realloc() treats this as an
+ error which is not the intention of realloc()
+*/
+void *my_realloc(void *oldpoint, size_t size, myf my_flags)
+{
+ void *point;
+ DBUG_ENTER("my_realloc");
+ DBUG_PRINT("my",("ptr: %p size: %lu my_flags: %d", oldpoint,
+ (ulong) size, my_flags));
+
+ DBUG_ASSERT(size > 0);
+ if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
+ DBUG_RETURN(my_malloc(size, my_flags));
+#ifdef USE_HALLOC
+ if (!(point = malloc(size)))
+ {
+ if (my_flags & MY_FREE_ON_ERROR)
+ my_free(oldpoint);
+ if (my_flags & MY_HOLD_ON_ERROR)
+ DBUG_RETURN(oldpoint);
+ my_errno=errno;
+ if (my_flags & MY_FAE+MY_WME)
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
+ }
+ else
+ {
+ memcpy(point,oldpoint,size);
+ free(oldpoint);
+ }
+#else
+ if ((point= realloc(oldpoint, size)) == NULL)
+ {
+ if (my_flags & MY_FREE_ON_ERROR)
+ my_free(oldpoint);
+ if (my_flags & MY_HOLD_ON_ERROR)
+ DBUG_RETURN(oldpoint);
+ my_errno=errno;
+ if (my_flags & (MY_FAE+MY_WME))
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size);
+ }
+#endif
+ DBUG_PRINT("exit",("ptr: %p", point));
+ DBUG_RETURN(point);
+}
- /* Free memory allocated with my_malloc */
- /*ARGSUSED*/
+/**
+ Free memory allocated with my_malloc.
-void my_no_flags_free(void* ptr)
+ @remark Relies on free being able to handle a NULL argument.
+
+ @param ptr Pointer to the memory allocated by my_malloc.
+*/
+void my_free(void *ptr)
{
DBUG_ENTER("my_free");
- DBUG_PRINT("my",("ptr: 0x%lx", (long) ptr));
- if (ptr)
- free(ptr);
+ DBUG_PRINT("my",("ptr: %p", ptr));
+ free(ptr);
DBUG_VOID_RETURN;
-} /* my_free */
-
+}
- /* malloc and copy */
-void* my_memdup(const void *from, size_t length, myf my_flags)
+void *my_memdup(const void *from, size_t length, myf my_flags)
{
void *ptr;
if ((ptr= my_malloc(length,my_flags)) != 0)
memcpy(ptr, from, length);
- return(ptr);
+ return ptr;
}
@@ -87,18 +144,19 @@ char *my_strdup(const char *from, myf my_flags)
char *ptr;
size_t length= strlen(from)+1;
if ((ptr= (char*) my_malloc(length, my_flags)))
- memcpy((uchar*) ptr, (uchar*) from,(size_t) length);
- return(ptr);
+ memcpy(ptr, from, length);
+ return ptr;
}
char *my_strndup(const char *from, size_t length, myf my_flags)
{
char *ptr;
- if ((ptr= (char*) my_malloc(length+1,my_flags)) != 0)
+ if ((ptr= (char*) my_malloc(length+1, my_flags)))
{
- memcpy((uchar*) ptr, (uchar*) from, length);
- ptr[length]=0;
+ memcpy(ptr, from, length);
+ ptr[length]= 0;
}
- return((char*) ptr);
+ return ptr;
}
+
diff --git a/mysys/my_mess.c b/mysys/my_mess.c
index 0ec97525ae8..513afe39054 100644
--- a/mysys/my_mess.c
+++ b/mysys/my_mess.c
@@ -22,11 +22,7 @@ void my_message_stderr(uint error __attribute__((unused)),
DBUG_PRINT("enter",("message: %s",str));
(void) fflush(stdout);
if (MyFlags & ME_BELL)
-#ifdef __NETWARE__
- ringbell(); /* Bell */
-#else
- (void) fputc('\007',stderr); /* Bell */
-#endif /* __NETWARE__ */
+ (void) fputc('\007', stderr);
if (my_progname)
{
(void)fputs(my_progname,stderr); (void)fputs(": ",stderr);
diff --git a/mysys/my_mmap.c b/mysys/my_mmap.c
index 303d8efaf30..82ee1562bc2 100644
--- a/mysys/my_mmap.c
+++ b/mysys/my_mmap.c
@@ -38,13 +38,16 @@ void *my_mmap(void *addr, size_t len, int prot,
HANDLE hFileMap;
LPVOID ptr;
HANDLE hFile= (HANDLE)my_get_osfhandle(fd);
+ DBUG_ENTER("my_mmap");
+ DBUG_PRINT("mysys", ("map fd: %d", fd));
+
if (hFile == INVALID_HANDLE_VALUE)
- return MAP_FAILED;
+ DBUG_RETURN(MAP_FAILED);
hFileMap=CreateFileMapping(hFile, &mmap_security_attributes,
PAGE_READWRITE, 0, (DWORD) len, NULL);
if (hFileMap == 0)
- return MAP_FAILED;
+ DBUG_RETURN(MAP_FAILED);
ptr=MapViewOfFile(hFileMap,
prot & PROT_WRITE ? FILE_MAP_WRITE : FILE_MAP_READ,
@@ -59,14 +62,19 @@ void *my_mmap(void *addr, size_t len, int prot,
CloseHandle(hFileMap);
if (ptr)
- return ptr;
+ {
+ DBUG_PRINT("mysys", ("mapped addr: %p", ptr));
+ DBUG_RETURN(ptr);
+ }
- return MAP_FAILED;
+ DBUG_RETURN(MAP_FAILED);
}
int my_munmap(void *addr, size_t len)
{
- return UnmapViewOfFile(addr) ? 0 : -1;
+ DBUG_ENTER("my_munmap");
+ DBUG_PRINT("mysys", ("unmap addr: %p", addr));
+ DBUG_RETURN(UnmapViewOfFile(addr) ? 0 : -1);
}
int my_msync(int fd, void *addr, size_t len, int flags)
diff --git a/mysys/my_netware.c b/mysys/my_netware.c
deleted file mode 100644
index 5b5c39c0ac0..00000000000
--- a/mysys/my_netware.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- Functions specific to netware
-*/
-
-#include <mysys_priv.h>
-#ifdef __NETWARE__
- #include <string.h>
- #include <library.h>
-
-/*
- PMUserLicenseRequest is an API exported by the polimgr.nlm
- (loaded by the NetWare OS when it comes up) for use by other
- NLM-based NetWare products/services.
- PMUserLicenseRequest provides a couple of functions:
- 1) it will optionally request a User license or ensure that
- one already exists for the specified User in userInfo
- 2) it utilizes the NetWare usage metering service to
- record usage information about your product/service.
-*/
-
-long PMMeteredUsageRequest
-(
- /*
- NDS distinguished name or IP address or ??. asciiz string, e.g.
- ".CN=Admin.O=this.T=MYTREE."
- */
- char *userInfo,
- long infoType, /* see defined values */
- /*
- string used to identify the calling service, used to index the
- metered info e.g. "iPrint"
- */
- char *serviceID,
- char tranAddrType, /* type of address that follows */
- char *tranAddr, /* ptr to a 10-byte array */
- long flags, /* see defined values */
- /* NLS error code, if any. NULL input is okay */
- long *licRequestErrCode,
- /* meter service error code, if any. NULL input is okay */
- long *storeMeterInfoErrCode,
- /*
- error code from NLSMeter if
- storeMeterInfoErrCode == PM_LICREQ_NLSMETERERROR.
- NULL input is okay
- */
- long *NLSMeterErrCode
-);
-
-typedef long(*PMUR)(const char*, long, const char*, char,
- const char*, long, long*, long*, long*);
-
-/* infoType */
-/* indicates that the info in the userInfo param is an NDS user */
-#define PM_USERINFO_TYPE_NDS 1
-/* indicates that the info in the userInfo param is NOT an NDS user */
-#define PM_USERINFO_TYPE_ADDRESS 2
-
-/* Flags */
-
-/*
- Tells the service that it should not check to see if the NDS user
- contained in the userInfo param has a NetWare User License - just
- record metering information; this is ignored if infoType !=
- PM_USERINFO_TYPE_NDS
-*/
-
-#define PM_FLAGS_METER_ONLY 0x0000001
-
-/*
- Indicates that the values in the userInfo and serviceID parameters
- are unicode strings, so that the metering service bypasses
- converting these to unicode (again)
-*/
-#define PM_LICREQ_ALREADY_UNICODE 0x0000002
-/*
- Useful only if infoType is PM_USERINFO_TYPE_NDS - indicates a "no
- stop" policy of the calling service
-*/
-#define PM_LICREQ_ALWAYS_METER 0x0000004
-
-
-/*
- net Address Types - system-defined types of net addresses that can
- be used in the tranAddrType field
-*/
-
-#define NLS_TRAN_TYPE_IPX 0x00000001 /* An IPX address */
-#define NLS_TRAN_TYPE_IP 0x00000008 /* An IP address */
-#define NLS_ADDR_TYPE_MAC 0x000000F1 /* a MAC address */
-
-/*
- Net Address Sizes - lengths that correspond to the tranAddrType
- field (just fyi)
-*/
-#define NLS_IPX_ADDR_SIZE 10 /* the size of an IPX address */
-#define NLS_IP_ADDR_SIZE 4 /* the size of an IP address */
-#define NLS_MAC_ADDR_SIZE 6 /* the size of a MAC address */
-
-
-void netware_reg_user(const char *ip, const char *user,
- const char *application)
-{
- PMUR usage_request;
- long licRequestErrCode = 0;
- long storeMeterInfoErrCode = 0;
- long nlsMeterErrCode = 0;
-
- /* import the symbol */
- usage_request= ((PMUR)ImportPublicObject(getnlmhandle(),
- "PMMeteredUsageRequest"));
- if (usage_request != NULL)
- {
- unsigned long iaddr;
- char addr[NLS_IPX_ADDR_SIZE];
-
- /* create address */
- iaddr = htonl(inet_addr(ip));
- bzero(addr, NLS_IPX_ADDR_SIZE);
- memcpy(addr, &iaddr, NLS_IP_ADDR_SIZE);
-
- /* call to NLS */
- usage_request(user,
- PM_USERINFO_TYPE_ADDRESS,
- application,
- NLS_TRAN_TYPE_IP,
- addr,
- PM_FLAGS_METER_ONLY,
- &licRequestErrCode,
- &storeMeterInfoErrCode,
- &nlsMeterErrCode);
- /* release symbol */
- UnImportPublicObject(getnlmhandle(), "PMMeteredUsageRequest");
- }
-}
-#endif /* __NETWARE__ */
diff --git a/mysys/my_once.c b/mysys/my_once.c
index 727b8477365..32d07802028 100644
--- a/mysys/my_once.c
+++ b/mysys/my_once.c
@@ -15,10 +15,6 @@
/* Not MT-SAFE */
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
#include "mysys_priv.h"
#include "my_static.h"
#include "mysys_err.h"
diff --git a/mysys/my_open.c b/mysys/my_open.c
index a50baf2c417..8f34ce1c6dc 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -88,7 +88,7 @@ int my_close(File fd, myf MyFlags)
}
if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN)
{
- my_free(my_file_info[fd].name, MYF(0));
+ my_free(my_file_info[fd].name);
#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
mysql_mutex_destroy(&my_file_info[fd].mutex);
#endif
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 3019e4bc5c1..270d13928e3 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -45,34 +45,6 @@ void *my_pthread_getspecific_imp(pthread_key_t key)
}
#endif
-#ifdef __NETWARE__
-/*
- Don't kill the LibC Reaper thread or the main thread
-*/
-#include <nks/thread.h>
-#undef pthread_exit
-void my_pthread_exit(void *status)
-{
- NXThreadId_t tid;
- NXContext_t ctx;
- char name[NX_MAX_OBJECT_NAME_LEN+1] = "";
-
- tid= NXThreadGetId();
- if (tid == NX_INVALID_THREAD_ID || !tid)
- return;
- if (NXThreadGetContext(tid, &ctx) ||
- NXContextGetName(ctx, name, sizeof(name)-1))
- return;
-
- /*
- "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
- with a debug build of LibC the reaper can have different names
- */
- if (!strindex(name, "\'s"))
- pthread_exit(status);
-}
-#endif
-
/*
Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7
(and DEC OSF/1 3.2 too)
diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c
index 073663e3d96..c8ef38efbdc 100644
--- a/mysys/my_rdtsc.c
+++ b/mysys/my_rdtsc.c
@@ -86,10 +86,6 @@
#include <sys/times.h> /* for times */
#endif
-#if defined(__NETWARE__)
-#include <nks/time.h> /* for NXGetTime */
-#endif
-
#if defined(__INTEL_COMPILER) && defined(__ia64__) && defined(HAVE_IA64INTRIN_H)
#include <ia64intrin.h> /* for __GetReg */
#endif
@@ -265,12 +261,6 @@ ulonglong my_timer_nanoseconds(void)
clock_gettime(CLOCK_REALTIME, &tp);
return (ulonglong) tp.tv_sec * 1000000000 + (ulonglong) tp.tv_nsec;
}
-#elif defined(__NETWARE__)
- {
- NXTime_t tm;
- NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm);
- return (ulonglong) tm;
- }
#elif defined(__APPLE__) && defined(__MACH__)
{
ulonglong tm;
@@ -322,12 +312,6 @@ ulonglong my_timer_microseconds(void)
QueryPerformanceCounter(&t_cnt);
return (ulonglong) t_cnt.QuadPart;
}
-#elif defined(__NETWARE__)
- {
- NXTime_t tm;
- NXGetTime(NX_SINCE_1970, NX_USECONDS, &tm);
- return (ulonglong) tm;
- }
#else
return 0;
#endif
@@ -354,12 +338,6 @@ ulonglong my_timer_milliseconds(void)
GetSystemTimeAsFileTime( &ft );
return ((ulonglong)ft.dwLowDateTime +
(((ulonglong)ft.dwHighDateTime) << 32))/10000;
-#elif defined(__NETWARE__)
- {
- NXTime_t tm;
- NXGetTime(NX_SINCE_1970, NX_MSECONDS, &tm);
- return (ulonglong)tm;
- }
#else
return 0;
#endif
@@ -378,12 +356,6 @@ ulonglong my_timer_ticks(void)
struct tms times_buf;
return (ulonglong) times(&times_buf);
}
-#elif defined(__NETWARE__)
- {
- NXTime_t tm;
- NXGetTime(NX_SINCE_BOOT, NX_TICKS, &tm);
- return (ulonglong) tm;
- }
#elif defined(_WIN32)
return (ulonglong) GetTickCount();
#else
@@ -583,8 +555,6 @@ void my_timer_init(MY_TIMER_INFO *mti)
mti->nanoseconds.routine= MY_TIMER_ROUTINE_GETHRTIME;
#elif defined(HAVE_CLOCK_GETTIME)
mti->nanoseconds.routine= MY_TIMER_ROUTINE_CLOCK_GETTIME;
-#elif defined(__NETWARE__)
- mti->nanoseconds.routine= MY_TIMER_ROUTINE_NXGETTIME;
#elif defined(__APPLE__) && defined(__MACH__)
mti->nanoseconds.routine= MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME;
#else
@@ -614,8 +584,6 @@ void my_timer_init(MY_TIMER_INFO *mti)
mti->microseconds.routine= MY_TIMER_ROUTINE_QUERYPERFORMANCECOUNTER;
}
}
-#elif defined(__NETWARE__)
- mti->microseconds.routine= MY_TIMER_ROUTINE_NXGETTIME;
#else
mti->microseconds.routine= 0;
#endif
@@ -633,8 +601,6 @@ void my_timer_init(MY_TIMER_INFO *mti)
mti->milliseconds.routine= MY_TIMER_ROUTINE_FTIME;
#elif defined(_WIN32)
mti->milliseconds.routine= MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME;
-#elif defined(__NETWARE__)
- mti->milliseconds.routine= MY_TIMER_ROUTINE_NXGETTIME;
#elif defined(HAVE_TIME)
mti->milliseconds.routine= MY_TIMER_ROUTINE_TIME;
#else
@@ -652,8 +618,6 @@ void my_timer_init(MY_TIMER_INFO *mti)
mti->ticks.frequency= 100; /* permanent assumption */
#if defined(HAVE_SYS_TIMES_H) && defined(HAVE_TIMES)
mti->ticks.routine= MY_TIMER_ROUTINE_TIMES;
-#elif defined(__NETWARE__)
- mti->ticks.routine= MY_TIMER_ROUTINE_NXGETTIME;
#elif defined(_WIN32)
mti->ticks.routine= MY_TIMER_ROUTINE_GETTICKCOUNT;
#else
@@ -998,7 +962,7 @@ void my_timer_init(MY_TIMER_INFO *mti)
We tested with AIX, Solaris (x86 + Sparc), Linux (x86 +
Itanium), Windows, 64-bit Windows, QNX, FreeBSD, HPUX,
- Irix, Mac. We didn't test with NetWare or SCO.
+ Irix, Mac. We didn't test with SCO.
*/
diff --git a/mysys/my_realloc.c b/mysys/my_realloc.c
deleted file mode 100644
index a55282e03a0..00000000000
--- a/mysys/my_realloc.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-
- /* My memory re allocator */
-
-/**
- @brief wrapper around realloc()
-
- @param oldpoint pointer to currently allocated area
- @param size new size requested, must be >0
- @param my_flags flags
-
- @note if size==0 realloc() may return NULL; my_realloc() treats this as an
- error which is not the intention of realloc()
-*/
-void* my_realloc(void* oldpoint, size_t size, myf my_flags)
-{
- void *point;
- DBUG_ENTER("my_realloc");
- DBUG_PRINT("my",("ptr: 0x%lx size: %lu my_flags: %d", (long) oldpoint,
- (ulong) size, my_flags));
-
- DBUG_ASSERT(size > 0);
- if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
- DBUG_RETURN(my_malloc(size,my_flags));
-#ifdef USE_HALLOC
- if (!(point = malloc(size)))
- {
- if (my_flags & MY_FREE_ON_ERROR)
- my_free(oldpoint,my_flags);
- if (my_flags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(oldpoint);
- my_errno=errno;
- if (my_flags & MY_FAE+MY_WME)
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
- }
- else
- {
- memcpy(point,oldpoint,size);
- free(oldpoint);
- }
-#else
- if ((point= (uchar*) realloc(oldpoint,size)) == NULL)
- {
- if (my_flags & MY_FREE_ON_ERROR)
- my_free(oldpoint, my_flags);
- if (my_flags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(oldpoint);
- my_errno=errno;
- if (my_flags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size);
- }
-#endif
- DBUG_PRINT("exit",("ptr: 0x%lx", (long) point));
- DBUG_RETURN(point);
-} /* my_realloc */
diff --git a/mysys/my_redel.c b/mysys/my_redel.c
index 77040870048..300bac6e296 100644
--- a/mysys/my_redel.c
+++ b/mysys/my_redel.c
@@ -76,7 +76,7 @@ end:
int my_copystat(const char *from, const char *to, int MyFlags)
{
struct stat statbuf;
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
int res;
#endif
@@ -91,17 +91,15 @@ int my_copystat(const char *from, const char *to, int MyFlags)
return 1;
(void) chmod(to, statbuf.st_mode & 07777); /* Copy modes */
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
{
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 */
-#endif /* !__WIN__ && !__NETWARE__ */
+#endif /* !__WIN__ */
-#ifndef VMS
-#ifndef __ZTC__
if (MyFlags & MY_COPYTIME)
{
struct utimbuf timep;
@@ -109,15 +107,6 @@ int my_copystat(const char *from, const char *to, int MyFlags)
timep.modtime = statbuf.st_mtime;
(void) utime((char*) to, &timep);/* Update last accessed and modified times */
}
-#else
- if (MyFlags & MY_COPYTIME)
- {
- time_t time[2];
- time[0]= statbuf.st_atime;
- time[1]= statbuf.st_mtime;
- (void) utime((char*) to, time);/* Update last accessed and modified times */
- }
-#endif
-#endif
+
return 0;
} /* my_copystat */
diff --git a/mysys/my_rename.c b/mysys/my_rename.c
index 39e6056a9e4..1a4e7b2b409 100644
--- a/mysys/my_rename.c
+++ b/mysys/my_rename.c
@@ -44,7 +44,7 @@ int my_rename(const char *from, const char *to, myf MyFlags)
}
#endif
#if defined(HAVE_RENAME)
-#if defined(__WIN__) || defined(__NETWARE__)
+#if defined(__WIN__)
/*
On windows we can't rename over an existing file:
Remove any conflicting files:
diff --git a/mysys/my_sleep.c b/mysys/my_sleep.c
index 87170e4af41..6d1bdd5dc55 100644
--- a/mysys/my_sleep.c
+++ b/mysys/my_sleep.c
@@ -20,9 +20,7 @@
void my_sleep(ulong m_seconds)
{
-#ifdef __NETWARE__
- delay(m_seconds/1000+1);
-#elif defined(__WIN__)
+#if defined(__WIN__)
Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */
#elif defined(HAVE_SELECT)
struct timeval t;
diff --git a/mysys/my_static.c b/mysys/my_static.c
index ff5abba29d3..2869b43543a 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -27,20 +27,20 @@ my_bool timed_mutexes= 0;
/* from my_init */
char * home_dir=0;
const char *my_progname=0;
-char NEAR curr_dir[FN_REFLEN]= {0},
- NEAR home_dir_buff[FN_REFLEN]= {0};
+char curr_dir[FN_REFLEN]= {0},
+ home_dir_buff[FN_REFLEN]= {0};
ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
ulong my_file_total_opened= 0;
-int NEAR my_umask=0664, NEAR my_umask_dir=0777;
+int my_umask=0664, my_umask_dir=0777;
#ifndef THREAD
-int NEAR my_errno=0;
+int my_errno=0;
#endif
struct st_my_file_info my_file_info_default[MY_NFILE];
uint my_file_limit= MY_NFILE;
struct st_my_file_info *my_file_info= my_file_info_default;
/* From mf_brkhant */
-int NEAR my_dont_interrupt=0;
+int my_dont_interrupt=0;
volatile int _my_signals=0;
struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}};
#ifdef THREAD
@@ -65,26 +65,13 @@ my_bool my_use_large_pages= 0;
uint my_large_page_size= 0;
#endif
- /* from safe_malloc */
-uint sf_malloc_prehunc=0, /* If you have problem with core- */
- sf_malloc_endhunc=0, /* dump when malloc-message.... */
- /* set theese to 64 or 128 */
- sf_malloc_quick=0; /* set if no calls to sanity */
-size_t sf_malloc_cur_memory= 0L; /* Current memory usage */
-size_t sf_malloc_max_memory= 0L; /* Maximum memory usage */
-uint sf_malloc_count= 0; /* Number of times NEW() was called */
-uchar *sf_min_adress= (uchar*) ~(unsigned long) 0L,
- *sf_max_adress= (uchar*) 0L;
-/* Root of the linked list of struct st_irem */
-struct st_irem *sf_malloc_root = NULL;
-
/* from my_alarm */
int volatile my_have_got_alarm=0; /* declare variable to reset */
ulong my_time_to_wait_for_lock=2; /* In seconds */
/* from errors.c */
#ifdef SHARED_LIBRARY
-char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */
+const char *globerrs[GLOBERRS]; /* my_error_messages is here */
#endif
void (*my_abort_hook)(int) = (void(*)(int)) exit;
void (*error_handler_hook)(uint error, const char *str, myf MyFlags)=
@@ -119,10 +106,10 @@ ulonglong query_performance_frequency, query_performance_offset;
#endif
/* How to disable options */
-my_bool NEAR my_disable_locking=0;
-my_bool NEAR my_disable_async_io=0;
-my_bool NEAR my_disable_flush_key_blocks=0;
-my_bool NEAR my_disable_symlinks=0;
+my_bool my_disable_locking=0;
+my_bool my_disable_async_io=0;
+my_bool my_disable_flush_key_blocks=0;
+my_bool my_disable_symlinks=0;
/*
Note that PSI_hook and PSI_server are unconditionally
diff --git a/mysys/my_static.h b/mysys/my_static.h
index c336115bc35..2c9cef0f101 100644
--- a/mysys/my_static.h
+++ b/mysys/my_static.h
@@ -34,26 +34,7 @@ struct st_remember {
sig_handler (*func)(int number);
};
-/*
- Structure that stores information of a allocated memory block
- The data is at &struct_adr+sizeof(ALIGN_SIZE(sizeof(struct irem)))
- The lspecialvalue is at the previous 4 bytes from this, which may not
- necessarily be in the struct if the struct size isn't aligned at a 8 byte
- boundary.
-*/
-
-struct st_irem
-{
- struct st_irem *next; /* Linked list of structures */
- struct st_irem *prev; /* Other link */
- char *filename; /* File in which memory was new'ed */
- size_t datasize; /* Size requested */
- uint32 linenum; /* Line number in above file */
- uint32 SpecialValue; /* Underrun marker value */
-};
-
-
-extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN];
+extern char curr_dir[FN_REFLEN], home_dir_buff[FN_REFLEN];
extern volatile int _my_signals;
extern struct st_remember _my_sig_remember[MAX_SIGNALS];
@@ -63,10 +44,6 @@ extern const char *soundex_map;
extern USED_MEM* my_once_root_block;
extern uint my_once_extra;
-extern uchar *sf_min_adress,*sf_max_adress;
-extern uint sf_malloc_count;
-extern struct st_irem *sf_malloc_root;
-
extern struct st_my_file_info my_file_info_default[MY_NFILE];
extern ulonglong query_performance_frequency, query_performance_offset;
diff --git a/mysys/my_windac.c b/mysys/my_windac.c
index f846853f7be..0c924188623 100644
--- a/mysys/my_windac.c
+++ b/mysys/my_windac.c
@@ -194,8 +194,8 @@ error:
FreeSid(everyone_sid);
if (htoken)
CloseHandle(htoken);
- my_free((uchar*) sa, MYF(MY_ALLOW_ZERO_PTR));
- my_free((uchar*) dacl, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sa);
+ my_free(dacl);
*psa= 0;
return 1;
}
@@ -215,8 +215,8 @@ void my_security_attr_free(SECURITY_ATTRIBUTES *sa)
My_security_attr *attr= (My_security_attr*)
(((char*)sa) + ALIGN_SIZE(sizeof(*sa)));
FreeSid(attr->everyone_sid);
- my_free((uchar*) attr->dacl, MYF(0));
- my_free((uchar*) sa, MYF(0));
+ my_free(attr->dacl);
+ my_free(sa);
}
}
diff --git a/mysys/queues.c b/mysys/queues.c
index 9c85e493141..25a310c0752 100644
--- a/mysys/queues.c
+++ b/mysys/queues.c
@@ -194,11 +194,8 @@ int resize_queue(QUEUE *queue, uint max_elements)
void delete_queue(QUEUE *queue)
{
DBUG_ENTER("delete_queue");
- if (queue->root)
- {
- my_free((uchar*) queue->root,MYF(0));
- queue->root=0;
- }
+ my_free(queue->root);
+ queue->root= NULL;
DBUG_VOID_RETURN;
}
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
deleted file mode 100644
index 6d0f7e5dd53..00000000000
--- a/mysys/safemalloc.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/* Copyright (C) 2000-2003 MySQL AB, 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 */
-
-/*
- * Memory sub-system, written by Bjorn Benson
- Fixed to use my_sys scheme by Michael Widenius
-
- [This posting refers to an article entitled "oops, corrupted memory
- again!" in net.lang.c. I am posting it here because it is source.]
-
- My tool for approaching this problem is to build another level of data
- abstraction on top of malloc() and free() that implements some checking.
- This does a number of things for you:
- - Checks for overruns and underruns on allocated data
- - Keeps track of where in the program the memory was malloc'ed
- - Reports on pieces of memory that were not free'ed
- - Records some statistics such as maximum memory used
- - Marks newly malloc'ed and newly free'ed memory with special values
- You can use this scheme to:
- - Find bugs such as overrun, underrun, etc because you know where
- a piece of data was malloc'ed and where it was free'ed
- - Find bugs where memory was not free'ed
- - Find bugs where newly malloc'ed memory is used without initializing
- - Find bugs where newly free'ed memory is still used
- - Determine how much memory your program really uses
- - and other things
-
- To implement my scheme you must have a C compiler that has __LINE__ and
- __FILE__ macros. If your compiler doesn't have these then (a) buy another:
- compilers that do are available on UNIX 4.2bsd based systems and the PC,
- and probably on other machines; or (b) change my scheme somehow. I have
- recomendations on both these points if you would like them (e-mail please).
-
- There are 4 functions in my package:
- char *NEW( uSize ) Allocate memory of uSize bytes
- (equivalent to malloc())
- char *REA( pPtr, uSize) Allocate memory of uSize bytes, move data and
- free pPtr.
- (equivalent to realloc())
- FREE( pPtr ) Free memory allocated by NEW
- (equivalent to free())
- TERMINATE(file,flag) End system, report errors and stats on file
- I personally use two more functions, but have not included them here:
- char *STRSAVE( sPtr ) Save a copy of the string in dynamic memory
- char *RENEW( pPtr, uSize )
- (equivalent to realloc())
-
-*/
-
-#ifndef SAFEMALLOC
-#define SAFEMALLOC /* Get protos from my_sys */
-#endif
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include "my_static.h"
-#include "mysys_err.h"
-
-ulonglong sf_malloc_mem_limit= ~(ulonglong)0;
-
-#ifndef PEDANTIC_SAFEMALLOC
-/*
- Set to 1 after TERMINATE() if we had to fiddle with sf_malloc_count and
- the linked list of blocks so that _sanity() will not fuss when it
- is not supposed to
-*/
-static int sf_malloc_tampered= 0;
-#endif
-
-
- /* Static functions prototypes */
-
-static int check_ptr(const char *where, uchar *ptr, const char *sFile,
- uint uLine);
-static int _checkchunk(struct st_irem *pRec, const char *sFile, uint uLine);
-
-/*
- Note: We only fill up the allocated block. This do not include
- malloc() roundoff or the extra space required by the irem
- structures.
-*/
-
-/*
- NEW'ed memory is filled with this value so that references to it will
- end up being very strange.
-*/
-#define ALLOC_VAL (uchar) 0xA5
-/*
- FEEE'ed memory is filled with this value so that references to it will
- end up being very strange.
-*/
-#define FREE_VAL (uchar) 0x8F
-#define MAGICKEY 0x14235296 /* A magic value for underrun key */
-
-/*
- Warning: do not change the MAGICEND? values to something with the
- high bit set. Various C compilers (like the 4.2bsd one) do not do
- the sign extension right later on in this code and you will get
- erroneous errors.
-*/
-
-#define MAGICEND0 0x68 /* Magic values for overrun keys */
-#define MAGICEND1 0x34 /* " */
-#define MAGICEND2 0x7A /* " */
-#define MAGICEND3 0x15 /* " */
-
-
-/* Allocate some memory. */
-
-void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
-{
- struct st_irem *irem;
- uchar *data;
- DBUG_ENTER("_mymalloc");
- DBUG_PRINT("enter",("Size: %lu", (ulong) size));
-
- if (!sf_malloc_quick)
- (void) _sanity (filename, lineno);
-
- if (size + sf_malloc_cur_memory > sf_malloc_mem_limit)
- irem= 0;
- else
- {
- /* Allocate the physical memory */
- irem= (struct st_irem *) malloc (ALIGN_SIZE(sizeof(struct st_irem)) +
- sf_malloc_prehunc +
- size + /* size requested */
- 4 + /* overrun mark */
- sf_malloc_endhunc);
- DBUG_EXECUTE_IF("simulate_out_of_memory",
- {
- free(irem);
- irem= NULL;
- });
- }
- /* Check if there isn't anymore memory avaiable */
- if (!irem)
- {
- if (MyFlags & MY_FAE)
- error_handler_hook=fatal_error_handler_hook;
- if (MyFlags & (MY_FAE+MY_WME))
- {
- char buff[256];
- my_errno=errno;
- sprintf(buff,"Out of memory at line %d, '%s'", lineno, filename);
- my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
- sprintf(buff,"needed %lu byte (%luk), memory in use: %lu bytes (%luk)",
- (ulong) size, (ulong) (size + 1023L) / 1024L,
- (ulong) sf_malloc_max_memory,
- (ulong) (sf_malloc_max_memory + 1023L) / 1024L);
- my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
- }
- DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
- (long)sf_malloc_max_memory,lineno, filename));
- DBUG_EXECUTE_IF("simulate_out_of_memory",
- DBUG_SET("-d,simulate_out_of_memory"););
- if (MyFlags & MY_FAE)
- exit(1);
- DBUG_RETURN ((void*) 0);
- }
-
- /* Fill up the structure */
- data= (((uchar*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
- sf_malloc_prehunc);
- *((uint32*) (data-sizeof(uint32)))= MAGICKEY;
- data[size + 0]= MAGICEND0;
- data[size + 1]= MAGICEND1;
- data[size + 2]= MAGICEND2;
- data[size + 3]= MAGICEND3;
- irem->filename= (char *) filename;
- irem->linenum= lineno;
- irem->datasize= size;
- irem->prev= NULL;
-
- /* Add this remember structure to the linked list */
- mysql_mutex_lock(&THR_LOCK_malloc);
- if ((irem->next= sf_malloc_root))
- sf_malloc_root->prev= irem;
- sf_malloc_root= irem;
-
- /* Keep the statistics */
- sf_malloc_cur_memory+= size;
- if (sf_malloc_cur_memory > sf_malloc_max_memory)
- sf_malloc_max_memory= sf_malloc_cur_memory;
- sf_malloc_count++;
- mysql_mutex_unlock(&THR_LOCK_malloc);
-
- MEM_CHECK_ADDRESSABLE(data, size);
- /* Set the memory to the aribtrary wierd value */
- if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick)
- bfill(data, size, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL));
- if (!(MyFlags & MY_ZEROFILL))
- MEM_UNDEFINED(data, size);
- /* Return a pointer to the real data */
- DBUG_PRINT("exit",("ptr: %p", data));
- if (sf_min_adress > data)
- sf_min_adress= data;
- if (sf_max_adress < data)
- sf_max_adress= data;
- DBUG_RETURN((void*) data);
-}
-
-
-/*
- Allocate some new memory and move old memoryblock there.
- Free then old memoryblock
-*/
-
-void *_myrealloc(register void *ptr, register size_t size,
- const char *filename, uint lineno, myf MyFlags)
-{
- struct st_irem *irem;
- char *data;
- DBUG_ENTER("_myrealloc");
-
- if (!ptr && (MyFlags & MY_ALLOW_ZERO_PTR))
- DBUG_RETURN(_mymalloc(size, filename, lineno, MyFlags));
-
- if (!sf_malloc_quick)
- (void) _sanity (filename, lineno);
-
- if (check_ptr("Reallocating", (uchar*) ptr, filename, lineno))
- DBUG_RETURN((uchar*) NULL);
-
- irem= (struct st_irem *) (((char*) ptr) - ALIGN_SIZE(sizeof(struct st_irem))-
- sf_malloc_prehunc);
- if (*((uint32*) (((char*) ptr)- sizeof(uint32))) != MAGICKEY)
- {
- fprintf(stderr, "Error: Reallocating unallocated data at line %d, '%s'\n",
- lineno, filename);
- DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'",
- lineno, filename));
- (void) fflush(stderr);
- DBUG_RETURN((uchar*) NULL);
- }
-
- if ((data= _mymalloc(size,filename,lineno,MyFlags))) /* Allocate new area */
- {
- size=min(size, irem->datasize); /* Move as much as possibly */
- memcpy((uchar*) data, ptr, (size_t) size); /* Copy old data */
- _myfree(ptr, filename, lineno, 0); /* Free not needed area */
- }
- else
- {
- if (MyFlags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(ptr);
- if (MyFlags & MY_FREE_ON_ERROR)
- _myfree(ptr, filename, lineno, 0);
- }
- DBUG_RETURN(data);
-} /* _myrealloc */
-
-
-/* Deallocate some memory. */
-
-void _myfree(void *ptr, const char *filename, uint lineno, myf myflags)
-{
- struct st_irem *irem;
- DBUG_ENTER("_myfree");
- DBUG_PRINT("enter",("ptr: %p", ptr));
-
- if (!sf_malloc_quick)
- (void) _sanity (filename, lineno);
-
- if ((!ptr && (myflags & MY_ALLOW_ZERO_PTR)) ||
- check_ptr("Freeing",(uchar*) ptr,filename,lineno))
- DBUG_VOID_RETURN;
-
- /* Calculate the address of the remember structure */
- irem= (struct st_irem *) ((char*) ptr- ALIGN_SIZE(sizeof(struct st_irem))-
- sf_malloc_prehunc);
-
- /*
- Check to make sure that we have a real remember structure.
- Note: this test could fail for four reasons:
- (1) The memory was already free'ed
- (2) The memory was never new'ed
- (3) There was an underrun
- (4) A stray pointer hit this location
- */
-
- if (*((uint32*) ((char*) ptr- sizeof(uint32))) != MAGICKEY)
- {
- fprintf(stderr, "Error: Freeing unallocated data at line %d, '%s'\n",
- lineno, filename);
- DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",lineno,filename));
- (void) fflush(stderr);
- DBUG_VOID_RETURN;
- }
-
- /* Remove this structure from the linked list */
- mysql_mutex_lock(&THR_LOCK_malloc);
- if (irem->prev)
- irem->prev->next= irem->next;
- else
- sf_malloc_root= irem->next;
-
- if (irem->next)
- irem->next->prev= irem->prev;
- /* Handle the statistics */
- sf_malloc_cur_memory-= irem->datasize;
- sf_malloc_count--;
- mysql_mutex_unlock(&THR_LOCK_malloc);
-
-#ifndef HAVE_purify
- /* Mark this data as free'ed */
- if (!sf_malloc_quick)
- bfill(ptr, irem->datasize, (pchar) FREE_VAL);
-#endif
- MEM_NOACCESS(ptr, irem->datasize);
- *((uint32*) ((char*) ptr- sizeof(uint32)))= ~MAGICKEY;
- MEM_NOACCESS((char*) ptr - sizeof(uint32), sizeof(uint32));
- /* Actually free the memory */
- free((char*) irem);
- DBUG_VOID_RETURN;
-}
-
- /* Check if we have a wrong pointer */
-
-static int check_ptr(const char *where, uchar *ptr, const char *filename,
- uint lineno)
-{
- if (!ptr)
- {
- fprintf(stderr, "Error: %s NULL pointer at line %d, '%s'\n",
- where,lineno, filename);
- DBUG_PRINT("safe",("Null pointer at line %d '%s'", lineno, filename));
- (void) fflush(stderr);
- return 1;
- }
-#ifndef _MSC_VER
- if ((long) ptr & (ALIGN_SIZE(1)-1))
- {
- fprintf(stderr, "Error: %s wrong aligned pointer at line %d, '%s'\n",
- where,lineno, filename);
- DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'",
- lineno,filename));
- (void) fflush(stderr);
- return 1;
- }
-#endif
- if (ptr < sf_min_adress || ptr > sf_max_adress)
- {
- fprintf(stderr, "Error: %s pointer out of range at line %d, '%s'\n",
- where,lineno, filename);
- DBUG_PRINT("safe",("Pointer out of range at line %d '%s'",
- lineno,filename));
- (void) fflush(stderr);
- return 1;
- }
- return 0;
-}
-
-
-/*
- Report on all the memory pieces that have not been free'ed
-
- SYNOPSIS
- TERMINATE()
- file Write output to this file
- flag If <> 0, also write statistics
- */
-
-void TERMINATE(FILE *file, uint flag)
-{
- struct st_irem *irem;
- DBUG_ENTER("TERMINATE");
- mysql_mutex_lock(&THR_LOCK_malloc);
-
- /*
- Report the difference between number of calls to
- NEW and the number of calls to FREE. >0 means more
- NEWs than FREEs. <0, etc.
- */
-
- if (sf_malloc_count)
- {
- if (file)
- {
- fprintf(file, "Warning: Not freed memory segments: %u\n", sf_malloc_count);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count));
- }
-
- /*
- Report on all the memory that was allocated with NEW
- but not free'ed with FREE.
- */
-
- if ((irem= sf_malloc_root))
- {
- if (file)
- {
- fprintf(file, "Warning: Memory that was not free'ed (%lu bytes):\n",
- (ulong) sf_malloc_cur_memory);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("Memory that was not free'ed (%lu bytes):",
- (ulong) sf_malloc_cur_memory));
- while (irem)
- {
- char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
- sf_malloc_prehunc);
- if (file)
- {
- fprintf(file,
- "\t%6lu bytes at %p, allocated at line %4u in '%s'",
- (ulong) irem->datasize, data, irem->linenum, irem->filename);
- fprintf(file, "\n");
- (void) fflush(file);
- }
- DBUG_PRINT("safe",
- ("%6lu bytes at %p, allocated at line %4d in '%s'",
- (ulong) irem->datasize,
- data, irem->linenum, irem->filename));
- irem= irem->next;
- }
- }
- /* Report the memory usage statistics */
- if (file && flag)
- {
- fprintf(file, "Maximum memory usage: %lu bytes (%luk)\n",
- (ulong) sf_malloc_max_memory,
- (ulong) (sf_malloc_max_memory + 1023L) / 1024L);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("Maximum memory usage: %lu bytes (%luk)",
- (ulong) sf_malloc_max_memory,
- (ulong) (sf_malloc_max_memory + 1023L) /1024L));
- mysql_mutex_unlock(&THR_LOCK_malloc);
- DBUG_VOID_RETURN;
-}
-
-
-/*
- Report where a piece of memory was allocated
-
- This is usefull to call from withing a debugger
-*/
-
-
-void sf_malloc_report_allocated(void *memory)
-{
- struct st_irem *irem;
- for (irem= sf_malloc_root ; irem ; irem=irem->next)
- {
- char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
- sf_malloc_prehunc);
- if (data <= (char*) memory && (char*) memory <= data + irem->datasize)
- {
- printf("%lu bytes at %p, allocated at line %u in '%s'\n",
- (ulong) irem->datasize, data, irem->linenum, irem->filename);
- break;
- }
- }
-}
-
- /* Returns 0 if chunk is ok */
-
-static int _checkchunk(register struct st_irem *irem, const char *filename,
- uint lineno)
-{
- int flag=0;
- char *magicp, *data;
-
- data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
- sf_malloc_prehunc);
- /* Check for a possible underrun */
- if (*((uint32*) (data- sizeof(uint32))) != MAGICKEY)
- {
- fprintf(stderr, "Error: Memory allocated at %s:%d was underrun,",
- irem->filename, irem->linenum);
- fprintf(stderr, " discovered at %s:%d\n", filename, lineno);
- (void) fflush(stderr);
- DBUG_PRINT("safe",("Underrun at %p, allocated at %s:%d",
- data, irem->filename, irem->linenum));
- flag=1;
- }
-
- /* Check for a possible overrun */
- magicp= data + irem->datasize;
- if (*magicp++ != MAGICEND0 ||
- *magicp++ != MAGICEND1 ||
- *magicp++ != MAGICEND2 ||
- *magicp++ != MAGICEND3)
- {
- fprintf(stderr, "Error: Memory allocated at %s:%d was overrun,",
- irem->filename, irem->linenum);
- fprintf(stderr, " discovered at '%s:%d'\n", filename, lineno);
- (void) fflush(stderr);
- DBUG_PRINT("safe",("Overrun at %p, allocated at %s:%d",
- data, irem->filename, irem->linenum));
- flag=1;
- }
- return(flag);
-}
-
-
- /* Returns how many wrong chunks */
-
-int _sanity(const char *filename, uint lineno)
-{
- reg1 struct st_irem *irem;
- reg2 int flag=0;
- uint count=0;
-
- mysql_mutex_lock(&THR_LOCK_malloc);
-#ifndef PEDANTIC_SAFEMALLOC
- if (sf_malloc_tampered && (int) sf_malloc_count < 0)
- sf_malloc_count=0;
-#endif
- count=sf_malloc_count;
- for (irem= sf_malloc_root; irem != NULL && count-- ; irem= irem->next)
- flag+= _checkchunk (irem, filename, lineno);
- mysql_mutex_unlock(&THR_LOCK_malloc);
- if (count || irem)
- {
- const char *format="Error: Safemalloc link list destroyed, discovered at '%s:%d'";
- fprintf(stderr, format, filename, lineno); fputc('\n',stderr);
- fprintf(stderr, "root=%p,count=%d,irem=%p\n", sf_malloc_root,count,irem);
- (void) fflush(stderr);
- DBUG_PRINT("safe",(format, filename, lineno));
- flag=1;
- }
- return flag;
-} /* _sanity */
-
-
- /* malloc and copy */
-
-void *_my_memdup(const void *from, size_t length, const char *filename,
- uint lineno, myf MyFlags)
-{
- void *ptr;
- if ((ptr= _mymalloc(length,filename,lineno,MyFlags)) != 0)
- memcpy(ptr, from, length);
- return(ptr);
-} /*_my_memdup */
-
-
-char *_my_strdup(const char *from, const char *filename, uint lineno,
- myf MyFlags)
-{
- char *ptr;
- size_t length= strlen(from)+1;
- if ((ptr= (char*) _mymalloc(length,filename,lineno,MyFlags)) != 0)
- memcpy((uchar*) ptr, (uchar*) from, (size_t) length);
- return(ptr);
-} /* _my_strdup */
-
-
-char *_my_strndup(const char *from, size_t length,
- const char *filename, uint lineno,
- myf MyFlags)
-{
- char *ptr;
- if ((ptr= (char*) _mymalloc(length+1,filename,lineno,MyFlags)) != 0)
- {
- memcpy((uchar*) ptr, (uchar*) from, (size_t) length);
- ptr[length]=0;
- }
- return(ptr);
-}
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index f1b96cd03da..675910d2b20 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -334,44 +334,9 @@ void my_write_core(int sig)
#include <dbghelp.h>
#include <tlhelp32.h>
-
-/*
- Stack tracing on Windows is implemented using Debug Helper library(dbghelp.dll)
- We do not redistribute dbghelp and the one comes with older OS (up to Windows 2000)
- is missing some important functions like functions StackWalk64 or MinidumpWriteDump.
- Hence, we have to load functions at runtime using LoadLibrary/GetProcAddress.
-*/
-
-typedef DWORD (WINAPI *SymSetOptions_FctType)(DWORD dwOptions);
-typedef BOOL (WINAPI *SymGetModuleInfo64_FctType)
- (HANDLE,DWORD64,PIMAGEHLP_MODULE64) ;
-typedef BOOL (WINAPI *SymGetSymFromAddr64_FctType)
- (HANDLE,DWORD64,PDWORD64,PIMAGEHLP_SYMBOL64) ;
-typedef BOOL (WINAPI *SymGetLineFromAddr64_FctType)
- (HANDLE,DWORD64,PDWORD,PIMAGEHLP_LINE64);
-typedef BOOL (WINAPI *SymInitialize_FctType)
- (HANDLE,PSTR,BOOL);
-typedef BOOL (WINAPI *StackWalk64_FctType)
- (DWORD,HANDLE,HANDLE,LPSTACKFRAME64,PVOID,PREAD_PROCESS_MEMORY_ROUTINE64,
- PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64 ,
- PTRANSLATE_ADDRESS_ROUTINE64);
-typedef BOOL (WINAPI *MiniDumpWriteDump_FctType)(
- IN HANDLE hProcess,
- IN DWORD ProcessId,
- IN HANDLE hFile,
- IN MINIDUMP_TYPE DumpType,
- IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL
- IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL
- IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL
- );
-
-static SymSetOptions_FctType pSymSetOptions;
-static SymGetModuleInfo64_FctType pSymGetModuleInfo64;
-static SymGetSymFromAddr64_FctType pSymGetSymFromAddr64;
-static SymInitialize_FctType pSymInitialize;
-static StackWalk64_FctType pStackWalk64;
-static SymGetLineFromAddr64_FctType pSymGetLineFromAddr64;
-static MiniDumpWriteDump_FctType pMiniDumpWriteDump;
+#if _MSC_VER
+#pragma comment(lib, "dbghelp")
+#endif
static EXCEPTION_POINTERS *exception_ptrs;
@@ -382,50 +347,24 @@ void my_init_stacktrace()
{
}
-/*
- Dynamically load dbghelp functions
-*/
-BOOL init_dbghelp_functions()
-{
- static BOOL first_time= TRUE;
- static BOOL rc;
- HMODULE hDbghlp;
-
- if(first_time)
- {
- first_time= FALSE;
- hDbghlp= LoadLibrary("dbghelp");
- if(!hDbghlp)
- {
- rc= FALSE;
- return rc;
- }
- pSymSetOptions= (SymSetOptions_FctType)
- GetProcAddress(hDbghlp,"SymSetOptions");
- pSymInitialize= (SymInitialize_FctType)
- GetProcAddress(hDbghlp,"SymInitialize");
- pSymGetModuleInfo64= (SymGetModuleInfo64_FctType)
- GetProcAddress(hDbghlp,"SymGetModuleInfo64");
- pSymGetLineFromAddr64= (SymGetLineFromAddr64_FctType)
- GetProcAddress(hDbghlp,"SymGetLineFromAddr64");
- pSymGetSymFromAddr64=(SymGetSymFromAddr64_FctType)
- GetProcAddress(hDbghlp,"SymGetSymFromAddr64");
- pStackWalk64= (StackWalk64_FctType)
- GetProcAddress(hDbghlp,"StackWalk64");
- pMiniDumpWriteDump = (MiniDumpWriteDump_FctType)
- GetProcAddress(hDbghlp,"MiniDumpWriteDump");
-
- rc = (BOOL)(pSymSetOptions && pSymInitialize && pSymGetModuleInfo64
- && pSymGetLineFromAddr64 && pSymGetSymFromAddr64 && pStackWalk64);
- }
- return rc;
-}
void my_set_exception_pointers(EXCEPTION_POINTERS *ep)
{
exception_ptrs = ep;
}
+/*
+ Appends directory to symbol path.
+*/
+static void add_to_symbol_path(char *path, size_t path_buffer_size,
+ char *dir, size_t dir_buffer_size)
+{
+ strcat_s(dir, dir_buffer_size, ";");
+ if (!strstr(path, dir))
+ {
+ strcat_s(path, path_buffer_size, dir);
+ }
+}
/*
Get symbol path - semicolon-separated list of directories to search for debug
@@ -437,8 +376,28 @@ static void get_symbol_path(char *path, size_t size)
{
HANDLE hSnap;
char *envvar;
+ char *p;
+#ifndef DBUG_OFF
+ static char pdb_debug_dir[MAX_PATH + 7];
+#endif
path[0]= '\0';
+
+#ifndef DBUG_OFF
+ /*
+ Add "debug" subdirectory of the application directory, sometimes PDB will
+ placed here by installation.
+ */
+ GetModuleFileName(NULL, pdb_debug_dir, MAX_PATH);
+ p= strrchr(pdb_debug_dir, '\\');
+ if(p)
+ {
+ *p= 0;
+ strcat_s(pdb_debug_dir, sizeof(pdb_debug_dir), "\\debug;");
+ add_to_symbol_path(path, size, pdb_debug_dir, sizeof(pdb_debug_dir));
+ }
+#endif
+
/*
Enumerate all modules, and add their directories to the path.
Avoid duplicate entries.
@@ -452,7 +411,7 @@ static void get_symbol_path(char *path, size_t size)
for (ret= Module32First(hSnap, &mod); ret; ret= Module32Next(hSnap, &mod))
{
char *module_dir= mod.szExePath;
- char *p= strrchr(module_dir,'\\');
+ p= strrchr(module_dir,'\\');
if (!p)
{
/*
@@ -460,29 +419,23 @@ static void get_symbol_path(char *path, size_t size)
will indicate current directory.
*/
module_dir[0]= '.';
- p= module_dir + 1;
+ module_dir[1]= '\0';
}
- *p++= ';';
- *p= '\0';
-
- if (!strstr(path, module_dir))
+ else
{
- size_t dir_len = strlen(module_dir);
- if (size > dir_len)
- {
- strncat(path, module_dir, size-1);
- size -= dir_len;
- }
+ *p= '\0';
}
+ add_to_symbol_path(path, size, module_dir,sizeof(mod.szExePath));
}
CloseHandle(hSnap);
}
+
/* Add _NT_SYMBOL_PATH, if present. */
envvar= getenv("_NT_SYMBOL_PATH");
- if(envvar && size)
+ if(envvar)
{
- strncat(path, envvar, size-1);
+ strcat_s(path, size, envvar);
}
}
@@ -506,15 +459,15 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
STACKFRAME64 frame={0};
static char symbol_path[MAX_SYMBOL_PATH];
- if(!exception_ptrs || !init_dbghelp_functions())
+ if(!exception_ptrs)
return;
/* Copy context, as stackwalking on original will unwind the stack */
context = *(exception_ptrs->ContextRecord);
/*Initialize symbols.*/
- pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG);
+ SymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG);
get_symbol_path(symbol_path, sizeof(symbol_path));
- pSymInitialize(hProcess, symbol_path, TRUE);
+ SymInitialize(hProcess, symbol_path, TRUE);
/*Prepare stackframe for the first StackWalk64 call*/
frame.AddrFrame.Mode= frame.AddrPC.Mode= frame.AddrStack.Mode= AddrModeFlat;
@@ -546,11 +499,11 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
BOOL have_symbol= FALSE;
BOOL have_source= FALSE;
- if(!pStackWalk64(machine, hProcess, hThread, &frame, &context, 0, 0, 0 ,0))
+ if(!StackWalk64(machine, hProcess, hThread, &frame, &context, 0, 0, 0 ,0))
break;
addr= frame.AddrPC.Offset;
- have_module= pSymGetModuleInfo64(hProcess,addr,&module);
+ have_module= SymGetModuleInfo64(hProcess,addr,&module);
#ifdef _M_IX86
if(!have_module)
{
@@ -560,13 +513,13 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
happy, pretend passing the old structure.
*/
module.SizeOfStruct= MODULE64_SIZE_WINXP;
- have_module= pSymGetModuleInfo64(hProcess, addr, &module);
+ have_module= SymGetModuleInfo64(hProcess, addr, &module);
}
#endif
- have_symbol= pSymGetSymFromAddr64(hProcess, addr, &function_offset,
+ have_symbol= SymGetSymFromAddr64(hProcess, addr, &function_offset,
&(package.sym));
- have_source= pSymGetLineFromAddr64(hProcess, addr, &line_offset, &line);
+ have_source= SymGetLineFromAddr64(hProcess, addr, &line_offset, &line);
fprintf(stderr, "%p ", addr);
if(have_module)
@@ -610,7 +563,7 @@ void my_write_core(int unused)
MINIDUMP_EXCEPTION_INFORMATION info;
HANDLE hFile;
- if(!exception_ptrs || !init_dbghelp_functions() || !pMiniDumpWriteDump)
+ if(!exception_ptrs)
return;
info.ExceptionPointers= exception_ptrs;
@@ -628,7 +581,7 @@ void my_write_core(int unused)
if(hFile)
{
/* Create minidump */
- if(pMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
+ if(MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
hFile, MiniDumpNormal, &info, 0, 0))
{
fprintf(stderr, "Minidump written to %s\n",
diff --git a/mysys/string.c b/mysys/string.c
index 10a72b8a295..b1eded0664c 100644
--- a/mysys/string.c
+++ b/mysys/string.c
@@ -177,9 +177,6 @@ my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...)
void dynstr_free(DYNAMIC_STRING *str)
{
- if (str->str)
- {
- my_free(str->str,MYF(MY_WME));
- str->str=0;
- }
+ my_free(str->str);
+ str->str= NULL;
}
diff --git a/mysys/test_charset.c b/mysys/test_charset.c
index d867b49304e..5b399071d11 100644
--- a/mysys/test_charset.c
+++ b/mysys/test_charset.c
@@ -80,11 +80,11 @@ int main(int argc, char **argv) {
#ifdef NOT_USED_ANYMORE
cs_list = list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
printf("LIST OF CHARSETS (compiled + *.conf):\n%s\n", cs_list);
- my_free(cs_list,MYF(0));
+ my_free(cs_list);
cs_list = list_charsets(MYF(MY_CS_INDEX | MY_CS_LOADED));
printf("LIST OF CHARSETS (index + loaded):\n%s\n", cs_list);
- my_free(cs_list,MYF(0));
+ my_free(cs_list);
#endif
return 0;
diff --git a/mysys/testhash.c b/mysys/testhash.c
index 2add2ebd2d7..376303f29be 100644
--- a/mysys/testhash.c
+++ b/mysys/testhash.c
@@ -286,5 +286,5 @@ static int rnd(int max_value)
void free_record(void *record)
{
- my_free(record,MYF(0));
+ my_free(record);
}
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 8ee89cfb55d..9ca18eeaf1b 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -262,7 +262,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
{
queue_remove(&alarm_queue,i),MYF(0);
if (alarm_data->malloced)
- my_free((uchar*) alarm_data,MYF(0));
+ my_free(alarm_data);
found++;
#ifdef DBUG_OFF
break;
@@ -306,7 +306,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
#if defined(MAIN) && !defined(__bsdi__)
printf("thread_alarm in process_alarm\n"); fflush(stdout);
#endif
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */
#endif
return;
@@ -325,7 +325,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
#endif
process_alarm_part2(sig);
#ifndef USE_ALARM_THREAD
-#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
+#if defined(SIGNAL_HANDLER_RESET_ON_DELIVERY) && !defined(USE_ONE_SIGNAL_HAND)
my_sigset(THR_SERVER_ALARM,process_alarm);
#endif
mysql_mutex_unlock(&LOCK_alarm);
@@ -523,12 +523,12 @@ void thr_alarm_info(ALARM_INFO *info)
*/
-static sig_handler thread_alarm(int sig)
+static sig_handler thread_alarm(int sig __attribute__((unused)))
{
#ifdef MAIN
printf("thread_alarm\n"); fflush(stdout);
#endif
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(sig,thread_alarm); /* int. thread system calls */
#endif
}
@@ -797,7 +797,7 @@ static sig_handler print_signal_warning(int sig)
{
printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
fflush(stdout);
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(sig,print_signal_warning); /* int. thread system calls */
#endif
if (sig == SIGALRM)
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 43db0470735..9d10ba1fb01 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -29,7 +29,6 @@ TL_READ_WITH_SHARED_LOCKS
TL_READ_HIGH_PRIORITY # High priority read
TL_READ_NO_INSERT # Read without concurrent inserts
TL_WRITE_ALLOW_WRITE # Write lock that allows other writers
-TL_WRITE_ALLOW_READ # Write lock, but allow reading
TL_WRITE_CONCURRENT_INSERT
# Insert that can be mixed when selects
TL_WRITE_DELAYED # Used by delayed insert
@@ -41,7 +40,7 @@ TL_WRITE_ONLY # High priority write
Locks are prioritized according to:
-WRITE_ALLOW_WRITE, WRITE_ALLOW_READ, WRITE_CONCURRENT_INSERT, WRITE_DELAYED,
+WRITE_ALLOW_WRITE, WRITE_CONCURRENT_INSERT, WRITE_DELAYED,
WRITE_LOW_PRIORITY, READ, WRITE, READ_HIGH_PRIORITY and WRITE_ONLY
Locks in the same privilege level are scheduled in first-in-first-out order.
@@ -64,9 +63,8 @@ get_status:
In MyISAM this stores the number of rows and size of the datafile
for concurrent reads.
-The lock algorithm allows one to have one TL_WRITE_ALLOW_READ,
-TL_WRITE_CONCURRENT_INSERT or one TL_WRITE_DELAYED lock at the same time as
-multiple read locks.
+The lock algorithm allows one to have one TL_WRITE_CONCURRENT_INSERT or
+one TL_WRITE_DELAYED lock at the same time as multiple read locks.
*/
@@ -124,8 +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 *first_owner;
- LINT_INIT(first_owner);
+ THR_LOCK_OWNER *UNINIT_VAR(first_owner);
prev= &list->data;
if (list->data)
@@ -238,7 +235,6 @@ static void check_locks(THR_LOCK *lock, const char *where,
(((lock->write_wait.data->type == TL_WRITE_CONCURRENT_INSERT ||
lock->write_wait.data->type == TL_WRITE_ALLOW_WRITE) &&
!lock->read_no_write_count) ||
- lock->write_wait.data->type == TL_WRITE_ALLOW_READ ||
(lock->write_wait.data->type == TL_WRITE_DELAYED &&
!lock->read.data)))
{
@@ -543,14 +539,14 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
Request
/-------
H|++++ WRITE_ALLOW_WRITE
- e|++++ WRITE_ALLOW_READ
- l|+++- WRITE_CONCURRENT_INSERT
- d|++++ WRITE_DELAYED
- ||||
+ e|+++- WRITE_CONCURRENT_INSERT
+ l|++++ WRITE_DELAYED
+ d ||||
|||\= READ_NO_INSERT
||\ = READ_HIGH_PRIORITY
|\ = READ_WITH_SHARED_LOCKS
\ = READ
+
+ = Request can be satisified.
- = Request cannot be satisified.
@@ -620,14 +616,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
result= THR_LOCK_ABORTED; /* Can't wait for this one */
goto end;
}
- /*
- if there is a TL_WRITE_ALLOW_READ lock, we have to wait for a lock
- (TL_WRITE_ALLOW_READ is used for ALTER TABLE in MySQL)
- */
- if ((!lock->write.data ||
- lock->write.data->type != TL_WRITE_ALLOW_READ) &&
- !have_specific_lock(lock->write_wait.data,TL_WRITE_ALLOW_READ) &&
- (lock->write.data || lock->read.data))
+ if (lock->write.data || lock->read.data)
{
/* Add delayed write lock to write_wait queue, and return at once */
(*lock->write_wait.last)=data;
@@ -680,8 +669,6 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
it is OK to grant new lock without additional checks in such
situation.
**) The exceptions are situations when:
- - old lock type is TL_WRITE_ALLOW_READ and new lock type is
- TL_WRITE_ALLOW_WRITE
- when old lock type is TL_WRITE_DELAYED
But these should never happen within MySQL.
Therefore it is OK to allow acquiring write lock on the table if
@@ -695,9 +682,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
((lock_type <= lock->write.data->type ||
(lock_type == TL_WRITE &&
lock->write.data->type == TL_WRITE_LOW_PRIORITY)) &&
- ! ((lock_type < TL_WRITE_ALLOW_READ &&
- lock->write.data->type == TL_WRITE_ALLOW_READ) ||
- lock->write.data->type == TL_WRITE_DELAYED)));
+ lock->write.data->type != TL_WRITE_DELAYED));
if ((lock_type == TL_WRITE_ALLOW_WRITE &&
! lock->write_wait.data &&
@@ -1265,10 +1250,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread_id)
occurs also other waiters, both readers and writers can be allowed to
start.
The previous lock is often TL_WRITE_ONLY but can also be
- TL_WRITE and TL_WRITE_ALLOW_READ. The normal downgrade variants are
- TL_WRITE_ONLY => TL_WRITE_ALLOW_READ After a short exclusive lock
- TL_WRITE_ALLOW_READ => TL_WRITE_ALLOW_WRITE After discovering that the
- operation didn't need such a high lock.
+ TL_WRITE. The normal downgrade variants are:
TL_WRITE_ONLY => TL_WRITE after a short exclusive lock while holding a
write table lock
TL_WRITE_ONLY => TL_WRITE_ALLOW_WRITE After a short exclusive lock after
@@ -1289,11 +1271,6 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data,
#ifndef DBUG_OFF
enum thr_lock_type old_lock_type= in_data->type;
#endif
-#ifdef TO_BE_REMOVED
- THR_LOCK_DATA *data, *next;
- bool start_writers= FALSE;
- bool start_readers= FALSE;
-#endif
DBUG_ENTER("thr_downgrade_write_only_lock");
mysql_mutex_lock(&lock->mutex);
@@ -1302,165 +1279,6 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data,
in_data->type= new_lock_type;
check_locks(lock,"after downgrading lock",0);
-#if TO_BE_REMOVED
- switch (old_lock_type)
- {
- case TL_WRITE_ONLY:
- case TL_WRITE:
- case TL_WRITE_LOW_PRIORITY:
- /*
- Previous lock was exclusive we are now ready to start up most waiting
- threads.
- */
- switch (new_lock_type)
- {
- case TL_WRITE_ALLOW_READ:
- /* Still cannot start WRITE operations. Can only start readers. */
- start_readers= TRUE;
- break;
- case TL_WRITE:
- case TL_WRITE_LOW_PRIORITY:
- /*
- Still cannot start anything, but new requests are no longer
- aborted.
- */
- break;
- case TL_WRITE_ALLOW_WRITE:
- /*
- We can start both writers and readers.
- */
- start_writers= TRUE;
- start_readers= TRUE;
- break;
- case TL_WRITE_CONCURRENT_INSERT:
- case TL_WRITE_DELAYED:
- /*
- This routine is not designed for those. Lock will be downgraded
- but no start of waiters will occur. This is not the optimal but
- should be a correct behaviour.
- */
- break;
- default:
- DBUG_ASSERT(0);
- }
- break;
- case TL_WRITE_DELAYED:
- case TL_WRITE_CONCURRENT_INSERT:
- /*
- This routine is not designed for those. Lock will be downgraded
- but no start of waiters will occur. This is not the optimal but
- should be a correct behaviour.
- */
- break;
- case TL_WRITE_ALLOW_READ:
- DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE);
- /*
- Previously writers were not allowed to start, now it is ok to
- start them again. Readers are already allowed so no reason to
- handle them.
- */
- start_writers= TRUE;
- break;
- default:
- DBUG_ASSERT(0);
- break;
- }
- if (start_writers)
- {
- /*
- At this time the only active writer can be ourselves. Thus we need
- not worry about that there are other concurrent write operations
- active on the table. Thus we only need to worry about starting
- waiting operations.
- We also only come here with TL_WRITE_ALLOW_WRITE as the new
- lock type, thus we can start other writers also of the same type.
- If we find a lock at exclusive level >= TL_WRITE_LOW_PRIORITY we
- don't start any more operations that would be mean those operations
- will have to wait for things started afterwards.
- */
- DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE);
- for (data=lock->write_wait.data; data ; data= next)
- {
- /*
- All WRITE requests compatible with new lock type are also
- started
- */
- next= data->next;
- if (start_writers && data->type == new_lock_type)
- {
- mysql_cond_t *cond= data->cond;
- /*
- It is ok to start this waiter.
- Move from being first in wait queue to be last in write queue.
- */
- if (((*data->prev)= data->next))
- data->next->prev= data->prev;
- else
- lock->write_wait.last= data->prev;
- data->prev= lock->write.last;
- lock->write.last= &data->next;
- data->next= 0;
- check_locks(lock, "Started write lock after downgrade",0);
- data->cond= 0;
- mysql_cond_signal(cond);
- }
- else
- {
- /*
- We found an incompatible lock, we won't start any more write
- requests to avoid letting writers pass other writers in the
- queue.
- */
- start_writers= FALSE;
- if (data->type >= TL_WRITE_LOW_PRIORITY)
- {
- /*
- We have an exclusive writer in the queue so we won't start
- readers either.
- */
- start_readers= FALSE;
- }
- }
- }
- }
- if (start_readers)
- {
- DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE ||
- new_lock_type == TL_WRITE_ALLOW_READ);
- /*
- When we come here we know that the write locks are
- TL_WRITE_ALLOW_WRITE or TL_WRITE_ALLOW_READ. This means that reads
- are ok
- */
- for (data=lock->read_wait.data; data ; data=next)
- {
- next= data->next;
- /*
- All reads are ok to start now except TL_READ_NO_INSERT when
- write lock is TL_WRITE_ALLOW_READ.
- */
- if (new_lock_type != TL_WRITE_ALLOW_READ ||
- data->type != TL_READ_NO_INSERT)
- {
- mysql_cond_t *cond= data->cond;
- if (((*data->prev)= data->next))
- data->next->prev= data->prev;
- else
- lock->read_wait.last= data->prev;
- data->prev= lock->read.last;
- lock->read.last= &data->next;
- data->next= 0;
-
- if (data->type == TL_READ_NO_INSERT)
- lock->read_no_write_count++;
- check_locks(lock, "Started read lock after downgrade",0);
- data->cond= 0;
- mysql_cond_signal(cond);
- }
- }
- }
- check_locks(lock,"after starting waiters after downgrading lock",0);
-#endif
mysql_mutex_unlock(&lock->mutex);
DBUG_VOID_RETURN;
}
@@ -1646,15 +1464,14 @@ struct st_test test_8[] = {{1,TL_READ_NO_INSERT},{2,TL_READ_NO_INSERT},{3,TL_REA
struct st_test test_9[] = {{4,TL_READ_HIGH_PRIORITY}};
struct st_test test_10[] ={{4,TL_WRITE}};
struct st_test test_11[] = {{0,TL_WRITE_LOW_PRIORITY},{1,TL_WRITE_LOW_PRIORITY},{2,TL_WRITE_LOW_PRIORITY},{3,TL_WRITE_LOW_PRIORITY}}; /* Many writes */
-struct st_test test_12[] = {{0,TL_WRITE_ALLOW_READ},{1,TL_WRITE_ALLOW_READ},{2,TL_WRITE_ALLOW_READ},{3,TL_WRITE_ALLOW_READ}}; /* Many writes */
-struct st_test test_13[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_WRITE_CONCURRENT_INSERT},{2,TL_WRITE_CONCURRENT_INSERT},{3,TL_WRITE_CONCURRENT_INSERT}};
-struct st_test test_14[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_READ}};
-struct st_test test_15[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_READ}};
-struct st_test test_16[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_WRITE_ALLOW_WRITE}};
+struct st_test test_12[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_WRITE_CONCURRENT_INSERT},{2,TL_WRITE_CONCURRENT_INSERT},{3,TL_WRITE_CONCURRENT_INSERT}};
+struct st_test test_13[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_READ}};
+struct st_test test_14[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_READ}};
+struct st_test test_15[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_WRITE_ALLOW_WRITE}};
struct st_test *tests[] = {test_0,test_1,test_2,test_3,test_4,test_5,test_6,
test_7,test_8,test_9,test_10,test_11,test_12,
- test_13,test_14,test_15,test_16};
+ test_13,test_14,test_15};
int lock_counts[]= {sizeof(test_0)/sizeof(struct st_test),
sizeof(test_1)/sizeof(struct st_test),
sizeof(test_2)/sizeof(struct st_test),
@@ -1670,8 +1487,7 @@ int lock_counts[]= {sizeof(test_0)/sizeof(struct st_test),
sizeof(test_12)/sizeof(struct st_test),
sizeof(test_13)/sizeof(struct st_test),
sizeof(test_14)/sizeof(struct st_test),
- sizeof(test_15)/sizeof(struct st_test),
- sizeof(test_16)/sizeof(struct st_test)
+ sizeof(test_15)/sizeof(struct st_test)
};
@@ -1681,6 +1497,7 @@ static uint thread_count;
static ulong sum=0;
#define MAX_LOCK_COUNT 8
+#define TEST_TIMEOUT 100000
/* The following functions is for WRITE_CONCURRENT_INSERT */
@@ -1727,7 +1544,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);
+ thr_multi_lock(multi_locks, lock_counts[param], &owner, TEST_TIMEOUT);
mysql_mutex_lock(&LOCK_thread_count);
{
int tmp=rand() & 7; /* Do something from 0-2 sec */
diff --git a/mysys/tree.c b/mysys/tree.c
index ef33f75b7c6..8ea7102ed4c 100644
--- a/mysys/tree.c
+++ b/mysys/tree.c
@@ -183,7 +183,7 @@ static void delete_tree_element(TREE *tree, TREE_ELEMENT *element)
(*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg);
delete_tree_element(tree,element->right);
if (tree->with_delete)
- my_free((char*) element,MYF(0));
+ my_free(element);
}
}
@@ -326,7 +326,7 @@ int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg)
if (tree->free)
(*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg);
tree->allocated-= sizeof(TREE_ELEMENT) + tree->size_of_element + key_size;
- my_free((uchar*) element,MYF(0));
+ my_free(element);
tree->elements_in_tree--;
return 0;
}
diff --git a/mysys/trie.c b/mysys/trie.c
index 5738b9b866b..b2e93fcceac 100644
--- a/mysys/trie.c
+++ b/mysys/trie.c
@@ -211,7 +211,7 @@ my_bool ac_trie_prepare (TRIE *trie)
fail= fail->fail;
}
}
- my_free((uchar*)tmp_nodes, MYF(0));
+ my_free(tmp_nodes);
DBUG_RETURN(FALSE);
}
diff --git a/netware/BUILD/apply-patch b/netware/BUILD/apply-patch
deleted file mode 100755
index 3fe5a077f9a..00000000000
--- a/netware/BUILD/apply-patch
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-# repository directory
-repo_dir=`pwd`
-
-# show usage
-show_usage()
-{
- cat << EOF
-
-usage: apply-patch
-
-Imports netware/current-changes.patch so that current changes
-for the platform are present on the local repository.
-
-Use from the root directory of the repository, with BitKeeper
-installed.
-
-EOF
- exit 0;
-}
-
-if test $1 || test -z $BK_USER
-then
- show_usage
-fi
-
-echo "starting patch..."
-
-echo "user: $BK_USER"
-
-# import patch
-# Note: In future this should be changed to check whether
-# the repo already has this patch
-bk import -tpatch $repo_dir/netware/current-changes.patch $repo_dir
diff --git a/netware/BUILD/compile-AUTOTOOLS b/netware/BUILD/compile-AUTOTOOLS
deleted file mode 100755
index c93fb1b1b28..00000000000
--- a/netware/BUILD/compile-AUTOTOOLS
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-sed -e "s/^DIST_COMMON/#DIST_COMMON/g" storage/ndb/Makefile.am > storage/ndb/Makefile.am.$$
-mv storage/ndb/Makefile.am.$$ storage/ndb/Makefile.am
-
-# for package in . ./storage/innobase
-for package in .
-do
- (cd $package
- rm -rf config.cache autom4te.cache
- aclocal
- autoheader
- libtoolize --force
- aclocal
-# automake --verbose --add-missing --force-missing
- automake --add-missing --force-missing
- autoconf)
-done
-
-#rm -rf ./bdb/build_unix/config.cache ./bdb/dist/autom4te.cache
-#(cd ./bdb/dist && sh s_all)
diff --git a/netware/BUILD/compile-linux-tools b/netware/BUILD/compile-linux-tools
deleted file mode 100755
index 6a6abd32639..00000000000
--- a/netware/BUILD/compile-linux-tools
+++ /dev/null
@@ -1,67 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-if test ! -r ./sql/mysqld.cc
-then
- echo "you must start from the top source directory"
- exit 1
-fi
-
-path=`dirname $0`
-
-# clean
-if test -e "Makefile"; then make -k clean; fi
-
-# remove files
-rm -f */.deps/*.P
-rm -f */*.linux
-
-# run autotools
-. $path/compile-AUTOTOOLS
-
-# configure
-./configure --without-innodb --without-docs
-
-# build tools only
-make clean
-make
-
-# Create mysql_version.h which was deleted my previous step
-./config.status include/mysql_version.h
-
-(cd dbug; make libdbug.a)
-(cd strings; make libmystrings.a)
-(cd mysys; make libmysys.a)
-(cd storage/heap; make libheap.a)
-(cd vio; make libvio.a)
-(cd regex; make libregex.a)
-(cd storage/myisam; make libmyisam.a)
-(cd storage/myisammrg; make libmyisammrg.a)
-(cd extra; make comp_err)
-(cd libmysql; make conf_to_src)
-(cd libmysql_r; make conf_to_src)
-# so the file will be linked
-(cd sql; make sql_yacc.cc)
-(cd sql; make gen_lex_hash)
-(cd strings; make conf_to_src)
-
-# so the file will be linked
-(cd sql; make sql_yacc.cc)
-
-# we need initilizing SQL files.
-(cd netware; make test_db.sql init_db.sql)
-
-# copying required linux tools
-cp extra/comp_err extra/comp_err.linux
-cp libmysql/conf_to_src libmysql/conf_to_src.linux
-#cp libmysql_r/conf_to_src libmysql_r/conf_to_src.linux
-cp sql/gen_lex_hash sql/gen_lex_hash.linux
-cp strings/conf_to_src strings/conf_to_src.linux
-
-# Delete mysql_version.h
-rm -f include/mysql_version.h
diff --git a/netware/BUILD/compile-netware-END b/netware/BUILD/compile-netware-END
deleted file mode 100755
index bf712f09162..00000000000
--- a/netware/BUILD/compile-netware-END
+++ /dev/null
@@ -1,52 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-path=`dirname $0`
-
-# clean
-if test -e "Makefile"; then make -k clean; fi
-
-# remove files
-rm -f */.deps/*.P
-rm -rf Makefile.in.bk
-
-# Setup Metrowerks environment
-. $path/mwenv
-
-# Temporary hack to allow building from source dist
-if [ ! "$USER"=pushbuild ]
-then
- # Run autotools(use BUILD/autorun.sh)
- echo "Running autotools again(BUILD/autorun.sh)"
- . BUILD/autorun.sh
-fi
-
-# configure
-./configure $base_configs $extra_configs
-
-# Ensure a clean tree
-make clean
-
-# Link NetWare specific .def files into their proper locations
-# in the source tree
-( cd netware && make link_sources )
-
-# Now, do the real build
-make bin-dist
-
-# mark the build
-for file in *.tar.gz *.zip
-do
- if (expr "$file" : "mysql-[1-9].*" > /dev/null)
- then
- new_file=`echo $file | sed -e "s/mysql-/mysql-$suffix-/"`
- if test -e "$new_file"; then mv -f $new_file $new_file.old; fi
- mv $file $new_file
- fi
-done
-
diff --git a/netware/BUILD/compile-netware-START b/netware/BUILD/compile-netware-START
deleted file mode 100755
index 414d577130e..00000000000
--- a/netware/BUILD/compile-netware-START
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-if test ! -r ./sql/mysqld.cc
-then
- echo "you must start from the top source directory"
- exit 1
-fi
-
-path=`dirname $0`
-
-# stop on errors
-set -e
-
-base_configs=" \
- --host=i686-pc-netware \
- --enable-local-infile \
- --with-extra-charsets=all \
- --prefix=N:/mysql \
- --without-man \
- "
diff --git a/netware/BUILD/compile-netware-all b/netware/BUILD/compile-netware-all
deleted file mode 100755
index dbe64e8f97e..00000000000
--- a/netware/BUILD/compile-netware-all
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-path=`dirname $0`
-
-$path/compile-netware-src
-$path/compile-netware-standard
-$path/compile-netware-debug
-$path/compile-netware-max
-$path/compile-netware-max-debug
diff --git a/netware/BUILD/compile-netware-debug b/netware/BUILD/compile-netware-debug
deleted file mode 100755
index e44d64e3074..00000000000
--- a/netware/BUILD/compile-netware-debug
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-path=`dirname $0`
-. $path/compile-netware-START
-
-suffix="debug"
-
-extra_configs=" \
- --with-innodb \
- --with-debug=full \
- "
-
-. $path/compile-netware-END
-
-
diff --git a/netware/BUILD/compile-netware-max b/netware/BUILD/compile-netware-max
deleted file mode 100755
index d8278a4e915..00000000000
--- a/netware/BUILD/compile-netware-max
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-
-path=`dirname $0`
-. $path/compile-netware-START
-
-suffix="max"
-
-extra_configs=" \
- --with-innodb \
- --with-embedded-server \
- --with-ssl \
- "
-
-. $path/compile-netware-END
-
-
diff --git a/netware/BUILD/compile-netware-max-debug b/netware/BUILD/compile-netware-max-debug
deleted file mode 100755
index de1b5dd17cc..00000000000
--- a/netware/BUILD/compile-netware-max-debug
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-path=`dirname $0`
-. $path/compile-netware-START
-
-suffix="max-debug"
-
-extra_configs=" \
- --with-innodb \
- --with-debug=full \
- --with-embedded-server \
- --with-ssl \
- "
-
-. $path/compile-netware-END
-
-
diff --git a/netware/BUILD/compile-netware-src b/netware/BUILD/compile-netware-src
deleted file mode 100755
index f4e8a53ffea..00000000000
--- a/netware/BUILD/compile-netware-src
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-if test ! -r ./sql/mysqld.cc
-then
- echo "you must start from the top source directory"
- exit 1
-fi
-
-path=`dirname $0`
-
-# clean
-if test -e "Makefile"; then
- make -k clean;
- make -k distclean;
-fi
-
-# remove other files
-rm -f */.deps/*.P
-rm -rf Makefile.in.bk
-
-# zip source
-files=`pwd | sed -e "s/.*\\\(mysql-.*\)/\1/"`
-file=`pwd | sed -e "s/.*\\mysql-\(.*\)/mysql-src-\1-pc-netware-i686/"`
-cd ..
-if test -e "$file.zip"; then rm -f $file.zip; fi
-zip -r $file.zip $files -x \*.zip -x \*.tar.gz
-if test -e "./$files/$file.zip"; then mv -f ./$files/$file.zip ./$files/$file.zip.old; fi
-mv -f $file.zip ./$files/$file.zip
-
diff --git a/netware/BUILD/compile-netware-standard b/netware/BUILD/compile-netware-standard
deleted file mode 100755
index 76a776a1da3..00000000000
--- a/netware/BUILD/compile-netware-standard
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-
-path=`dirname $0`
-. $path/compile-netware-START
-
-suffix="standard"
-
-extra_configs=" \
- --with-innodb \
- --enable-thread-safe-client \
- --with-archive-storage-engine \
- "
-
-. $path/compile-netware-END
-
-
diff --git a/netware/BUILD/create-patch b/netware/BUILD/create-patch
deleted file mode 100755
index 711eabf2d89..00000000000
--- a/netware/BUILD/create-patch
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-# repository direcotry
-repo_dir=`pwd`
-
-# show usage
-show_usage()
-{
- cat << EOF
-
-usage: create-patch
-
-Creates a patch file between the latest revision of the current tree
-and the latest revision not create by \$BK_USER.
-
-EOF
- exit 0;
-}
-
-if test $1 || test -z $BK_USER
-then
- show_usage
-fi
-
-echo "starting patch..."
-
-echo "user: $BK_USER"
-
-# check for bk and repo_dir
-bk help > /dev/null
-repo_dir=`bk root $repo_dir`
-cd $repo_dir
-
-# determine version
-version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"`
-echo "version: $version"
-
-# user revision
-user_rev=`bk changes -e -n -d':REV:' | head -1`
-echo "latest revision: $user_rev"
-
-# tree revision
-tree_rev=`bk changes -e -n -d':REV:' -U$BK_USER | head -1`
-echo "latest non-$BK_USER revision: $tree_rev"
-
-# create patch
-patch="$repo_dir/../$BK_USER-$version.patch"
-echo "creating \"$patch\"..."
-bk export -tpatch -r$tree_rev..$user_rev > $patch
-
diff --git a/netware/BUILD/cron-build b/netware/BUILD/cron-build
deleted file mode 100755
index 26ccde28e2a..00000000000
--- a/netware/BUILD/cron-build
+++ /dev/null
@@ -1,46 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-# repository direcotry
-repo_dir=`pwd`
-
-# show usage
-show_usage()
-{
- cat << EOF
-
-usage: cron-patch
-
-EOF
- exit 0;
-}
-
-echo "starting build..."
-
-# check for bk and repo_dir
-bk help > /dev/null
-repo_dir=`bk root $repo_dir`
-cd $repo_dir
-
-# pull latest code
-echo 'y' | bk pull
-
-# determine version
-version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"`
-echo "version: $version"
-
-# latest revision
-rev=`bk changes -e -n -d':REV:' | head -1`
-echo "latest revision: $rev"
-
-# run bootstrap
-./netware/BUILD/nwbootstrap --revision=$rev --suffix=$rev --build=all
-
-echo "done"
-
-
diff --git a/netware/BUILD/crontab b/netware/BUILD/crontab
deleted file mode 100755
index 0097f8acaaf..00000000000
--- a/netware/BUILD/crontab
+++ /dev/null
@@ -1,4 +0,0 @@
-00 23 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysqldoc; echo 'y' | bk pull)
-00 00 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysql-4.0; ./netware/BUILD/cron-build)
-00 04 * * * (export PATH='/usr/local/bin:/usr/bin:/bin'; export DISPLAY=':0'; cd ~/bk/mysql-4.1; ./netware/BUILD/cron-build)
-
diff --git a/netware/BUILD/knetware.imp b/netware/BUILD/knetware.imp
deleted file mode 100644
index d9a9372b34f..00000000000
--- a/netware/BUILD/knetware.imp
+++ /dev/null
@@ -1,2 +0,0 @@
-kYieldIfTimeSliceUp
-
diff --git a/netware/BUILD/mwasmnlm b/netware/BUILD/mwasmnlm
deleted file mode 100755
index 11fc2bc3842..00000000000
--- a/netware/BUILD/mwasmnlm
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /bin/sh
-
-# stop on errors
-set -e
-
-args=" $*"
-
-# NOTE: Option 'pipefail' is not standard sh
-set -o pipefail
-wine --debugmsg -all -- mwasmnlm $args | \
-perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g'
diff --git a/netware/BUILD/mwccnlm b/netware/BUILD/mwccnlm
deleted file mode 100755
index 030d87288f2..00000000000
--- a/netware/BUILD/mwccnlm
+++ /dev/null
@@ -1,16 +0,0 @@
-#! /bin/sh
-
-# stop on errors
-set -e
-
-# mwccnlm is having a hard time understanding:
-# * "-I./../include", convert it to "-I../include"
-# * "-I.../..", convert it to "-I../../"
-args=" "`echo $* | sed \
--e 's/-I.\/../-I../g' \
--e 's/\(-I[.\/]*.\) /\1\/ /g'`
-
-# NOTE: Option 'pipefail' is not standard sh
-set -o pipefail
-wine --debugmsg -all -- mwccnlm $args | \
-perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g'
diff --git a/netware/BUILD/mwenv b/netware/BUILD/mwenv
deleted file mode 100755
index 44497c48917..00000000000
--- a/netware/BUILD/mwenv
+++ /dev/null
@@ -1,75 +0,0 @@
-#! /bin/sh
-
-if test ! -r ./sql/mysqld.cc
-then
- echo "you must start from the top source directory"
- exit 1
-fi
-
-# The base path(in wineformat) where compilers, includes and
-# libraries are installed
-if test -z "$MYDEV"
-then
- # the default is "F:/mydev"
- export MYDEV="F:/mydev"
-fi
-echo "MYDEV: $MYDEV"
-
-# Get current dir
-BUILD_DIR=`pwd`
-echo "BUILD_DIR: $BUILD_DIR"
-
-# Get current dir in wine format
-base=`echo $MYDEV |sed 's/\/.*//'`
-base_unix_part=`winepath -- -u $base/`
-WINE_BUILD_DIR=`echo "$BUILD_DIR" | sed 's_'$base_unix_part'/__'`
-WINE_BUILD_DIR="$base/$WINE_BUILD_DIR"
-echo "WINE_BUILD_DIR: $WINE_BUILD_DIR"
-
-# Look for libc, MySQL 5.1.x uses libc-2006 by default
-libc_dir="$MYDEV/libc-2006"
-if [ ! -d `winepath $libc_dir` ]
-then
- # The libcdir didn't exist, set default
- libc_dir="$MYDEV/libc"
-fi
-echo "Using libc in $libc_dir";
-
-export MWCNWx86Includes="$libc_dir/include;$MYDEV/fs64/headers;$MYDEV/zlib-1.2.3;$WINE_BUILD_DIR/include;$MYDEV"
-export MWNWx86Libraries="$libc_dir/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.2.3;$MYDEV/openssl;$WINE_BUILD_DIR/netware/BUILD"
-export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;libz.a;neb.imp;zPublics.imp;knetware.imp"
-
-export WINEPATH="$MYDEV/mw/bin"
-
-# the default added path is "$BUILD_DIR/netware/BUILD"
-export PATH="$PATH:$BUILD_DIR/netware/BUILD"
-
-export AR='mwldnlm'
-export AR_FLAGS='-type library -o'
-export AS='mwasmnlm'
-export CC='mwccnlm -gccincludes'
-export CFLAGS='-enum int -align 8 -proc 686 -relax_pointers -dialect c'
-export CXX='mwccnlm -gccincludes'
-export CXXFLAGS='-enum int -align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T'
-export LD='mwldnlm'
-export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -map -flags pseudopreemption'
-export RANLIB=:
-export STRIP=:
-
-#
-# Check that TERM has been set to avoid problem "Error opening
-# terminal: unknown" when the script is executed using non interactive ssh
-#
-if test -z "$TERM" -o "$TERM"=dumb
-then
- export TERM=linux
-fi
-
-# Temporary hack to allow building from source dist
-if [ "$USER"=pushbuild ]
-then
- export ARFLAGS=$AR_FLAGS
-fi
-
-# Print all env. variables
-export
diff --git a/netware/BUILD/mwldnlm b/netware/BUILD/mwldnlm
deleted file mode 100755
index b1822827b59..00000000000
--- a/netware/BUILD/mwldnlm
+++ /dev/null
@@ -1,18 +0,0 @@
-#! /bin/sh
-
-# stop on errors
-set -e
-
-# If libtool passes "x" as the first argument to this script
-# it's an indication that libtool is trying to unpack .la's
-# so they can be added to a new library
-# This step does not work on Netware and we avoid it by
-# replacing the .la library with the path to the .a library
-# in Makefile.in
-
-args=" $*"
-
-# NOTE: Option 'pipefail' is not standard sh
-set -o pipefail
-wine --debugmsg -all -- mwldnlm $args | \
-perl -pe 's/\r//g; s/^\e.*\e(\[J|>)?//; s/[[^:print:]]//g'
diff --git a/netware/BUILD/nwbuild b/netware/BUILD/nwbuild
deleted file mode 100755
index d431f70add8..00000000000
--- a/netware/BUILD/nwbuild
+++ /dev/null
@@ -1,86 +0,0 @@
-#! /bin/sh
-
-# This script builds a Netware binary from a MySQL source tarball
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-# init
-build=""
-
-# show usage
-show_usage()
-{
- cat << EOF
-
-usage: nwbuild [options]
-
-Build Netware binary from source .tar.gz
-
-options:
-
---build=<opt> Build the binary distributions for NetWare,
- where <opt> is "standard", "debug", or "all"
- (default is to not build a binary distribution)
-
---help Show this help information
-
-Examples:
-
- ./netware/BUILD/nwbuild --build=debug
- ./netware/BUILD/nwbuild --build=standard
-
-EOF
-}
-
-# parse arguments
-for arg do
- case "$arg" in
- --build=*) build=`echo "$arg" | sed -e "s;--build=;;"` ;;
- --help) show_usage; exit 0 ;;
- *) show_usage >&2; exit 1 ;;
- esac
-done
-
-# determine version
-version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"`
-echo "version: $version"
-
-# make files writeable
-echo "making files writable..."
-chmod -R u+rw,g+rw .
-
-# edit the def file versions
-nlm_version=`echo "$version" | sed -e "s;\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*;\1, \2, \3;"`
-echo "updating *.def file versions to $nlm_version..."
-
-for file in ./netware/*.def
-do
- mv -f $file $file.org
- sed -e "s;VERSION.*;VERSION $nlm_version;g" $file.org > $file
- rm $file.org
-done
-
-# create the libmysql.imp file in netware folder from libmysql/libmysql.def
-# file
-echo "generating libmysql.imp file..."
-awk 'BEGIN{x=0;} END{printf("\n");} x==1 {printf(" %s",$1); x++; next} x>1 {printf(",\n %s", $1);next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp
-# build linux tools
-echo "compiling linux tools..."
-./netware/BUILD/compile-linux-tools
-test -f ./netware/init_db.sql # this must exist
-test -f ./netware/test_db.sql # this must exist
-
-# compile
-if test $build
-then
- echo "compiling $build..."
- ./netware/BUILD/compile-netware-$build
-else
- echo "Preparation complete. Use ./netware/BUILD/compile-netware-* to build MySQL."
-fi
-
-echo "done"
diff --git a/netware/BUILD/openssl.imp b/netware/BUILD/openssl.imp
deleted file mode 100644
index 8972ff5d58c..00000000000
--- a/netware/BUILD/openssl.imp
+++ /dev/null
@@ -1,9 +0,0 @@
-WS2_32_shutdown
-WS2_32_closesocket
-WSASetLastError
-WS2_32_recv
-WSASetLastError
-WS2_32_send
-WSAGetLastError
-GetProcessSwitchCount
-RunningProcess
diff --git a/netware/BUILD/save-patch b/netware/BUILD/save-patch
deleted file mode 100755
index 9f9979ace5b..00000000000
--- a/netware/BUILD/save-patch
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /bin/sh
-
-# debug
-#set -x
-
-# stop on errors
-set -e
-
-# repository directory
-repo_dir=`pwd`
-
-# show usage
-show_usage()
-{
- cat << EOF
-
-usage: save-patch
-
-Creates a patch file between the latest revision of the current tree
-and the latest revision not created by \$BK_USER and places it in
-the tree as netware/current-changes.patch
-
-EOF
- exit 0;
-}
-
-if test $1 || test -z $BK_USER
-then
- show_usage
-fi
-
-echo "starting patch..."
-
-echo "user: $BK_USER"
-
-# check for bk and repo_dir
-bk help > /dev/null
-repo_dir=`bk root $repo_dir`
-cd $repo_dir
-
-# determine version
-version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"`
-echo "version: $version"
-
-# user revision
-user_rev=`bk changes -e -n -d':REV:' | head -1`
-echo "latest revision: $user_rev"
-
-# tree revision
-tree_rev=`bk changes -e -n -d':REV:' -U$BK_USER | head -1`
-echo "latest non-$BK_USER revision: $tree_rev"
-
-# create patch
-patch="$repo_dir/netware/current-changes.patch"
-echo "creating \"$patch\"..."
-bk export -tpatch -r$tree_rev..$user_rev -xnetware/current-changes.patch > $patch
diff --git a/netware/Makefile.am b/netware/Makefile.am
deleted file mode 100644
index f537022495b..00000000000
--- a/netware/Makefile.am
+++ /dev/null
@@ -1,117 +0,0 @@
-# Copyright (c) 2002 Novell, Inc. 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; either version 2 of the License, or
-# (at your option) any later version.
-#
-# 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
-
-if HAVE_NETWARE
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
-LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
- ../dbug/libdbug.a ../strings/libmystrings.a
-bin_PROGRAMS = mysqld_safe mysql_install_db mysql_test_run libmysql
-mysqld_safe_SOURCES= mysqld_safe.c my_manage.c
-mysql_install_db_SOURCES= mysql_install_db.c my_manage.c
-mysql_test_run_SOURCES= mysql_test_run.c my_manage.c
-libmysql_SOURCES= libmysqlmain.c
-libmysql_LDADD = ../libmysql/.libs/libmysqlclient.a \
- @openssl_libs@ @yassl_libs@
-
-netware_build_files = client/mysql.def client/mysqladmin.def \
- client/mysqlbinlog.def client/mysqlcheck.def \
- client/mysqldump.def client/mysqlimport.def \
- client/mysqlshow.def client/mysqltest.def \
- client/mysqlslap.def client/mysql_upgrade.def \
- sql/mysqld.def extra/mysql_waitpid.def \
- tests/mysql_client_test.def \
- extra/my_print_defaults.def \
- extra/perror.def extra/replace.def \
- extra/resolveip.def extra/comp_err.def \
- extra/resolve_stack_dump.def \
- libmysqld/libmysqld.def \
- storage/myisam/myisamchk.def \
- storage/myisam/myisamlog.def \
- storage/myisam/myisampack.def \
- storage/myisam/myisam_ftdump.def
-
-BUILT_SOURCES = link_sources init_db.sql test_db.sql
-CLEANFILES = $(BUILT_SOURCES)
-
-all: $(BUILT_SOURCES)
-
-link_sources:
- for f in $(netware_build_files); do \
- rm -f ../$$f; \
- org=`basename $$f`; \
- @LN_CP_F@ $(srcdir)/$$org ../$$f; \
- done
- echo timestamp > link_sources
-
-else
-
-BUILT_SOURCES = libmysql.imp init_db.sql test_db.sql
-DISTCLEANFILES = libmysql.imp
-CLEANFILES = init_db.sql test_db.sql
-
-# Create the libmysql.imp from libmysql/libmysql.def
-libmysql.imp: $(top_srcdir)/libmysql/libmysql.def
- $(AWK) 'BEGIN{x=0;} \
- END{printf("\n");} \
- x==1 {printf(" %s",$$1); x++; next} \
- x>1 {printf(",\n %s", $$1); next} \
- /EXPORTS/{x=1}' $(top_srcdir)/libmysql/libmysql.def > libmysql.imp
-
-EXTRA_DIST= $(BUILT_SOURCES) comp_err.def install_test_db.ncf \
- libmysql.def \
- libmysqlmain.c my_manage.c my_manage.h \
- my_print_defaults.def myisam_ftdump.def myisamchk.def \
- myisamlog.def myisampack.def mysql.def mysql.xdc \
- mysql_fix_privilege_tables.pl \
- mysql_install_db.c mysql_install_db.def \
- mysql_secure_installation.pl mysql_test_run.c \
- mysql_test_run.def mysql_waitpid.def mysqladmin.def \
- mysqlbinlog.def mysqlcheck.def mysqld.def \
- mysqld_safe.c mysqld_safe.def mysqldump.def mysqlimport.def \
- mysqlshow.def mysqltest.def mysqlslap.def mysql_upgrade.def \
- perror.def \
- mysql_client_test.def \
- replace.def resolve_stack_dump.def resolveip.def \
- static_init_db.sql init_db.sql test_db.sql \
- BUILD/apply-patch BUILD/compile-AUTOTOOLS \
- BUILD/compile-linux-tools BUILD/compile-netware-END \
- BUILD/compile-netware-START BUILD/compile-netware-all\
- BUILD/compile-netware-debug BUILD/compile-netware-max \
- BUILD/compile-netware-max-debug BUILD/compile-netware-src \
- BUILD/compile-netware-standard BUILD/create-patch \
- BUILD/cron-build BUILD/crontab BUILD/knetware.imp \
- BUILD/mwasmnlm BUILD/mwccnlm BUILD/mwenv BUILD/mwldnlm \
- BUILD/nwbuild BUILD/openssl.imp BUILD/save-patch
-
-endif
-
-
-# Build init_db.sql from the files that contain
-# the system tables for this version of MySQL plus any commands
-init_db.sql: $(top_srcdir)/scripts/mysql_system_tables.sql \
- $(top_srcdir)/scripts/mysql_system_tables_data.sql
- @echo "Building $@";
- @echo "CREATE DATABASE mysql;" > $@;
- @echo "CREATE DATABASE test;" >> $@;
- @echo "use mysql;" >> $@;
- @cat $(top_srcdir)/scripts/mysql_system_tables.sql >> $@;
-
-# Build test_db.sql from init_db.sql plus
-# some test data
-test_db.sql: init_db.sql $(top_srcdir)/scripts/mysql_test_data_timezone.sql
- @echo "Building $@";
- @cat init_db.sql \
- $(top_srcdir)/scripts/mysql_test_data_timezone.sql > $@;
diff --git a/netware/comp_err.def b/netware/comp_err.def
deleted file mode 100644
index f5b18bbdb9a..00000000000
--- a/netware/comp_err.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Error File Compiler
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Error File Compiler"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/install_test_db.ncf b/netware/install_test_db.ncf
deleted file mode 100644
index 06befc5d9bd..00000000000
--- a/netware/install_test_db.ncf
+++ /dev/null
@@ -1 +0,0 @@
-# This functionality is handled by mysql-test-run.nlm on NetWare
diff --git a/netware/libmysql.def b/netware/libmysql.def
deleted file mode 100644
index d9d4c752612..00000000000
--- a/netware/libmysql.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Client
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-EXPORT @libmysql.imp
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Client Library"
-VERSION 4, 0
-AUTOUNLOAD
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
diff --git a/netware/libmysqlmain.c b/netware/libmysqlmain.c
deleted file mode 100644
index 2b6ea9b7e27..00000000000
--- a/netware/libmysqlmain.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- Copyright (c) 2002 Novell, Inc. 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; either version 2 of the License, or
- (at your option) any later version.
-
- 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"
-
-void init_available_charsets(void);
-
-/* this function is required so that global memory is allocated against this
-library nlm, and not against a paticular client */
-int _NonAppStart(void *NLMHandle, void *errorScreen, const char *commandLine,
- const char *loadDirPath, size_t uninitializedDataLength,
- void *NLMFileHandle, int (*readRoutineP)( int conn, void *fileHandle,
- size_t offset, size_t nbytes, size_t *bytesRead, void *buffer ),
- size_t customDataOffset, size_t customDataSize, int messageCount,
- const char **messages)
-{
- mysql_server_init(0, NULL, NULL);
-
- init_available_charsets();
-
- return 0;
-}
-
diff --git a/netware/my_manage.c b/netware/my_manage.c
deleted file mode 100644
index 5f59e46374f..00000000000
--- a/netware/my_manage.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- Copyright (c) 2003 Novell, Inc. 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; either version 2 of the License, or
- (at your option) any later version.
-
- 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 <stdio.h>
-#include <errno.h>
-#include <dirent.h>
-#include <string.h>
-#include <screen.h>
-#include <proc.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <assert.h>
-
-#include "my_manage.h"
-
-/******************************************************************************
-
- macros
-
-******************************************************************************/
-
-/******************************************************************************
-
- global variables
-
-******************************************************************************/
-
-/******************************************************************************
-
- functions
-
-******************************************************************************/
-
-/******************************************************************************
-
- init_args()
-
- Init an argument list.
-
-******************************************************************************/
-void init_args(arg_list_t *al)
-{
- ASSERT(al != NULL);
-
- al->argc = 0;
- al->size = ARG_BUF;
- al->argv = malloc(al->size * sizeof(char *));
- ASSERT(al->argv != NULL);
-
- return;
-}
-
-/******************************************************************************
-
- add_arg()
-
- Add an argument to a list.
-
-******************************************************************************/
-void add_arg(arg_list_t *al, const char *format, ...)
-{
- va_list ap;
- char temp[PATH_MAX];
-
- ASSERT(al != NULL);
-
- // increase size
- if (al->argc >= al->size)
- {
- al->size += ARG_BUF;
- al->argv = realloc(al->argv, al->size * sizeof(char *));
- ASSERT(al->argv != NULL);
- }
-
- if (format)
- {
- va_start(ap, format);
- vsprintf(temp, format, ap);
- va_end(ap);
-
- al->argv[al->argc] = malloc(strlen(temp)+1);
- ASSERT(al->argv[al->argc] != NULL);
- strcpy(al->argv[al->argc], temp);
-
- ++(al->argc);
- }
- else
- {
- al->argv[al->argc] = NULL;
- }
-
- return;
-}
-
-/******************************************************************************
-
- free_args()
-
- Free an argument list.
-
-******************************************************************************/
-void free_args(arg_list_t *al)
-{
- int i;
-
- ASSERT(al != NULL);
-
- for(i = 0; i < al->argc; i++)
- {
- ASSERT(al->argv[i] != NULL);
- free(al->argv[i]);
- al->argv[i] = NULL;
- }
-
- free(al->argv);
- al->argc = 0;
- al->argv = NULL;
-
- return;
-}
-
-/******************************************************************************
-
- sleep_until_file_deleted()
-
- Sleep until the given file is no longer found.
-
-******************************************************************************/
-int sleep_until_file_deleted(char *pid_file)
-{
- struct stat buf;
- int i, err;
-
- for(i = 0; (i < TRY_MAX) && (err = !stat(pid_file, &buf)); i++) sleep(1);
-
- if (err != 0) err = errno;
-
- return err;
-}
-
-/******************************************************************************
-
- sleep_until_file_exists()
-
- Sleep until the given file exists.
-
-******************************************************************************/
-int sleep_until_file_exists(char *pid_file)
-{
- struct stat buf;
- int i, err;
-
- for(i = 0; (i < TRY_MAX) && (err = stat(pid_file, &buf)); i++) sleep(1);
-
- if (err != 0) err = errno;
-
- return err;
-}
-
-/******************************************************************************
-
- wait_for_server_start()
-
- Wait for the server on the given port to start.
-
-******************************************************************************/
-int wait_for_server_start(char *bin_dir, char *user, char *password, int port,char *tmp_dir)
-{
- arg_list_t al;
- int err, i;
- char mysqladmin_file[PATH_MAX];
- char trash[PATH_MAX];
-
- // mysqladmin file
- snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
- snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir);
-
- // args
- init_args(&al);
- add_arg(&al, "%s", mysqladmin_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--port=%u", port);
- add_arg(&al, "--user=%s", user);
- add_arg(&al, "--password=%s", password);
- add_arg(&al, "--silent");
-
-#ifdef NOT_USED
- add_arg(&al, "--connect_timeout=10");
- add_arg(&al, "-w");
-#endif
-
- add_arg(&al, "--host=localhost");
- add_arg(&al, "ping");
-
- // NetWare does not support the connect timeout in the TCP/IP stack
- // -- we will try the ping multiple times
- for(i = 0; (i < TRY_MAX)
- && (err = spawn(mysqladmin_file, &al, TRUE, NULL,
- trash, NULL)); i++) sleep(1);
-
- // free args
- free_args(&al);
-
- return err;
-}
-
-/******************************************************************************
-
- spawn()
-
- Spawn the given path with the given arguments.
-
-******************************************************************************/
-int spawn(char *path, arg_list_t *al, int join, char *input,
- char *output, char *error)
-{
- pid_t pid;
- int result = 0;
- wiring_t wiring = { FD_UNUSED, FD_UNUSED, FD_UNUSED };
- unsigned long flags = PROC_CURRENT_SPACE | PROC_INHERIT_CWD;
-
- // open wiring
- if (input)
- wiring.infd = open(input, O_RDONLY);
-
- if (output)
- wiring.outfd = open(output, O_WRONLY | O_CREAT | O_TRUNC);
-
- if (error)
- wiring.errfd = open(error, O_WRONLY | O_CREAT | O_TRUNC);
-
- // procve requires a NULL
- add_arg(al, NULL);
-
- // go
- pid = procve(path, flags, NULL, &wiring, NULL, NULL, 0,
- NULL, (const char **)al->argv);
-
- if (pid == -1)
- {
- result = -1;
- }
- else if (join)
- {
- waitpid(pid, &result, 0);
- }
-
- // close wiring
- if (wiring.infd != -1)
- close(wiring.infd);
-
- if (wiring.outfd != -1)
- close(wiring.outfd);
-
- if (wiring.errfd != -1)
- close(wiring.errfd);
-
- return result;
-}
-
-/******************************************************************************
-
- stop_server()
-
- Stop the server with the given port and pid file.
-
-******************************************************************************/
-int stop_server(char *bin_dir, char *user, char *password, int port,
- char *pid_file,char *tmp_dir)
-{
- arg_list_t al;
- int err, i, argc = 0;
- char mysqladmin_file[PATH_MAX];
- char trash[PATH_MAX];
-
- // mysqladmin file
- snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
- snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir);
-
- // args
- init_args(&al);
- add_arg(&al, "%s", mysqladmin_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--port=%u", port);
- add_arg(&al, "--user=%s", user);
- add_arg(&al, "--password=%s", password);
- add_arg(&al, "--shutdown_timeout=20");
- add_arg(&al, "shutdown");
-
- // spawn
- if ((err = spawn(mysqladmin_file, &al, TRUE, NULL,
- trash, NULL)) == 0)
- {
- sleep_until_file_deleted(pid_file);
- }
- else
- {
- pid_t pid = get_server_pid(pid_file);
-
- // shutdown failed - kill server
- kill_server(pid);
-
- sleep(TRY_MAX);
-
- // remove pid file if possible
- err = remove(pid_file);
- }
-
- // free args
- free_args(&al);
-
- return err;
-}
-
-/******************************************************************************
-
- get_server_pid()
-
- Get the VM id with the given pid file.
-
-******************************************************************************/
-pid_t get_server_pid(char *pid_file)
-{
- char buf[PATH_MAX];
- int fd, err;
- char *p;
- pid_t id;
-
- // discover id
- fd = open(pid_file, O_RDONLY);
-
- err = read(fd, buf, PATH_MAX);
-
- close(fd);
-
- if (err > 0)
- {
- // terminate string
- if ((p = strchr(buf, '\n')) != NULL)
- {
- *p = NULL;
-
- // check for a '\r'
- if ((p = strchr(buf, '\r')) != NULL)
- {
- *p = NULL;
- }
- }
- else
- {
- buf[err] = NULL;
- }
-
- id = strtol(buf, NULL, 0);
- }
-
- return id;
-}
-
-/******************************************************************************
-
- kill_server()
-
- Force a kill of the server with the given pid.
-
-******************************************************************************/
-void kill_server(pid_t pid)
-{
- if (pid > 0)
- {
- // destroy vm
- NXVmDestroy(pid);
- }
-}
-
-/******************************************************************************
-
- del_tree()
-
- Delete the directory and subdirectories.
-
-******************************************************************************/
-void del_tree(char *dir)
-{
- DIR *parent = opendir(dir);
- DIR *entry;
- char temp[PATH_MAX];
-
- if (parent == NULL)
- {
- return;
- }
-
- while((entry = readdir(parent)) != NULL)
- {
- // create long name
- snprintf(temp, PATH_MAX, "%s/%s", dir, entry->d_name);
-
- if (entry->d_name[0] == '.')
- {
- // Skip
- }
- else if (S_ISDIR(entry->d_type))
- {
- // delete subdirectory
- del_tree(temp);
- }
- else
- {
- // remove file
- remove(temp);
- }
- }
-
- // remove directory
- rmdir(dir);
-}
-
-/******************************************************************************
-
- removef()
-
-******************************************************************************/
-int removef(const char *format, ...)
-{
- va_list ap;
- char path[PATH_MAX];
-
- va_start(ap, format);
-
- vsnprintf(path, PATH_MAX, format, ap);
-
- va_end(ap);
-
- return remove(path);
-}
-
-/******************************************************************************
-
- get_basedir()
-
-******************************************************************************/
-void get_basedir(char *argv0, char *basedir)
-{
- char temp[PATH_MAX];
- char *p;
-
- ASSERT(argv0 != NULL);
- ASSERT(basedir != NULL);
-
- strcpy(temp, strlwr(argv0));
- while((p = strchr(temp, '\\')) != NULL) *p = '/';
-
- if ((p = strindex(temp, "/bin/")) != NULL)
- {
- *p = NULL;
- strcpy(basedir, temp);
- }
-}
diff --git a/netware/my_manage.h b/netware/my_manage.h
deleted file mode 100644
index 360f2f104be..00000000000
--- a/netware/my_manage.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- Copyright (c) 2002 Novell, Inc. 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; either version 2 of the License, or
- (at your option) any later version.
-
- 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 _MY_MANAGE
-#define _MY_MANAGE
-
-/******************************************************************************
-
- includes
-
-******************************************************************************/
-
-#include <stdlib.h>
-#ifndef __WIN__
-#include <unistd.h>
-#endif
-
-/******************************************************************************
-
- macros
-
-******************************************************************************/
-#ifdef __WIN__
-#define PATH_MAX _MAX_PATH
-#define NAME_MAX _MAX_FNAME
-#define kill(A,B) TerminateProcess((HANDLE)A,0)
-#define NOT_NEED_PID 0
-#define MASTER_PID 1
-#define SLAVE_PID 2
-#define mysqld_timeout 60000
-
-intptr_t master_server;
-intptr_t slave_server;
-int pid_mode;
-bool run_server;
-char win_args[1024];
-bool skip_first_param;
-#endif
-
-
-#define ARG_BUF 10
-#define TRY_MAX 5
-#define NULL (char) 0
-
-#ifdef __NETWARE__
-#define strstr(A,B) strindex(A,B)
-#endif
-
-
-/******************************************************************************
-
- structures
-
-******************************************************************************/
-
-typedef struct
-{
-
- int argc;
- char **argv;
-
- size_t size;
-
-} arg_list_t;
-
-
-typedef int pid_t;
-/******************************************************************************
-
- global variables
-
-******************************************************************************/
-
-/******************************************************************************
-
- prototypes
-
-******************************************************************************/
-
-void init_args(arg_list_t *);
-void add_arg(arg_list_t *, const char *, ...);
-void free_args(arg_list_t *);
-
-int sleep_until_file_exists(char *);
-int sleep_until_file_deleted(char *);
-int wait_for_server_start(char *, char *, char *, int,char *);
-
-int spawn(char *, arg_list_t *, int, char *, char *, char *);
-
-int stop_server(char *, char *, char *, int, char *,char *);
-pid_t get_server_pid(char *);
-void kill_server(pid_t pid);
-
-void del_tree(char *);
-int removef(const char *, ...);
-
-void get_basedir(char *, char *);
-
-char mysqladmin_file[PATH_MAX];
-
-#endif /* _MY_MANAGE */
-
-
diff --git a/netware/my_print_defaults.def b/netware/my_print_defaults.def
deleted file mode 100644
index acba6c81b49..00000000000
--- a/netware/my_print_defaults.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# My Print Defaults
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Print Defaults Tool"
-VERSION 5, 0, 17
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/myisam_ftdump.def b/netware/myisam_ftdump.def
deleted file mode 100644
index f2b4890a54d..00000000000
--- a/netware/myisam_ftdump.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL MyISAM Dump Tool
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL MyISAM Table Dump Tool"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL MyISAM Table Dump Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/myisamchk.def b/netware/myisamchk.def
deleted file mode 100644
index 71fb66d0ed1..00000000000
--- a/netware/myisamchk.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MyISAM Check
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL MyISAM Table Check Tool[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL MyISAM Table Check Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/myisamlog.def b/netware/myisamlog.def
deleted file mode 100644
index 1924ba2192b..00000000000
--- a/netware/myisamlog.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MyISAM Log
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL MyISAM Table Log Tool"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL MyISAM Table Log Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/myisampack.def b/netware/myisampack.def
deleted file mode 100644
index 39fd1b34100..00000000000
--- a/netware/myisampack.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MyISAM Pack
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL MyISAM Table Pack Tool"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL MyISAM Table Pack Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysql.def b/netware/mysql.def
deleted file mode 100644
index 4e44f4882d1..00000000000
--- a/netware/mysql.def
+++ /dev/null
@@ -1,13 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Client
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Monitor[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Monitor"
-VERSION 4, 0
-STACKSIZE 131072
-MULTIPLE
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysql.xdc b/netware/mysql.xdc
deleted file mode 100644
index a6c430f7314..00000000000
--- a/netware/mysql.xdc
+++ /dev/null
Binary files differ
diff --git a/netware/mysql_client_test.def b/netware/mysql_client_test.def
deleted file mode 100644
index 9a6f63ec4d7..00000000000
--- a/netware/mysql_client_test.def
+++ /dev/null
@@ -1,10 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Test
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Client Test"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
diff --git a/netware/mysql_fix_privilege_tables.pl b/netware/mysql_fix_privilege_tables.pl
deleted file mode 100644
index e40b4158e1c..00000000000
--- a/netware/mysql_fix_privilege_tables.pl
+++ /dev/null
@@ -1,227 +0,0 @@
-#-----------------------------------------------------------------------------
-# Copyright (C) 2002 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#-----------------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# This notice applies to changes, created by or for Novell, Inc.,
-# to preexisting works for which notices appear elsewhere in this file.
-
-# Copyright (c) 2003 Novell, Inc. 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; either version 2 of the License, or
-# (at your option) any later version.
-
-# 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
-#-----------------------------------------------------------------------------
-
-#use strict;
-use Mysql;
-
-print "MySQL Fix Privilege Tables Script\n\n";
-
-print "NOTE: This script updates your privilege tables to the lastest\n";
-print " specifications!\n\n";
-
-#-----------------------------------------------------------------------------
-# get the current root password
-#-----------------------------------------------------------------------------
-
-print "In order to log into MySQL to update it, we'll need the current\n";
-print "password for the root user. If you've just installed MySQL, and\n";
-print "you haven't set the root password yet, the password will be blank,\n";
-print "so you should just press enter here.\n\n";
-
-print "Enter the current password for root: ";
-my $password = <STDIN>;
-chomp $password;
-print "\n";
-
-my $conn = Mysql->connect("localhost", "mysql", "root", $password)
- || die "Unable to connect to MySQL.";
-
-print "OK, successfully used the password, moving on...\n\n";
-
-
-#-----------------------------------------------------------------------------
-# MySQL 4.0.2
-#-----------------------------------------------------------------------------
-
-#-- Detect whether or not we had the Grant_priv column
-print "Fixing privileges for old tables...\n";
-$conn->query("SET \@hadGrantPriv:=0;");
-$conn->query("SELECT \@hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';");
-
-#--- Fix privileges for old tables
-$conn->query("UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;");
-$conn->query("UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;");
-$conn->query("UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;");
-
-
-# Detect whether we had Show_db_priv
-$conn->query("SET \@hadShowDbPriv:=0;");
-$conn->query("SELECT \@hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';");
-
-print "Adding new fields used by MySQL 4.0.2 to the privilege tables...\n";
-print "NOTE: You can ignore any Duplicate column errors.\n";
-$conn->query(" \
-ALTER TABLE user \
-ADD Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER alter_priv, \
-ADD Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv, \
-ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv, \
-ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv, \
-ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv, \
-ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv, \
-ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; \
-") && $conn->query(" \
-UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''AND \@hadShowDbPriv = 0; \
-");
-
-#-- The above statement converts privileges so that users have similar privileges as before
-
-#-----------------------------------------------------------------------------
-# MySQL 4.0 Limitations
-#-----------------------------------------------------------------------------
-
-print "Adding new fields used by MySQL 4.0 security limitations...\n";
-
-$conn->query(" \
-ALTER TABLE user \
-ADD max_questions int(11) NOT NULL AFTER x509_subject, \
-ADD max_updates int(11) unsigned NOT NULL AFTER max_questions, \
-ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; \
-");
-
-#-- Change the password column to suite the new password hashing used
-#-- in 4.1.1 onward
-$conn->query("ALTER TABLE user change Password Password char(41) binary not null;");
-
-#-- The second alter changes ssl_type to new 4.0.2 format
-#-- Adding columns needed by GRANT .. REQUIRE (openssl)"
-print "Adding new fields to use in ssl authentication...\n";
-
-$conn->query(" \
-ALTER TABLE user \
-ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL, \
-ADD ssl_cipher BLOB NOT NULL, \
-ADD x509_issuer BLOB NOT NULL, \
-ADD x509_subject BLOB NOT NULL; \
-");
-
-#-----------------------------------------------------------------------------
-# MySQL 4.0 DB and Host privs
-#-----------------------------------------------------------------------------
-
-print "Adding new fields used by MySQL 4.0 locking and temporary table security...\n";
-
-$conn->query(" \
-ALTER TABLE db \
-ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \
-ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \
-");
-
-$conn->query(" \
-ALTER TABLE host \
-ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \
-ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \
-");
-
-#
-# Change the Table_name column to be of char(64) which was char(60) by mistake till now.
-#
-$conn->query("alter table tables_priv change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;");
-
-
-#
-# Create some possible missing tables
-#
-print "Adding online help tables...\n";
-
-$conn->query(" \
-CREATE TABLE IF NOT EXISTS help_topic ( \
-help_topic_id int unsigned not null, \
-name varchar(64) not null, \
-help_category_id smallint unsigned not null, \
-description text not null, \
-example text not null, \
-url varchar(128) not null, \
-primary key (help_topic_id), unique index (name) \
-) comment='help topics'; \
-");
-
-$conn->query(" \
-CREATE TABLE IF NOT EXISTS help_category ( \
-help_category_id smallint unsigned not null, \
-name varchar(64) not null, \
-parent_category_id smallint unsigned null, \
-url varchar(128) not null, \
-primary key (help_category_id), \
-unique index (name) \
-) comment='help categories'; \
-");
-
-$conn->query(" \
-CREATE TABLE IF NOT EXISTS help_relation ( \
-help_topic_id int unsigned not null references help_topic, \
-help_keyword_id int unsigned not null references help_keyword, \
-primary key (help_keyword_id, help_topic_id) \
-) comment='keyword-topic relation'; \
-");
-
-$conn->query(" \
-CREATE TABLE IF NOT EXISTS help_keyword ( \
-help_keyword_id int unsigned not null, \
-name varchar(64) not null, \
-primary key (help_keyword_id), \
-unique index (name) \
-) comment='help keywords'; \
-");
-
-
-#
-# Filling the help tables with contents.
-#
-print "Filling online help tables with contents...\n";
-# Generate the path for "fill_help_tables.sql" file which is in different folder.
-$fill_help_table=$0;
-$fill_help_table =~ s/scripts[\\\/]mysql_fix_privilege_tables.pl/share\\fill_help_tables.sql/;
-
-#read all content from the sql file which contains recordsfor help tables.
-open(fileIN,$fill_help_table) or die("Cannot open $fill_help_table: $!");
-@logData = <fileIN>;
-close(fileIN);
-foreach $line (@logData) {
-# if the line is not empty, insert a record in the table.
- if( ! ($line =~ /^\s*$/) ) {
- $conn->query("$line");
- }
-}
-
-#-----------------------------------------------------------------------------
-# done
-#-----------------------------------------------------------------------------
-
-print "\n\nAll done!\n\n";
-
-print "Thanks for using MySQL!\n\n";
diff --git a/netware/mysql_install_db.c b/netware/mysql_install_db.c
deleted file mode 100644
index 98852c89825..00000000000
--- a/netware/mysql_install_db.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- Copyright (c) 2002 Novell, Inc. 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; either version 2 of the License, or
- (at your option) any later version.
-
- 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 <stdlib.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <sys/stat.h>
-#include <monitor.h>
-#include <strings.h>
-#include <getopt.h>
-#include <screen.h>
-#include <errno.h>
-
-#include "my_config.h"
-#include "my_manage.h"
-
-/******************************************************************************
-
- global variables
-
-******************************************************************************/
-char autoclose;
-char basedir[PATH_MAX];
-char datadir[PATH_MAX];
-char err_log[PATH_MAX];
-char out_log[PATH_MAX];
-char mysqld[PATH_MAX];
-char hostname[PATH_MAX];
-char sql_file[PATH_MAX];
-char default_option[PATH_MAX];
-
-/******************************************************************************
-
- prototypes
-
-******************************************************************************/
-
-void start_defaults(int, char*[]);
-void finish_defaults();
-void read_defaults(arg_list_t *);
-void parse_args(int, char*[]);
-void get_options(int, char*[]);
-void create_paths();
-int mysql_install_db(int argc, char *argv[]);
-
-/******************************************************************************
-
- functions
-
-******************************************************************************/
-
-/******************************************************************************
-
- start_defaults()
-
- Start setting the defaults.
-
-******************************************************************************/
-void start_defaults(int argc, char *argv[])
-{
- struct stat buf;
- int i;
-
- // default options
- static char *default_options[] =
- {
- "--no-defaults",
- "--defaults-file=",
- "--defaults-extra-file=",
- NULL
- };
-
- // autoclose
- autoclose = FALSE;
-
- // basedir
- get_basedir(argv[0], basedir);
-
- // hostname
- if (gethostname(hostname,PATH_MAX) < 0)
- {
- // default
- strcpy(hostname,"mysql");
- }
-
- // default option
- default_option[0] = NULL;
- for (i=0; (argc > 1) && default_options[i]; i++)
- {
- if(!strnicmp(argv[1], default_options[i], strlen(default_options[i])))
- {
- strncpy(default_option, argv[1], PATH_MAX);
- break;
- }
- }
-
- // set after basedir is established
- datadir[0] = NULL;
- err_log[0] = NULL;
- out_log[0] = NULL;
- mysqld[0] = NULL;
- sql_file[0] = NULL;
-}
-
-/******************************************************************************
-
- finish_defaults()
-
- Finish setting the defaults.
-
-******************************************************************************/
-void finish_defaults()
-{
- struct stat buf;
- int i;
-
- // datadir
- if (!datadir[0]) snprintf(datadir, PATH_MAX, "%s/data", basedir);
-
- // err-log
- if (!err_log[0]) snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname);
-
- // out-log
- if (!out_log[0]) snprintf(out_log, PATH_MAX, "%s/%s.out", datadir, hostname);
-
- // sql-file
- if (!sql_file[0]) snprintf(sql_file, PATH_MAX, "%s/bin/init_db.sql", basedir);
-
- // mysqld
- if (!mysqld[0]) snprintf(mysqld, PATH_MAX, "%s/bin/mysqld", basedir);
-}
-
-/******************************************************************************
-
- read_defaults()
-
- Read the defaults.
-
-******************************************************************************/
-void read_defaults(arg_list_t *pal)
-{
- arg_list_t al;
- char defaults_file[PATH_MAX];
- char mydefaults[PATH_MAX];
- char line[PATH_MAX];
- FILE *fp;
-
- // defaults output file
- snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir);
- remove(defaults_file);
-
- // mysqladmin file
- snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir);
-
- // args
- init_args(&al);
- add_arg(&al, mydefaults);
- if (default_option[0]) add_arg(&al, default_option);
- add_arg(&al, "mysqld");
- add_arg(&al, "mysql_install_db");
-
- spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL);
-
- free_args(&al);
-
- // gather defaults
- if((fp = fopen(defaults_file, "r")) != NULL)
- {
- while(fgets(line, PATH_MAX, fp))
- {
- char *p;
-
- // remove end-of-line character
- if ((p = strrchr(line, '\n')) != NULL) *p = '\0';
-
- // add the option as an argument
- add_arg(pal, line);
- }
-
- fclose(fp);
- }
-
- // remove file
- remove(defaults_file);
-}
-
-/******************************************************************************
-
- parse_args()
-
- Get the options.
-
-******************************************************************************/
-void parse_args(int argc, char *argv[])
-{
- int index = 0;
- int c;
-
- // parse options
- enum opts
- {
- OPT_BASEDIR = 0xFF,
- OPT_DATADIR,
- OPT_SQL_FILE
- };
-
- static struct option options[] =
- {
- {"autoclose", no_argument, &autoclose, TRUE},
- {"basedir", required_argument, 0, OPT_BASEDIR},
- {"datadir", required_argument, 0, OPT_DATADIR},
- {"sql-file", required_argument, 0, OPT_SQL_FILE},
- {0, 0, 0, 0}
- };
-
- // we have to reset getopt_long because we use it multiple times
- optind = 1;
-
- // turn off error reporting
- opterr = 0;
-
- while ((c = getopt_long(argc, argv, "b:h:", options, &index)) >= 0)
- {
- switch (c)
- {
- case OPT_BASEDIR:
- case 'b':
- strcpy(basedir, optarg);
- break;
-
- case OPT_DATADIR:
- case 'h':
- strcpy(datadir, optarg);
- break;
-
- case OPT_SQL_FILE:
- strcpy(sql_file, optarg);
- break;
-
- default:
- // ignore
- break;
- }
- }
-}
-
-/******************************************************************************
-
- get_options()
-
- Get the options.
-
-******************************************************************************/
-void get_options(int argc, char *argv[])
-{
- arg_list_t al;
-
- // start defaults
- start_defaults(argc, argv);
-
- // default file arguments
- init_args(&al);
- add_arg(&al, "ignore");
- read_defaults(&al);
- parse_args(al.argc, al.argv);
- free_args(&al);
-
- // command-line arguments
- parse_args(argc, argv);
-
- // finish defaults
- finish_defaults();
-}
-
-/******************************************************************************
-
- create_paths()
-
- Create database paths.
-
-******************************************************************************/
-void create_paths()
-{
- struct stat info;
- char temp[PATH_MAX];
-
- // check for tables
- snprintf(temp, PATH_MAX, "%s/mysql/host.frm", datadir);
- if (!stat(temp, &info))
- {
- printf("A database already exists in the directory:\n");
- printf("\t%s\n\n", datadir);
- exit(-1);
- }
-
- // data directory
- if (stat(datadir, &info))
- {
- mkdir(datadir, 0);
- }
-}
-
-/******************************************************************************
-
- mysql_install_db()
-
- Install the database.
-
-******************************************************************************/
-int mysql_install_db(int argc, char *argv[])
-{
- arg_list_t al;
- int i, j, err;
- char skip;
- struct stat info;
-
- // private options
- static char *private_options[] =
- {
- "--autoclose",
- "--sql-file=",
- NULL
- };
-
- // args
- init_args(&al);
- add_arg(&al, "%s", mysqld);
-
- // parent args
- for(i = 1; i < argc; i++)
- {
- skip = FALSE;
-
- // skip private arguments
- for (j=0; private_options[j]; j++)
- {
- if(!strnicmp(argv[i], private_options[j], strlen(private_options[j])))
- {
- skip = TRUE;
- break;
- }
- }
-
- if (!skip) add_arg(&al, "%s", argv[i]);
- }
-
- add_arg(&al, "--bootstrap");
- add_arg(&al, "--skip-grant-tables");
- add_arg(&al, "--skip-innodb");
-
- if ((err = stat(sql_file, &info)) != 0)
- {
- printf("ERROR - %s:\n", strerror(errno));
- printf("\t%s\n\n", sql_file);
- // free args
- free_args(&al);
- exit(-1);
- }
-
- if ((err = stat(sql_file, &info)) != 0)
- {
- printf("ERROR - %s:\n", strerror(errno));
- printf("\t%s\n\n", sql_file);
- // free args
- free_args(&al);
- exit(-1);
- }
-
- // spawn mysqld
- err = spawn(mysqld, &al, TRUE, sql_file, out_log, err_log);
-
- // free args
- free_args(&al);
-
- return err;
-}
-
-/******************************************************************************
-
- main()
-
-******************************************************************************/
-int main(int argc, char **argv)
-{
- // get options
- get_options(argc, argv);
-
- // check for an autoclose option
- if (!autoclose) setscreenmode(SCR_NO_MODE);
-
- // header
- printf("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE,
- MACHINE_TYPE);
-
- // create paths
- create_paths();
-
- // install the database
- if (mysql_install_db(argc, argv))
- {
- printf("ERROR - Failed to create the database!\n");
- printf(" %s\n", strerror(errno));
- printf("See the following log for more information:\n");
- printf("\t%s\n\n", err_log);
- exit(-1);
- }
-
- // status
- printf("Initial database successfully created in the directory:\n");
- printf("\t%s\n", datadir);
-
- // info
- printf("\nPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !\n");
-
- printf("\nThis is done with:\n");
- printf("\tmysqladmin -u root password 'new-password'\n");
-
- printf("\nSee the manual for more instructions.\n");
-
- printf("\nYou can start the MySQL daemon with:\n");
- printf("\tmysqld_safe\n");
-
- printf("\nPlease report any problems with:\n");
- printf("\t/mysql/mysqlbug.txt\n");
-
- printf("\nThe latest information about MySQL is available on the web at\n");
- printf("\thttp://www.mysql.com\n");
-
- printf("\nSupport MySQL by buying support at http://shop.mysql.com\n\n");
-
- return 0;
-}
diff --git a/netware/mysql_install_db.def b/netware/mysql_install_db.def
deleted file mode 100644
index e3dc57fe44c..00000000000
--- a/netware/mysql_install_db.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Install DB
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Install"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Initial Database Installer"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysql_secure_installation.pl b/netware/mysql_secure_installation.pl
deleted file mode 100644
index 8550f0e6d6e..00000000000
--- a/netware/mysql_secure_installation.pl
+++ /dev/null
@@ -1,218 +0,0 @@
-#-----------------------------------------------------------------------------
-# Copyright (C) 2002 MySQL AB and Jeremy Cole
-#
-# 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
-#-----------------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# This notice applies to changes, created by or for Novell, Inc.,
-# to preexisting works for which notices appear elsewhere in this file.
-
-# Copyright (c) 2003 Novell, Inc. 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; either version 2 of the License, or
-# (at your option) any later version.
-
-# 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
-#-----------------------------------------------------------------------------
-
-use strict;
-use Mysql;
-
-print "MySQL Secure Installation Script\n\n";
-
-print "NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL\n";
-print " SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!\n\n";
-
-#-----------------------------------------------------------------------------
-# get the current root password
-#-----------------------------------------------------------------------------
-
-print "In order to log into MySQL to secure it, we'll need the current\n";
-print "password for the root user. If you've just installed MySQL, and\n";
-print "you haven't set the root password yet, the password will be blank,\n";
-print "so you should just press enter here.\n\n";
-
-print "Enter the current password for root: ";
-my $password = <STDIN>;
-chomp $password;
-print "\n";
-
-my $conn = Mysql->connect("localhost", "mysql", "root", $password)
- || die "Unable to connect to MySQL.";
-
-print "OK, successfully used the password, moving on...\n\n";
-
-#-----------------------------------------------------------------------------
-# set the root password
-#-----------------------------------------------------------------------------
-
-unless ($password)
-{
- print "Setting the root password ensures that no one can log into MySQL\n";
- print "using the root user without the proper authorization.\n\n";
-
- print "Set root password (Y/N)? ";
- my $reply = <STDIN>;
- chomp $reply;
- print "\n";
-
- if ($reply =~ /Y/i)
- {
- print "New password for root: ";
- my $pass1 = <STDIN>;
- chomp $pass1;
- print "\n";
-
- print "Re-enter new password for root: ";
- my $pass2 = <STDIN>;
- chomp $pass2;
- print "\n";
-
- unless ($pass1 eq $pass2) { die "Sorry, the passwords do not match."; }
-
- unless ($pass1) { die "Sorry, you can't use an empty password here."; }
-
- $conn->query("SET PASSWORD FOR root\@localhost=PASSWORD('$pass1')")
- || die "Unable to set password.";
-
- print "OK, successfully set the password, moving on...\n\n";
- }
- else
- {
- print "WARNING, the password is not set, moving on...\n\n";
- }
-}
-
-#-----------------------------------------------------------------------------
-# remove anonymous users
-#-----------------------------------------------------------------------------
-
-print "By default, a MySQL installation has anonymous users, allowing anyone\n";
-print "to log into MySQL without having to have a user account created for\n";
-print "them. This is intended only for testing, and to make the installation\n";
-print "go a bit smoother. You should remove them before moving into a\n";
-print "production environment.\n\n";
-
-print "Remove anonymous users (Y/N)? ";
-my $reply = <STDIN>;
-chomp $reply;
-print "\n";
-
-if ($reply =~ /Y/i)
-{
- $conn->query("DELETE FROM mysql.user WHERE user=''")
- || die "Unable to remove anonymous users.";
-
- print "OK, successfully removed anonymous users, moving on...\n\n";
-}
-else
-{
- print "WARNING, the anonymous users have not been removed, moving on...\n\n";
-}
-
-#-----------------------------------------------------------------------------
-# disallow remote root login
-#-----------------------------------------------------------------------------
-
-print "Normally, root should only be allowed to connect from 'localhost'. This\n";
-print "ensures that someone cannot guess at the root password from the network.\n\n";
-
-print "Disallow remote root login (Y/N)? ";
-my $reply = <STDIN>;
-chomp $reply;
-print "\n";
-
-if ($reply =~ /Y/i)
-{
- $conn->query("DELETE FROM mysql.user WHERE user='root' AND host!='localhost'")
- || die "Unable to disallow remote root login.";
-
- print "OK, successfully disallowed remote root login, moving on...\n\n";
-}
-else
-{
- print "WARNING, remote root login has not been disallowed, moving on...\n\n";
-}
-
-#-----------------------------------------------------------------------------
-# remove test database
-#-----------------------------------------------------------------------------
-
-print "By default, MySQL comes with a database named 'test' that anyone can\n";
-print "access. This is intended only for testing, and should be removed\n";
-print "before moving into a production environment.\n\n";
-
-print "Remove the test database (Y/N)? ";
-my $reply = <STDIN>;
-chomp $reply;
-print "\n";
-
-if ($reply =~ /Y/i)
-{
- $conn->query("DROP DATABASE IF EXISTS test")
- || die "Unable to remove test database.";
-
- $conn->query("DELETE FROM mysql.db WHERE db='test' OR db='test\\_%'")
- || die "Unable to remove access to the test database.";
-
- print "OK, successfully removed the test database, moving on...\n\n";
-}
-else
-{
- print "WARNING, the test database has not been removed, moving on...\n\n";
-}
-
-#-----------------------------------------------------------------------------
-# reload privilege tables
-#-----------------------------------------------------------------------------
-
-print "Reloading the privilege tables will ensure that all changes made so far\n";
-print "will take effect immediately.\n\n";
-
-print "Reload privilege tables (Y/N)? ";
-my $reply = <STDIN>;
-chomp $reply;
-print "\n";
-
-if ($reply =~ /Y/i)
-{
- $conn->query("FLUSH PRIVILEGES")
- || die "Unable to reload privilege tables.";
-
- print "OK, successfully reloaded privilege tables, moving on...\n\n";
-}
-else
-{
- print "WARNING, the privilege tables have not been reloaded, moving on...\n\n";
-}
-
-#-----------------------------------------------------------------------------
-# done
-#-----------------------------------------------------------------------------
-
-print "\n\nAll done! If you've completed all of the above steps, your MySQL\n";
-print "installation should now be secure.\n\n";
-
-print "Thanks for using MySQL!\n\n";
-
diff --git a/netware/mysql_test_run.c b/netware/mysql_test_run.c
deleted file mode 100644
index 5fa92b325b6..00000000000
--- a/netware/mysql_test_run.c
+++ /dev/null
@@ -1,1415 +0,0 @@
-/*
- Copyright (c) 2002, 2003 Novell, Inc. 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; either version 2 of the License, or
- (at your option) any later version.
-
- 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 <m_string.h>
-#include <dirent.h>
-#include <screen.h>
-#include <nks/vm.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <sys/mode.h>
-#include "my_manage.h"
-#include "mysql_version.h"
-#ifdef __NETWARE__
-#define strindex(a,b) ((char*)strindex(a,b))
-#define strstr(a,b) ((char*)strstr(a,b))
-#endif
-
-/******************************************************************************
-
- macros
-
-******************************************************************************/
-
-#define HEADER "TEST ELAPSED RESULT \n"
-#define DASH "------------------------------------------------------------------------\n"
-
-#define NW_TEST_SUFFIX ".nw-test"
-#define NW_RESULT_SUFFIX ".nw-result"
-#define TEST_SUFFIX ".test"
-#define RESULT_SUFFIX ".result"
-#define REJECT_SUFFIX ".reject"
-#define OUT_SUFFIX ".out"
-#define ERR_SUFFIX ".err"
-
-#define TEST_PASS "[ pass ]"
-#define TEST_SKIP "[ skip ]"
-#define TEST_FAIL "[ fail ]"
-#define TEST_BAD "[ bad ]"
-#define TEST_IGNORE "[ignore]"
-
-/******************************************************************************
-
- global variables
-
-******************************************************************************/
-
-char base_dir[PATH_MAX] = "sys:/mysql";
-char db[PATH_MAX] = "test";
-char user[PATH_MAX] = "root";
-char password[PATH_MAX] = "";
-
-int master_port = 9306;
-int slave_port = 9307;
-
-// comma delimited list of tests to skip or empty string
-char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix ";
-char ignore_test[PATH_MAX] = "";
-
-char bin_dir[PATH_MAX];
-char mysql_test_dir[PATH_MAX];
-char test_dir[PATH_MAX];
-char mysql_tmp_dir[PATH_MAX];
-char result_dir[PATH_MAX];
-char master_dir[PATH_MAX];
-char slave_dir[PATH_MAX];
-char lang_dir[PATH_MAX];
-char char_dir[PATH_MAX];
-
-char mysqladmin_file[PATH_MAX];
-char mysqld_file[PATH_MAX];
-char mysqltest_file[PATH_MAX];
-char master_pid[PATH_MAX];
-char slave_pid[PATH_MAX];
-
-char master_opt[PATH_MAX] = "";
-char slave_opt[PATH_MAX] = "";
-
-char slave_master_info[PATH_MAX] = "";
-
-char master_init_script[PATH_MAX] = "";
-char slave_init_script[PATH_MAX] = "";
-
-// OpenSSL
-char ca_cert[PATH_MAX];
-char server_cert[PATH_MAX];
-char server_key[PATH_MAX];
-char client_cert[PATH_MAX];
-char client_key[PATH_MAX];
-
-int total_skip = 0;
-int total_pass = 0;
-int total_fail = 0;
-int total_test = 0;
-
-int total_ignore = 0;
-double total_time = 0;
-
-int use_openssl = FALSE;
-int master_running = FALSE;
-int slave_running = FALSE;
-int skip_slave = TRUE;
-int single_test = TRUE;
-
-int restarts = 0;
-
-FILE *log_fd = NULL;
-
-/******************************************************************************
-
- functions
-
-******************************************************************************/
-
-/******************************************************************************
-
- prototypes
-
-******************************************************************************/
-
-void report_stats();
-void install_db(char *);
-void mysql_install_db();
-void start_master();
-void start_slave();
-void mysql_start();
-void stop_slave();
-void stop_master();
-void mysql_stop();
-void mysql_restart();
-int read_option(char *, char *);
-void run_test(char *);
-void setup(char *);
-void vlog(char *, va_list);
-void log_msg(char *, ...);
-void log_info(char *, ...);
-void log_error(char *, ...);
-void log_errno(char *, ...);
-void die(char *);
-char *str_tok(char *string, const char *delim);
-
-/******************************************************************************
-
- report_stats()
-
- Report the gathered statistics.
-
-******************************************************************************/
-void report_stats()
-{
- if (total_fail == 0)
- {
- log_msg("\nAll %d test(s) were successful.\n", total_test);
- }
- else
- {
- double percent = ((double)total_pass / total_test) * 100;
-
- log_msg("\nFailed %u/%u test(s), %.02f%% successful.\n",
- total_fail, total_test, percent);
- log_msg("\nThe .out and .err files in %s may give you some\n", result_dir);
- log_msg("hint of what went wrong.\n");
- log_msg("\nIf you want to report this error, please first read the documentation\n");
- log_msg("at: http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n");
- }
-
- log_msg("\n%.02f total minutes elapsed in the test cases\n\n", total_time / 60);
-}
-
-/******************************************************************************
-
- install_db()
-
- Install the a database.
-
-******************************************************************************/
-void install_db(char *datadir)
-{
- arg_list_t al;
- int err, i;
- char input[PATH_MAX];
- char output[PATH_MAX];
- char error[PATH_MAX];
-
- // input file
- snprintf(input, PATH_MAX, "%s/bin/test_db.sql", base_dir);
- snprintf(output, PATH_MAX, "%s/install.out", datadir);
- snprintf(error, PATH_MAX, "%s/install.err", datadir);
-
- // args
- init_args(&al);
- add_arg(&al, mysqld_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--bootstrap");
- add_arg(&al, "--skip-grant-tables");
- add_arg(&al, "--basedir=%s", base_dir);
- add_arg(&al, "--datadir=%s", datadir);
- add_arg(&al, "--skip-innodb");
-
- // spawn
- if ((err = spawn(mysqld_file, &al, TRUE, input, output, error)) != 0)
- {
- die("Unable to create database.");
- }
-
- // free args
- free_args(&al);
-}
-
-/******************************************************************************
-
- mysql_install_db()
-
- Install the test databases.
-
-******************************************************************************/
-void mysql_install_db()
-{
- char temp[PATH_MAX];
-
- // var directory
- snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir);
-
- // clean up old direcotry
- del_tree(temp);
-
- // create var directory
- mkdir(temp, S_IRWXU);
-
- // create subdirectories
- log_msg("Creating test-suite folders...\n");
- snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
- mkdir(temp, S_IRWXU);
- snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
- mkdir(temp, S_IRWXU);
-
- // install databases
- log_msg("Creating test databases for master... \n");
- install_db(master_dir);
- log_msg("Creating test databases for slave... \n");
- install_db(slave_dir);
-}
-
-/******************************************************************************
-
- start_master()
-
- Start the master server.
-
-******************************************************************************/
-void start_master()
-{
- arg_list_t al;
- int err, i;
- char master_out[PATH_MAX];
- char master_err[PATH_MAX];
- char temp[PATH_MAX], temp2[PATH_MAX];
-
- // remove old berkeley db log files that can confuse the server
- removef("%s/log.*", master_dir);
-
- // remove stale binary logs
- removef("%s/var/log/*-bin.*", mysql_test_dir);
-
- // remove stale binary logs
- removef("%s/var/log/*.index", mysql_test_dir);
-
- // remove master.info file
- removef("%s/master.info", master_dir);
-
- // remove relay files
- removef("%s/var/log/*relay*", mysql_test_dir);
-
- // remove relay-log.info file
- removef("%s/relay-log.info", master_dir);
-
- // init script
- if (master_init_script[0] != NULL)
- {
- // run_init_script(master_init_script);
-
- // TODO: use the scripts
- if (strindex(master_init_script, "repair_part2-master.sh") != NULL)
- {
- FILE *fp;
-
- // create an empty index file
- snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir);
- fp = fopen(temp, "wb+");
-
- fputs("1", fp);
-
- fclose(fp);
- }
-
- }
-
- // redirection files
- snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out",
- mysql_test_dir, restarts);
- snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err",
- mysql_test_dir, restarts);
-
- snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir);
- mkdir(temp2,0);
- snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir);
- mkdir(temp2,0);
-
- // args
- init_args(&al);
- add_arg(&al, "%s", mysqld_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir);
- add_arg(&al, "--server-id=1");
- add_arg(&al, "--basedir=%s", base_dir);
- add_arg(&al, "--port=%u", master_port);
- add_arg(&al, "--local-infile");
- add_arg(&al, "--core");
- add_arg(&al, "--datadir=%s", master_dir);
- add_arg(&al, "--pid-file=%s", master_pid);
- add_arg(&al, "--character-sets-dir=%s", char_dir);
- add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
- add_arg(&al, "--language=%s", lang_dir);
- add_arg(&al, "--log-bin-trust-function-creators");
- add_arg(&al, "--log-slow-queries");
- add_arg(&al, "--log-queries-not-using-indexes");
-#ifdef DEBUG //only for debug builds
- add_arg(&al, "--debug");
-#endif
-
- if (use_openssl)
- {
- add_arg(&al, "--ssl-ca=%s", ca_cert);
- add_arg(&al, "--ssl-cert=%s", server_cert);
- add_arg(&al, "--ssl-key=%s", server_key);
- }
-
- // $MASTER_40_ARGS
- add_arg(&al, "--rpl-recovery-rank=1");
- add_arg(&al, "--init-rpl-role=master");
-
- // $SMALL_SERVER
- add_arg(&al, "--key_buffer_size=1M");
- add_arg(&al, "--sort_buffer=256K");
- add_arg(&al, "--max_heap_table_size=1M");
-
- // $EXTRA_MASTER_OPT
- if (master_opt[0] != NULL)
- {
- char *p;
-
- p = (char *)str_tok(master_opt, " \t");
- if (!strstr(master_opt, "timezone"))
- {
- while (p)
- {
- add_arg(&al, "%s", p);
- p = (char *)str_tok(NULL, " \t");
- }
- }
- }
-
- // remove the pid file if it exists
- remove(master_pid);
-
- // spawn
- if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err)) == 0)
- {
- sleep_until_file_exists(master_pid);
-
- if ((err = wait_for_server_start(bin_dir, user, password, master_port,
- mysql_tmp_dir)) == 0)
- {
- master_running = TRUE;
- }
- else
- {
- log_error("The master server went down early.");
- }
- }
- else
- {
- log_error("Unable to start master server.");
- }
-
- // free_args
- free_args(&al);
-}
-
-/******************************************************************************
-
- start_slave()
-
- Start the slave server.
-
-******************************************************************************/
-void start_slave()
-{
- arg_list_t al;
- int err, i;
- char slave_out[PATH_MAX];
- char slave_err[PATH_MAX];
- char temp[PATH_MAX];
-
- // skip?
- if (skip_slave) return;
-
- // remove stale binary logs
- removef("%s/*-bin.*", slave_dir);
-
- // remove stale binary logs
- removef("%s/*.index", slave_dir);
-
- // remove master.info file
- removef("%s/master.info", slave_dir);
-
- // remove relay files
- removef("%s/var/log/*relay*", mysql_test_dir);
-
- // remove relay-log.info file
- removef("%s/relay-log.info", slave_dir);
-
- // init script
- if (slave_init_script[0] != NULL)
- {
- // run_init_script(slave_init_script);
-
- // TODO: use the scripts
- if (strindex(slave_init_script, "rpl000016-slave.sh") != NULL)
- {
- // create empty master.info file
- snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
- close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
- }
- else if (strindex(slave_init_script, "rpl000017-slave.sh") != NULL)
- {
- FILE *fp;
-
- // create a master.info file
- snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
- fp = fopen(temp, "wb+");
-
- fputs("master-bin.000001\n", fp);
- fputs("4\n", fp);
- fputs("127.0.0.1\n", fp);
- fputs("replicate\n", fp);
- fputs("aaaaaaaaaaaaaaab\n", fp);
- fputs("9306\n", fp);
- fputs("1\n", fp);
- fputs("0\n", fp);
-
- fclose(fp);
- }
- else if (strindex(slave_init_script, "rpl_rotate_logs-slave.sh") != NULL)
- {
- // create empty master.info file
- snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
- close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
- }
- }
-
- // redirection files
- snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out",
- mysql_test_dir, restarts);
- snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err",
- mysql_test_dir, restarts);
-
- // args
- init_args(&al);
- add_arg(&al, "%s", mysqld_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--log-bin=slave-bin");
- add_arg(&al, "--relay_log=slave-relay-bin");
- add_arg(&al, "--basedir=%s", base_dir);
- add_arg(&al, "--port=%u", slave_port);
- add_arg(&al, "--datadir=%s", slave_dir);
- add_arg(&al, "--pid-file=%s", slave_pid);
- add_arg(&al, "--character-sets-dir=%s", char_dir);
- add_arg(&al, "--core");
- add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
- add_arg(&al, "--language=%s", lang_dir);
-
- add_arg(&al, "--exit-info=256");
- add_arg(&al, "--log-slave-updates");
- add_arg(&al, "--init-rpl-role=slave");
- add_arg(&al, "--skip-innodb");
- add_arg(&al, "--skip-slave-start");
- add_arg(&al, "--slave-load-tmpdir=../../var/tmp");
-
- add_arg(&al, "--report-user=%s", user);
- add_arg(&al, "--report-host=127.0.0.1");
- add_arg(&al, "--report-port=%u", slave_port);
-
- add_arg(&al, "--master-retry-count=10");
- add_arg(&al, "--slave_net_timeout=10");
- add_arg(&al, "--log-bin-trust-function-creators");
- add_arg(&al, "--log-slow-queries");
- add_arg(&al, "--log-queries-not-using-indexes");
-#ifdef DEBUG //only for debug builds
- add_arg(&al, "--debug");
-#endif
-
- if (use_openssl)
- {
- add_arg(&al, "--ssl-ca=%s", ca_cert);
- add_arg(&al, "--ssl-cert=%s", server_cert);
- add_arg(&al, "--ssl-key=%s", server_key);
- }
-
- // slave master info
- if (slave_master_info[0] != NULL)
- {
- char *p;
-
- p = (char *)str_tok(slave_master_info, " \t");
-
- while(p)
- {
- add_arg(&al, "%s", p);
-
- p = (char *)str_tok(NULL, " \t");
- }
- }
- else
- {
- add_arg(&al, "--master-user=%s", user);
- add_arg(&al, "--master-password=%s", password);
- add_arg(&al, "--master-host=127.0.0.1");
- add_arg(&al, "--master-port=%u", master_port);
- add_arg(&al, "--master-connect-retry=1");
- add_arg(&al, "--server-id=2");
- add_arg(&al, "--rpl-recovery-rank=2");
- }
-
- // small server
- add_arg(&al, "--key_buffer_size=1M");
- add_arg(&al, "--sort_buffer=256K");
- add_arg(&al, "--max_heap_table_size=1M");
-
- // opt args
- if (slave_opt[0] != NULL)
- {
- char *p;
-
- p = (char *)str_tok(slave_opt, " \t");
-
- while(p)
- {
- add_arg(&al, "%s", p);
-
- p = (char *)str_tok(NULL, " \t");
- }
- }
-
- // remove the pid file if it exists
- remove(slave_pid);
-
- // spawn
- if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err)) == 0)
- {
- sleep_until_file_exists(slave_pid);
-
- if ((err = wait_for_server_start(bin_dir, user, password, slave_port,
- mysql_tmp_dir)) == 0)
- {
- slave_running = TRUE;
-
- }
- else
- {
- log_error("The slave server went down early.");
-
- }
- }
- else
- {
- log_error("Unable to start slave server.");
-
- }
-
- // free args
- free_args(&al);
-}
-
-/******************************************************************************
-
- mysql_start()
-
- Start the mysql servers.
-
-******************************************************************************/
-void mysql_start()
-{
- log_info("Starting the MySQL server(s): %u", ++restarts);
- start_master();
-
- start_slave();
-
- // activate the test screen
- ActivateScreen(getscreenhandle());
-}
-
-/******************************************************************************
-
- stop_slave()
-
- Stop the slave server.
-
-******************************************************************************/
-void stop_slave()
-{
- int err;
-
- // running?
- if (!slave_running) return;
-
- // stop
- if ((err = stop_server(bin_dir, user, password, slave_port, slave_pid,
- mysql_tmp_dir)) == 0)
- {
- slave_running = FALSE;
- }
- else
- {
- log_error("Unable to stop slave server.");
- }
-}
-
-/******************************************************************************
-
- stop_master()
-
- Stop the master server.
-
-******************************************************************************/
-void stop_master()
-{
- int err;
-
- // running?
- if (!master_running) return;
-
- if ((err = stop_server(bin_dir, user, password, master_port, master_pid,
- mysql_tmp_dir)) == 0)
- {
- master_running = FALSE;
- }
- else
- {
- log_error("Unable to stop master server.");
- }
-}
-
-/******************************************************************************
-
- mysql_stop()
-
- Stop the mysql servers.
-
-******************************************************************************/
-void mysql_stop()
-{
- log_info("Stopping the MySQL server(s)...");
- stop_master();
-
- stop_slave();
-
- // activate the test screen
- ActivateScreen(getscreenhandle());
-}
-
-/******************************************************************************
-
- mysql_restart()
-
- Restart the mysql servers.
-
-******************************************************************************/
-void mysql_restart()
-{
- log_info("Restarting the MySQL server(s): %u", ++restarts);
-
- mysql_stop();
-
- mysql_start();
-}
-
-/******************************************************************************
-
- read_option()
-
- Read the option file.
-
-******************************************************************************/
-int read_option(char *opt_file, char *opt)
-{
- int fd, err;
- int result;
- char *p;
- char buf[PATH_MAX];
-
- // copy current option
- strncpy(buf, opt, PATH_MAX);
-
- // open options file
- fd = open(opt_file, O_RDONLY);
-
- err = read(fd, opt, PATH_MAX);
-
- close(fd);
-
- if (err > 0)
- {
- // terminate string
- if ((p = strchr(opt, '\n')) != NULL)
- {
- *p = NULL;
-
- // check for a '\r'
- if ((p = strchr(opt, '\r')) != NULL)
- {
- *p = NULL;
- }
- }
- else
- {
- opt[err] = NULL;
- }
-
- // check for $MYSQL_TEST_DIR
- if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
- {
- char temp[PATH_MAX];
-
- *p = NULL;
-
- strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
-
- strcat(opt, mysql_test_dir);
-
- strcat(opt, temp);
- }
- // Check for double backslash and replace it with single bakslash
- if ((p = strstr(opt, "\\\\")) != NULL)
- {
- /* bmove is guranteed to work byte by byte */
- bmove(p, p+1, strlen(p+1));
- }
- }
- else
- {
- // clear option
- *opt = NULL;
- }
-
- // compare current option with previous
- return strcmp(opt, buf);
-}
-
-/******************************************************************************
-
- run_test()
-
- Run the given test case.
-
-******************************************************************************/
-void run_test(char *test)
-{
- char temp[PATH_MAX];
- char *rstr;
- double elapsed = 0;
- int skip = FALSE, ignore=FALSE;
- int restart = FALSE;
- int flag = FALSE;
- struct stat info;
-
- // skip tests in the skip list
- snprintf(temp, PATH_MAX, " %s ", test);
- skip = (strindex(skip_test, temp) != NULL);
- if (skip == FALSE)
- ignore = (strindex(ignore_test, temp) != NULL);
-
- if (ignore)
- {
- // show test
- log_msg("%-46s ", test);
-
- // ignore
- rstr = TEST_IGNORE;
- ++total_ignore;
- }
- else if (!skip) // skip test?
- {
- char test_file[PATH_MAX];
- char master_opt_file[PATH_MAX];
- char slave_opt_file[PATH_MAX];
- char slave_master_info_file[PATH_MAX];
- char result_file[PATH_MAX];
- char reject_file[PATH_MAX];
- char out_file[PATH_MAX];
- char err_file[PATH_MAX];
- int err;
- arg_list_t al;
- NXTime_t start, stop;
-
- // skip slave?
- flag = skip_slave;
- skip_slave = (strncmp(test, "rpl", 3) != 0);
- if (flag != skip_slave) restart = TRUE;
-
- // create files
- snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test);
- snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test);
- snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test);
- snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX);
- snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX);
- snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX);
-
- // netware specific files
- snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
- if (stat(test_file, &info))
- {
- snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX);
- if (access(test_file,0))
- {
- printf("Invalid test name %s, %s file not found\n",test,test_file);
- return;
- }
- }
-
- snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX);
- if (stat(result_file, &info))
- {
- snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX);
- }
-
- // init scripts
- snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test);
- if (stat(master_init_script, &info))
- master_init_script[0] = NULL;
- else
- restart = TRUE;
-
- snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test);
- if (stat(slave_init_script, &info))
- slave_init_script[0] = NULL;
- else
- restart = TRUE;
-
- // read options
- if (read_option(master_opt_file, master_opt)) restart = TRUE;
- if (read_option(slave_opt_file, slave_opt)) restart = TRUE;
- if (read_option(slave_master_info_file, slave_master_info)) restart = TRUE;
-
- // cleanup previous run
- remove(reject_file);
- remove(out_file);
- remove(err_file);
-
- // start or restart?
- if (!master_running) mysql_start();
- else if (restart) mysql_restart();
-
- // let the system stabalize
- sleep(1);
-
- // show test
- log_msg("%-46s ", test);
-
- // args
- init_args(&al);
- add_arg(&al, "%s", mysqltest_file);
- add_arg(&al, "--no-defaults");
- add_arg(&al, "--port=%u", master_port);
- add_arg(&al, "--database=%s", db);
- add_arg(&al, "--user=%s", user);
- add_arg(&al, "--password=%s", password);
- add_arg(&al, "--silent");
- add_arg(&al, "--basedir=%s/", mysql_test_dir);
- add_arg(&al, "--host=127.0.0.1");
- add_arg(&al, "-v");
- add_arg(&al, "-R");
- add_arg(&al, "%s", result_file);
-
- if (use_openssl)
- {
- add_arg(&al, "--ssl-ca=%s", ca_cert);
- add_arg(&al, "--ssl-cert=%s", client_cert);
- add_arg(&al, "--ssl-key=%s", client_key);
- }
-
- // start timer
- NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &start);
-
- // spawn
- err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file);
-
- // stop timer
- NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &stop);
-
- // calculate
- elapsed = ((double)(stop - start)) / NX_USECONDS;
- total_time += elapsed;
-
- // free args
- free_args(&al);
-
- if (err == 0)
- {
- // pass
- rstr = TEST_PASS;
- ++total_pass;
-
- // increment total
- ++total_test;
- }
- else if (err == 62)
- {
- // skip
- rstr = TEST_SKIP;
- ++total_skip;
- }
- else if (err == 1)
- {
- // fail
- rstr = TEST_FAIL;
- ++total_fail;
-
- // increment total
- ++total_test;
- }
- else
- {
- rstr = TEST_BAD;
- }
- }
- else // early skips
- {
- // show test
- log_msg("%-46s ", test);
-
- // skip
- rstr = TEST_SKIP;
- ++total_skip;
- }
-
- // result
- log_msg("%10.06f %-14s\n", elapsed, rstr);
-}
-
-/******************************************************************************
-
- vlog()
-
- Log the message.
-
-******************************************************************************/
-void vlog(char *format, va_list ap)
-{
- vfprintf(stdout, format, ap);
- fflush(stdout);
-
- if (log_fd)
- {
- vfprintf(log_fd, format, ap);
- fflush(log_fd);
- }
-}
-
-/******************************************************************************
-
- log()
-
- Log the message.
-
-******************************************************************************/
-void log_msg(char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- vlog(format, ap);
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- log_info()
-
- Log the given information.
-
-******************************************************************************/
-void log_info(char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- log_msg("-- INFO : ");
- vlog(format, ap);
- log_msg("\n");
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- log_error()
-
- Log the given error.
-
-******************************************************************************/
-void log_error(char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- log_msg("-- ERROR: ");
- vlog(format, ap);
- log_msg("\n");
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- log_errno()
-
- Log the given error and errno.
-
-******************************************************************************/
-void log_errno(char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- log_msg("-- ERROR: (%003u) ", errno);
- vlog(format, ap);
- log_msg("\n");
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- die()
-
- Exit the application.
-
-******************************************************************************/
-void die(char *msg)
-{
- log_error(msg);
-
- pressanykey();
-
- exit(-1);
-}
-
-/******************************************************************************
-
- setup()
-
- Setup the mysql test enviornment.
-
-******************************************************************************/
-void setup(char *file)
-{
- char temp[PATH_MAX];
- char file_path[PATH_MAX*2];
- char *p;
-
- // set the timezone for the timestamp test
- setenv("TZ", "GMT-3", TRUE);
-
- // find base dir
- strcpy(temp, strlwr(file));
- while((p = strchr(temp, '\\')) != NULL) *p = '/';
-
- if ((p = strindex(temp, "/mysql-test/")) != NULL)
- {
- *p = NULL;
- strcpy(base_dir, temp);
- }
-
- // setup paths
- snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir);
- snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
- snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
- snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
- snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
- snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
- snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
- snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
- snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
-
-#ifdef HAVE_OPENSSL
- use_openssl = TRUE;
-#endif // HAVE_OPENSSL
-
- // OpenSSL paths
- snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
- snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
- snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
- snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
- snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
-
- // setup files
- snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir);
- snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
- snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
- snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
- snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
-
- // create log file
- snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir);
- if ((log_fd = fopen(temp, "w+")) == NULL)
- {
- log_errno("Unable to create log file.");
- }
-
- // prepare skip test list
- while((p = strchr(skip_test, ',')) != NULL) *p = ' ';
- strcpy(temp, strlwr(skip_test));
- snprintf(skip_test, PATH_MAX, " %s ", temp);
-
- // environment
- setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
- snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port);
- setenv("MYSQL_DUMP", file_path, 1);
- snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir);
- setenv("MYSQL_BINLOG", file_path, 1);
- setenv("MASTER_MYPORT", "9306", 1);
- setenv("SLAVE_MYPORT", "9307", 1);
- snprintf(file_path, PATH_MAX*2, "%d", MYSQL_PORT);
- setenv("MYSQL_TCP_PORT", file_path, 1);
- snprintf(file_path, PATH_MAX*2, "%s/mysql_client_test --no-defaults --testcase--user=root --port=%u ", bin_dir, master_port);
- setenv("MYSQL_CLIENT_TEST",file_path,1);
- snprintf(file_path, PATH_MAX*2, "%s/mysql --no-defaults --user=root --port=%u ", bin_dir, master_port);
- setenv("MYSQL",file_path,1);
- snprintf(file_path, PATH_MAX*2, "%s/mysqlshow --no-defaults --user=root --port=%u", bin_dir, master_port);
- setenv("MYSQL_SHOW",file_path,1);
- snprintf(file_path, PATH_MAX*2, "%s/mysqlcheck --no-defaults -uroot --port=%u", bin_dir, master_port);
- setenv("MYSQL_CHECK",file_path,1);
-
-}
-
-/******************************************************************************
-
- main()
-
-******************************************************************************/
-int main(int argc, char **argv)
-{
- int is_ignore_list= 0, autoclose= 0, individual_execution= 0;
- // setup
- setup(argv[0]);
-
- /* The --ignore option is comma saperated list of test cases to skip and
- should be very first command line option to the test suite.
-
- The usage is now:
- mysql_test_run --ignore=test1,test2 test3 test4
- where test1 and test2 are test cases to ignore
- and test3 and test4 are test cases to run.
- */
- if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
- {
- char *temp, *token;
- temp= strdup(strchr(argv[1],'=') + 1);
- for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ","))
- {
- if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1)
- sprintf(ignore_test+strlen(ignore_test), " %s ", token);
- else
- {
- free(temp);
- die("ignore list too long.");
- }
- }
- free(temp);
- is_ignore_list = 1;
- }
- // header
- log_msg("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-
- log_msg("Initializing Tests...\n");
-
- // install test databases
- mysql_install_db();
-
- log_msg("Starting Tests...\n");
-
- log_msg("\n");
- log_msg(HEADER);
- log_msg(DASH);
-
- if ( argc > 1 + is_ignore_list )
- {
- int i;
-
- for (i = 1 + is_ignore_list; i < argc; i++)
- {
- if (!strncasecmp(argv[i], "--autoclose", 11))
- {
- autoclose= 1;
- continue;
- }
- // single test
- single_test= TRUE;
- individual_execution= 1;
-
- // run given test
- run_test(argv[i]);
- }
- }
- if (!individual_execution)
- {
- // run all tests
- DIR *dir = opendir(test_dir);
- DIR *entry;
- char test[NAME_MAX];
- char *p;
-
- // single test
- single_test = FALSE;
-
- if (dir == NULL)
- {
- die("Unable to open tests directory.");
- }
-
- while((entry = readdir(dir)) != NULL)
- {
- if (!S_ISDIR(entry->d_type))
- {
- strcpy(test, strlwr(entry->d_name));
-
- // find the test suffix
- if ((p = strindex(test, TEST_SUFFIX)) != NULL)
- {
- // null terminate at the suffix
- *p = '\0';
-
- // run test
- run_test(test);
- }
- }
- }
-
- closedir(dir);
- }
-
- // stop server
- mysql_stop();
-
- log_msg(DASH);
- log_msg("\n");
-
- log_msg("Ending Tests...\n");
-
- // report stats
- report_stats();
-
- // close log
- if (log_fd) fclose(log_fd);
-
- // keep results up
- if (!autoclose)
- pressanykey();
-
- return 0;
-}
-
-/*
- Synopsis:
- This function breaks the string into a sequence of tokens. The difference
- between this function and strtok is that it respects the quoted string i.e.
- it skips any delimiter character within the quoted part of the string.
- It return tokens by eliminating quote character. It modifies the input string
- passed. It will work with whitespace delimeter but may not work properly with
- other delimeter. If the delimeter will contain any quote character, then
- function will not tokenize and will return null string.
- e.g. if input string is
- --init-slave="set global max_connections=500" --skip-external-locking
- then the output will two string i.e.
- --init-slave=set global max_connections=500
- --skip-external-locking
-
-Arguments:
- string: input string
- delim: set of delimiter character
-Output:
- return the null terminated token of NULL.
-*/
-
-
-char *str_tok(char *string, const char *delim)
-{
- char *token; /* current token received from strtok */
- char *qt_token; /* token delimeted by the matching pair of quote */
- /*
- if there are any quote chars found in the token then this variable
- will hold the concatenated string to return to the caller
- */
- char *ptr_token=NULL;
- /* pointer to the quote character in the token from strtok */
- char *ptr_quote=NULL;
-
- /* See if the delimeter contains any quote character */
- if (strchr(delim,'\'') || strchr(delim,'\"'))
- return NULL;
-
- /* repeate till we are getting some token from strtok */
- while ((token = (char*)strtok(string, delim) ) != NULL)
- {
- /*
- make the input string NULL so that next time onward strtok can
- be called with NULL input string.
- */
- string = NULL;
-
- /* check if the current token contain double quote character*/
- if ((ptr_quote = (char*)strchr(token,'\"')) != NULL)
- {
- /*
- get the matching the matching double quote in the remaining
- input string
- */
- qt_token = (char*)strtok(NULL,"\"");
- }
- /* check if the current token contain single quote character*/
- else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL)
- {
- /*
- get the matching the matching single quote in the remaining
- input string
- */
- qt_token = (char*)strtok(NULL,"\'");
- }
-
- /*
- if the current token does not contains any quote character then
- return to the caller.
- */
- if (ptr_quote == NULL)
- {
- /*
- if there is any earlier token i.e. ptr_token then append the
- current token in it and return it else return the current
- token directly
- */
- return ptr_token ? strcat(ptr_token,token) : token;
- }
-
- /*
- remove the quote character i.e. make NULL so that the token will
- be devided in two part and later both part can be concatenated
- and hence quote will be removed
- */
- *ptr_quote= 0;
-
- /* check if ptr_token has been initialized or not */
- if (ptr_token == NULL)
- {
- /* initialize the ptr_token with current token */
- ptr_token= token;
- /* copy entire string between matching pair of quote*/
- sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
- }
- else
- {
- /*
- copy the current token and entire string between matching pair
- of quote
- */
- sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1,
- qt_token );
- }
- }
-
- /* return the concatenated token */
- return ptr_token;
-}
diff --git a/netware/mysql_test_run.def b/netware/mysql_test_run.def
deleted file mode 100644
index c8afd305978..00000000000
--- a/netware/mysql_test_run.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Test Run
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Test Run"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Test Run"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
diff --git a/netware/mysql_upgrade.def b/netware/mysql_upgrade.def
deleted file mode 100644
index 7b5718ffb1b..00000000000
--- a/netware/mysql_upgrade.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Admin
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Upgrade Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysql_waitpid.def b/netware/mysql_waitpid.def
deleted file mode 100644
index 6e9cc76f139..00000000000
--- a/netware/mysql_waitpid.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# Wait for a Program to Terminate
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-#SCREENNAME "MySQL Tool - Wait for a Program to Terminate"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Tool - Wait for a Program to Terminate"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqladmin.def b/netware/mysqladmin.def
deleted file mode 100644
index 03f15dfdd08..00000000000
--- a/netware/mysqladmin.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Admin
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Admin[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Admin Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqlbinlog.def b/netware/mysqlbinlog.def
deleted file mode 100644
index 88024acc318..00000000000
--- a/netware/mysqlbinlog.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Binary Log
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Binary Log Dump Tool[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Binary Log Dump Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqlcheck.def b/netware/mysqlcheck.def
deleted file mode 100644
index b9028c237d1..00000000000
--- a/netware/mysqlcheck.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Client
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Check Tool[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Check Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqld.def b/netware/mysqld.def
deleted file mode 100644
index bb7b8129983..00000000000
--- a/netware/mysqld.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Server
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Database Server"
-VERSION 4, 0
-MULTIPLE
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqld_safe.c b/netware/mysqld_safe.c
deleted file mode 100644
index 2a4268d63ef..00000000000
--- a/netware/mysqld_safe.c
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- Copyright (c) 2003 Novell, Inc. 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; either version 2 of the License, or
- (at your option) any later version.
-
- 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 <stdlib.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <sys/stat.h>
-#include <monitor.h>
-#include <strings.h>
-#include <getopt.h>
-#include <screen.h>
-#include <dirent.h>
-
-#include "my_config.h"
-#include "my_manage.h"
-#include "mysql_version.h"
-
-/******************************************************************************
-
- global variables
-
-******************************************************************************/
-char autoclose;
-char basedir[PATH_MAX];
-char checktables;
-char datadir[PATH_MAX];
-char pid_file[PATH_MAX];
-char address[PATH_MAX];
-char port[PATH_MAX];
-char err_log[PATH_MAX];
-char safe_log[PATH_MAX];
-char mysqld[PATH_MAX];
-char hostname[PATH_MAX];
-char default_option[PATH_MAX];
-
-FILE *log_fd= NULL;
-
-/******************************************************************************
-
- prototypes
-
-******************************************************************************/
-
-void usage(void);
-void vlog(char *, va_list);
-void log(char *, ...);
-void start_defaults(int, char *[]);
-void finish_defaults();
-void read_defaults(arg_list_t *);
-void parse_args(int, char *[]);
-void get_options(int, char *[]);
-void check_data_vol();
-void check_setup();
-void check_tables();
-void mysql_start(int, char *[]);
-
-/******************************************************************************
-
- functions
-
-******************************************************************************/
-
-/******************************************************************************
-
- usage()
-
- Show usage.
-
-******************************************************************************/
-void usage(void)
-{
- // keep the screen up
- setscreenmode(SCR_NO_MODE);
-
- puts("\
-\n\
-usage: mysqld_safe [options]\n\
-\n\
-Program to start the MySQL daemon and restart it if it dies unexpectedly.\n\
-All options, besides those listed below, are passed on to the MySQL daemon.\n\
-\n\
-options:\n\
-\n\
---autoclose Automatically close the mysqld_safe screen.\n\
-\n\
---check-tables Check the tables before starting the MySQL daemon.\n\
-\n\
---err-log=<file> Send the MySQL daemon error output to <file>.\n\
-\n\
---help Show this help information.\n\
-\n\
---mysqld=<file> Use the <file> MySQL daemon.\n\
-\n\
- ");
-
- exit(-1);
-}
-
-/******************************************************************************
-
- vlog()
-
- Log the message.
-
-******************************************************************************/
-void vlog(char *format, va_list ap)
-{
- vfprintf(stdout, format, ap);
- fflush(stdout);
-
- if (log_fd)
- {
- vfprintf(log_fd, format, ap);
- fflush(log_fd);
- }
-}
-
-/******************************************************************************
-
- log()
-
- Log the message.
-
-******************************************************************************/
-void log(char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- vlog(format, ap);
-
- va_end(ap);
-}
-
-/******************************************************************************
-
- start_defaults()
-
- Start setting the defaults.
-
-******************************************************************************/
-void start_defaults(int argc, char *argv[])
-{
- struct stat buf;
- int i;
-
- // default options
- static char *default_options[]=
- {
- "--no-defaults",
- "--defaults-file=",
- "--defaults-extra-file=",
- NULL
- };
-
- // autoclose
- autoclose= FALSE;
-
- // basedir
- get_basedir(argv[0], basedir);
-
- // check-tables
- checktables= FALSE;
-
- // hostname
- if (gethostname(hostname, PATH_MAX) < 0)
- {
- // default
- strcpy(hostname, "mysql");
- }
-
- // address
- snprintf(address, PATH_MAX, "0.0.0.0");
-
- // port
- snprintf(port, PATH_MAX, "%d", MYSQL_PORT);
-
- // default option
- default_option[0]= NULL;
- for (i= 0; (argc > 1) && default_options[i]; i++)
- {
- if (!strnicmp(argv[1], default_options[i], strlen(default_options[i])))
- {
- strncpy(default_option, argv[1], PATH_MAX);
- break;
- }
- }
-
- // set after basedir is established
- datadir[0]= NULL;
- pid_file[0]= NULL;
- err_log[0]= NULL;
- safe_log[0]= NULL;
- mysqld[0]= NULL;
-}
-
-/******************************************************************************
-
- finish_defaults()
-
- Finish settig the defaults.
-
-******************************************************************************/
-void finish_defaults()
-{
- struct stat buf;
- int i;
-
- // datadir
- if (!datadir[0])
- snprintf(datadir, PATH_MAX, "%s/data", basedir);
-
- // pid-file
- if (!pid_file[0])
- snprintf(pid_file, PATH_MAX, "%s/%s.pid", datadir, hostname);
-
- // err-log
- if (!err_log[0])
- snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname);
-
- // safe-log
- if (!safe_log[0])
- snprintf(safe_log, PATH_MAX, "%s/%s.safe", datadir, hostname);
-
- // mysqld
- if (!mysqld[0])
- snprintf(mysqld, PATH_MAX, "%s/bin/mysqld-max", basedir);
-
- if (stat(mysqld, &buf))
- {
- snprintf(mysqld, PATH_MAX, "%s/bin/mysqld", basedir);
- }
-}
-
-/******************************************************************************
-
- read_defaults()
-
- Read the defaults.
-
-******************************************************************************/
-void read_defaults(arg_list_t *pal)
-{
- arg_list_t al;
- char defaults_file[PATH_MAX];
- char mydefaults[PATH_MAX];
- char line[PATH_MAX];
- FILE *fp;
-
- // defaults output file
- snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir);
- remove(defaults_file);
-
- // mysqladmin file
- snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir);
-
- // args
- init_args(&al);
- add_arg(&al, mydefaults);
- if (default_option[0])
- add_arg(&al, default_option);
- add_arg(&al, "mysqld");
- add_arg(&al, "server");
- add_arg(&al, "mysqld_safe");
- add_arg(&al, "safe_mysqld");
-
- spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL);
-
- free_args(&al);
-
- // gather defaults
- if ((fp= fopen(defaults_file, "r")) != NULL)
- {
- while (fgets(line, PATH_MAX, fp))
- {
- char *p;
-
- // remove end-of-line character
- if ((p= strrchr(line, '\n')) != NULL)
- *p= '\0';
-
- // add the option as an argument
- add_arg(pal, line);
- }
-
- fclose(fp);
- }
-
- // remove file
- remove(defaults_file);
-}
-
-/******************************************************************************
-
- parse_args()
-
- Get the options.
-
-******************************************************************************/
-void parse_args(int argc, char *argv[])
-{
- int index= 0;
- int c;
-
- // parse options
- enum opts
- {
- OPT_BASEDIR= 0xFF,
- OPT_DATADIR,
- OPT_PID_FILE,
- OPT_BIND_ADDRESS,
- OPT_PORT,
- OPT_ERR_LOG,
- OPT_SAFE_LOG,
- OPT_MYSQLD,
- OPT_HELP
- };
-
- static struct option options[]=
- {
- {"autoclose", no_argument, &autoclose, TRUE},
- {"basedir", required_argument, 0, OPT_BASEDIR},
- {"check-tables", no_argument, &checktables, TRUE},
- {"datadir", required_argument, 0, OPT_DATADIR},
- {"pid-file", required_argument, 0, OPT_PID_FILE},
- {"bind-address", required_argument, 0, OPT_BIND_ADDRESS},
- {"port", required_argument, 0, OPT_PORT},
- {"err-log", required_argument, 0, OPT_ERR_LOG},
- {"safe-log", required_argument, 0, OPT_SAFE_LOG},
- {"mysqld", required_argument, 0, OPT_MYSQLD},
- {"help", no_argument, 0, OPT_HELP},
- {0, 0, 0, 0}
- };
-
- // we have to reset getopt_long because we use it multiple times
- optind= 1;
-
- // turn off error reporting
- opterr= 0;
-
- while ((c= getopt_long(argc, argv, "b:h:P:", options, &index)) >= 0)
- {
- switch (c) {
- case OPT_BASEDIR:
- case 'b':
- strcpy(basedir, optarg);
- break;
-
- case OPT_DATADIR:
- case 'h':
- strcpy(datadir, optarg);
- break;
-
- case OPT_PID_FILE:
- strcpy(pid_file, optarg);
- break;
-
- case OPT_BIND_ADDRESS:
- strcpy(address, optarg);
- break;
-
- case OPT_PORT:
- case 'P':
- strcpy(port, optarg);
- break;
-
- case OPT_ERR_LOG:
- strcpy(err_log, optarg);
- break;
-
- case OPT_SAFE_LOG:
- strcpy(safe_log, optarg);
- break;
-
- case OPT_MYSQLD:
- strcpy(mysqld, optarg);
- break;
-
- case OPT_HELP:
- usage();
- break;
-
- default:
- // ignore
- break;
- }
- }
-}
-
-
-/******************************************************************************
-
-
-
-/******************************************************************************
-
- get_options()
-
- Get the options.
-
-******************************************************************************/
-void get_options(int argc, char *argv[])
-{
- arg_list_t al;
-
- // start defaults
- start_defaults(argc, argv);
-
- // default file arguments
- init_args(&al);
- add_arg(&al, "ignore");
- read_defaults(&al);
- parse_args(al.argc, al.argv);
- free_args(&al);
-
- // command-line arguments
- parse_args(argc, argv);
-
- // finish defaults
- finish_defaults();
-}
-
-/******************************************************************************
-
- check_data_vol()
-
- Check the database volume.
-
-******************************************************************************/
-void check_data_vol()
-{
- // warn if the data is on a Traditional volume
- struct volume_info vol;
- char buff[PATH_MAX];
- char *p;
-
- // clear struct
- memset(&vol, 0, sizeof(vol));
-
- // find volume name
- strcpy(buff, datadir);
- if (p= strchr(buff, ':'))
- {
- // terminate after volume name
- *p= 0;
- }
- else
- {
- // assume SYS volume
- strcpy(buff, "SYS");
- }
-
- // retrieve information
- netware_vol_info_from_name(&vol, buff);
-
- if ((vol.flags & VOL_NSS_PRESENT) == 0)
- {
- log("Error: Either the data directory does not exist or is not on an NSS volume!\n\n");
- exit(-1);
- }
-}
-
-/******************************************************************************
-
- check_setup()
-
- Check the current setup.
-
-******************************************************************************/
-void check_setup()
-{
- struct stat info;
- char temp[PATH_MAX];
-
- // remove any current pid_file
- if (!stat(pid_file, &info) && (remove(pid_file) < 0))
- {
- log("ERROR: Unable to remove current pid file!\n\n");
- exit(-1);
- }
-
- // check the data volume
- check_data_vol();
-
- // check for a database
- snprintf(temp, PATH_MAX, "%s/mysql/host.frm", datadir);
- if (stat(temp, &info))
- {
- log("ERROR: No database found in the data directory!\n\n");
- exit(-1);
- }
-}
-
-/******************************************************************************
-
- check_tables()
-
- Check the database tables.
-
-******************************************************************************/
-void check_tables()
-{
- arg_list_t al;
- char mycheck[PATH_MAX];
- char table[PATH_MAX];
- char db[PATH_MAX];
- DIR *datadir_entry, *db_entry, *table_entry;
-
- // status
- log("checking tables...\n");
-
- // list databases
- if ((datadir_entry= opendir(datadir)) == NULL)
- {
- return;
- }
-
- while ((db_entry= readdir(datadir_entry)) != NULL)
- {
- if (db_entry->d_name[0] == '.')
- {
- // Skip
- }
- else if (S_ISDIR(db_entry->d_type))
- {
- // create long db name
- snprintf(db, PATH_MAX, "%s/%s", datadir, db_entry->d_name);
-
- // list tables
- if ((db_entry= opendir(db)) == NULL)
- {
- continue;
- }
-
- while ((table_entry= readdir(db_entry)) != NULL)
- {
- // create long table name
- snprintf(table, PATH_MAX, "%s/%s", db, strlwr(table_entry->d_name));
-
- if (strindex(table, ".myi"))
- {
- // ** myisamchk
-
- // mysqladmin file
- snprintf(mycheck, PATH_MAX, "%s/bin/myisamchk", basedir);
-
- // args
- init_args(&al);
- add_arg(&al, mycheck);
- add_arg(&al, "--silent");
- add_arg(&al, "--force");
- add_arg(&al, "--fast");
- add_arg(&al, "--medium-check");
- add_arg(&al, "--key_buffer=64M");
- add_arg(&al, "--sort_buffer=64M");
- add_arg(&al, table);
-
- spawn(mycheck, &al, TRUE, NULL, NULL, NULL);
-
- free_args(&al);
- }
- else if (strindex(table, ".ism"))
- {
- // ** isamchk
-
- // mysqladmin file
- snprintf(mycheck, PATH_MAX, "%s/bin/isamchk", basedir);
-
- // args
- init_args(&al);
- add_arg(&al, mycheck);
- add_arg(&al, "--silent");
- add_arg(&al, "--force");
- add_arg(&al, "--sort_buffer=64M");
- add_arg(&al, table);
-
- spawn(mycheck, &al, TRUE, NULL, NULL, NULL);
-
- free_args(&al);
- }
- }
- }
- }
-}
-
-/******************************************************************************
-
- mysql_start()
-
- Start the mysql server.
-
-******************************************************************************/
-void mysql_start(int argc, char *argv[])
-{
- arg_list_t al;
- int i, j, err;
- struct stat info;
- time_t cal;
- struct tm lt;
- char stamp[PATH_MAX];
- char skip;
-
- // private options
- static char *private_options[]=
- {
- "--autoclose",
- "--check-tables",
- "--help",
- "--err-log=",
- "--mysqld=",
- NULL
- };
-
- // args
- init_args(&al);
- add_arg(&al, "%s", mysqld);
-
- // parent args
- for (i= 1; i < argc; i++)
- {
- skip= FALSE;
-
- // skip private arguments
- for (j= 0; private_options[j]; j++)
- {
- if (!strnicmp(argv[i], private_options[j], strlen(private_options[j])))
- {
- skip= TRUE;
- break;
- }
- }
-
- if (!skip)
- {
- add_arg(&al, "%s", argv[i]);
- }
- }
- // spawn
- do
- {
- // check the database tables
- if (checktables)
- check_tables();
-
- // status
- time(&cal);
- localtime_r(&cal, &lt);
- strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", &lt);
- log("mysql started : %s\n", stamp);
-
- // spawn mysqld
- spawn(mysqld, &al, TRUE, NULL, NULL, err_log);
- }
- while (!stat(pid_file, &info));
-
- // status
- time(&cal);
- localtime_r(&cal, &lt);
- strftime(stamp, PATH_MAX, "%d %b %Y %H:%M:%S", &lt);
- log("mysql stopped : %s\n\n", stamp);
-
- // free args
- free_args(&al);
-}
-
-/******************************************************************************
-
- main()
-
-******************************************************************************/
-int main(int argc, char **argv)
-{
- char temp[PATH_MAX];
-
- // get the options
- get_options(argc, argv);
-
- // keep the screen up
- if (!autoclose)
- setscreenmode(SCR_NO_MODE);
-
- // create log file
- log_fd= fopen(safe_log, "w+");
-
- // header
- log("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-
- // status
- log("address : %s\n", address);
- log("port : %s\n", port);
- log("daemon : %s\n", mysqld);
- log("base directory : %s\n", basedir);
- log("data directory : %s\n", datadir);
- log("pid file : %s\n", pid_file);
- log("error file : %s\n", err_log);
- log("log file : %s\n", safe_log);
- log("\n");
-
- // check setup
- check_setup();
-
- // start the MySQL server
- mysql_start(argc, argv);
-
- // close log file
- if (log_fd)
- fclose(log_fd);
-
- return 0;
-}
diff --git a/netware/mysqld_safe.def b/netware/mysqld_safe.def
deleted file mode 100644
index 5c436cc97ca..00000000000
--- a/netware/mysqld_safe.def
+++ /dev/null
@@ -1,13 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQLd Safe
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Database Server"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Database Server Monitor"
-VERSION 4, 0
-STACKSIZE 131072
-MULTIPLE
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqldump.def b/netware/mysqldump.def
deleted file mode 100644
index 2e745492cf3..00000000000
--- a/netware/mysqldump.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Admin
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Dump Tool[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Dump Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqlimport.def b/netware/mysqlimport.def
deleted file mode 100644
index 5db6b940ce7..00000000000
--- a/netware/mysqlimport.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Client
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Import[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Import Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqlshow.def b/netware/mysqlshow.def
deleted file mode 100644
index 386cb98c091..00000000000
--- a/netware/mysqlshow.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Show
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Show[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Show Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqlslap.def b/netware/mysqlslap.def
deleted file mode 100644
index be10f9db192..00000000000
--- a/netware/mysqlslap.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Slap
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL Slap[scrollable]"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Slap Tool"
-VERSION 4, 0
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/mysqltest.def b/netware/mysqltest.def
deleted file mode 100644
index f0ee5f7e6a4..00000000000
--- a/netware/mysqltest.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# MySQL Admin
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Test Case Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/perror.def b/netware/perror.def
deleted file mode 100644
index fc95de3476a..00000000000
--- a/netware/perror.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# PERROR
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Error Code Description Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/replace.def b/netware/replace.def
deleted file mode 100644
index 7feccdbff41..00000000000
--- a/netware/replace.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# Replace
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Text Replacement Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/resolve_stack_dump.def b/netware/resolve_stack_dump.def
deleted file mode 100644
index 20098c1b4e0..00000000000
--- a/netware/resolve_stack_dump.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# Resolve Stack Dump
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-#SCREENNAME "MySQL Stack Dump Resolve Tool"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL Stack Dump Resolve Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/resolveip.def b/netware/resolveip.def
deleted file mode 100644
index 1962d61be53..00000000000
--- a/netware/resolveip.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# Resolve IP
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL IP/Hostname Resolve Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/static_init_db.sql b/netware/static_init_db.sql
deleted file mode 100644
index e9fb92f4a97..00000000000
--- a/netware/static_init_db.sql
+++ /dev/null
@@ -1,34 +0,0 @@
-CREATE DATABASE mysql;
-CREATE DATABASE test;
-
-USE mysql;
-
-CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges';
-
-INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
-INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
-
-CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db)) comment='Host privileges; Merged with database privileges';
-
-CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges';
-
-INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-
-INSERT INTO user (host,user) values ('localhost','');
-INSERT INTO user (host,user) values ('','');
-
-CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name)) comment='User defined functions';
-
-CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges';
-
-CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) comment='Column privileges';
-
-
-CREATE TABLE help_topic (help_topic_id int unsigned NOT NULL, name varchar(64) NOT NULL, help_category_id smallint unsigned NOT NULL, description text NOT NULL, example text NOT NULL, url varchar(128) NOT NULL, primary key (help_topic_id), unique index (name))comment='help topics';
-
-CREATE TABLE help_category (help_category_id smallint unsigned NOT NULL, name varchar(64) NOT NULL, parent_category_id smallint unsigned null, url varchar(128) NOT NULL, primary key (help_category_id), unique index (name)) comment='help categories';
-
-CREATE TABLE help_keyword (help_keyword_id int unsigned NOT NULL, name varchar(64) NOT NULL, primary key (help_keyword_id), unique index (name)) comment='help keywords';
-
-CREATE TABLE help_relation (help_topic_id int unsigned NOT NULL references help_topic, help_keyword_id int unsigned NOT NULL references help_keyword, primary key (help_keyword_id, help_topic_id)) comment='keyword-topic relation';
diff --git a/packaging/WiX/AdminBackground.jpg b/packaging/WiX/AdminBackground.jpg
new file mode 100644
index 00000000000..847dc6cdbed
--- /dev/null
+++ b/packaging/WiX/AdminBackground.jpg
Binary files differ
diff --git a/packaging/WiX/AdminHeader.jpg b/packaging/WiX/AdminHeader.jpg
new file mode 100644
index 00000000000..6e2e33d404f
--- /dev/null
+++ b/packaging/WiX/AdminHeader.jpg
Binary files differ
diff --git a/packaging/WiX/CMakeLists.txt b/packaging/WiX/CMakeLists.txt
new file mode 100644
index 00000000000..8a6a4ae4c41
--- /dev/null
+++ b/packaging/WiX/CMakeLists.txt
@@ -0,0 +1,112 @@
+# Copyright 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
+
+IF(NOT WIN32)
+ RETURN()
+ENDIF()
+
+FIND_PATH(WIX_DIR heat.exe
+ $ENV{WIX_DIR}/bin
+ $ENV{ProgramFiles}/wix/bin
+ "$ENV{ProgramFiles}/Windows Installer XML v3/bin"
+ "$ENV{ProgramFiles}/Windows Installer XML v3.5/bin"
+)
+
+IF(NOT WIX_DIR)
+ IF(NOT _WIX_DIR_CHECKED)
+ SET(_WIX_DIR_CHECKED 1 CACHE INTERNAL "")
+ MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated")
+ ENDIF()
+ RETURN()
+ENDIF()
+
+ADD_SUBDIRECTORY(ca)
+
+# extra.wxs.in needs DATADIR_MYSQL_FILES and DATADIR_PERFORMANCE_SCHEMA_FILES, i.e
+# Wix-compatible file lists for ${builddir}\sql\data\{mysql,performance_schema}
+
+FOREACH(dir mysql performance_schema)
+ FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*)
+ SET(filelist)
+ FOREACH(f ${files})
+ FILE(TO_NATIVE_PATH "${f}" file_native_path)
+ GET_FILENAME_COMPONENT(file_name "${f}" NAME)
+ SET(filelist
+"${filelist}
+<File Id='${file_name}' Source='${file_native_path}'/>")
+ ENDFOREACH()
+ STRING(TOUPPER ${dir} DIR_UPPER)
+ SET(DATADIR_${DIR_UPPER}_FILES "${filelist}")
+ENDFOREACH()
+
+
+FIND_PROGRAM(HEAT_EXECUTABLE heat ${WIX_DIR})
+FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR})
+FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR})
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
+ @ONLY)
+
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(WixWin64 " Win64='yes'")
+ELSE()
+ SET(WixWin64)
+ENDIF()
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in
+ ${CMAKE_CURRENT_BINARY_DIR}/extra.wxs)
+
+IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+ SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
+ENDIF()
+
+# WiX wants the license text as rtf; if there is no rtf license,
+# we create a fake one from the plain text COPYING file.
+IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf")
+ MESSAGE("copying COPYING.rtf")
+ FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf" CONTENTS)
+ FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}")
+ELSE()
+ MESSAGE("creating COPYING.rtf")
+ FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING" CONTENTS)
+ STRING(REGEX REPLACE "\n" "\\\\par\n" CONTENTS "${CONTENTS}")
+ STRING(REGEX REPLACE "\t" "\\\\tab" CONTENTS "${CONTENTS}")
+ FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs15")
+ FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}")
+ FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "\n}\n")
+ENDIF()
+
+ADD_CUSTOM_TARGET(
+ MSI
+ COMMAND set VS_UNICODE_OUTPUT=
+ COMMAND ${CMAKE_COMMAND}
+ -DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
+ -DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
+ ${CONFIG_PARAM}
+ -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
+)
+ADD_DEPENDENCIES(MSI wixca)
+
+ADD_CUSTOM_TARGET(
+ MSI_ESSENTIALS
+ COMMAND set VS_UNICODE_OUTPUT=
+ COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1
+ -DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
+ -DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
+ ${CONFIG_PARAM}
+ -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
+)
+ADD_DEPENDENCIES(MSI wixca)
+
diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake
new file mode 100644
index 00000000000..0413b699fc5
--- /dev/null
+++ b/packaging/WiX/CPackWixConfig.cmake
@@ -0,0 +1,105 @@
+
+IF(ESSENTIALS)
+ MESSAGE("Essentials!")
+ SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles")
+ SET(CPACK_WIX_UI "WixUI_InstallDir")
+ IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
+ SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-winx64")
+ ELSE()
+ SET(CPACK_PACKAGE_FILE_NAME "mysql-essential-${VERSION}-win32")
+ ENDIF()
+ELSE()
+ SET(CPACK_COMPONENTS_USED
+ "Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries")
+ENDIF()
+
+
+# Some components like Embedded are optional
+# We will build MSI without embedded if it was not selected for build
+#(need to modify CPACK_COMPONENTS_ALL for that)
+SET(CPACK_ALL)
+FOREACH(comp1 ${CPACK_COMPONENTS_USED})
+ SET(found)
+ FOREACH(comp2 ${CPACK_COMPONENTS_ALL})
+ IF(comp1 STREQUAL comp2)
+ SET(found 1)
+ BREAK()
+ ENDIF()
+ ENDFOREACH()
+ IF(found)
+ SET(CPACK_ALL ${CPACK_ALL} ${comp1})
+ ENDIF()
+ENDFOREACH()
+SET(CPACK_COMPONENTS_ALL ${CPACK_ALL})
+
+# Always install (hidden), includes Readme files
+SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1)
+SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall")
+
+# Feature MySQL Server
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MySQL Server")
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1")
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server")
+ # Subfeature "Server" (hidden)
+ SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_SERVER_HIDDEN 1)
+ # Subfeature "Client"
+ SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
+ SET(CPACK_COMPONENT_CLIENT_DESCRIPTION
+ "Various helpful (commandline) tools including the mysql command line client" )
+ # Subfeature "Debug binaries"
+ SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
+ "Debug/trace versions of executables and libraries" )
+ #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
+
+
+ #Subfeature "Data Files"
+ SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
+ SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
+
+
+#Feature "Devel"
+SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
+SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
+ #Subfeature "Development"
+ SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel")
+ SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1)
+
+ #Subfeature "Shared libraries"
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel")
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)")
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library")
+
+ #Subfeature "Embedded"
+ SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel")
+ SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library")
+ SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library")
+ SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2)
+
+#Feature Debug Symbols
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols")
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols")
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_WIX_LEVEL 2)
+ SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols")
+ SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1)
+
+#Feature Documentation
+SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
+SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation")
+SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2)
+
+#Feature tests
+SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests")
+SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)")
+SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2)
+
+
+#Feature Misc (hidden, installs only if everything is installed)
+SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1)
+SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100)
+ SET(CPACK_COMPONENT_INIFILES_GROUP "Misc")
+ SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc")
diff --git a/packaging/WiX/MySQLServer.ico b/packaging/WiX/MySQLServer.ico
new file mode 100644
index 00000000000..a471afcda95
--- /dev/null
+++ b/packaging/WiX/MySQLServer.ico
Binary files differ
diff --git a/packaging/WiX/ca/CMakeLists.txt b/packaging/WiX/ca/CMakeLists.txt
new file mode 100644
index 00000000000..c74b51284c7
--- /dev/null
+++ b/packaging/WiX/ca/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Copyright 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_DIRECTORIES(${WIX_DIR}/../SDK/inc)
+LINK_DIRECTORIES(${WIX_DIR}/../SDK/lib)
+
+SET(WIXCA_SOURCES CustomAction.cpp CustomAction.rc CustomAction.def)
+
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ LINK_LIBRARIES(wcautil_x64 dutil_x64 msi version)
+ELSE()
+ LINK_LIBRARIES(wcautil dutil msi version)
+ENDIF()
+
+ADD_LIBRARY(wixca SHARED ${WIXCA_SOURCES})
diff --git a/packaging/WiX/ca/CustomAction.cpp b/packaging/WiX/ca/CustomAction.cpp
new file mode 100644
index 00000000000..806535bc79a
--- /dev/null
+++ b/packaging/WiX/ca/CustomAction.cpp
@@ -0,0 +1,188 @@
+/* Copyright 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef UNICODE
+#define UNICODE
+#endif
+
+#include <windows.h>
+#include <winreg.h>
+#include <msi.h>
+#include <msiquery.h>
+#include <wcautil.h>
+#include <string.h>
+#include <strsafe.h>
+
+/*
+ * Search the registry for a service whose ImagePath starts
+ * with our install directory. Stop and remove it if requested.
+ */
+static TCHAR last_service_name[128];
+int remove_service(TCHAR *installdir, int check_only) {
+ HKEY hKey;
+ int done = 0;
+
+ if(wcslen(installdir) < 3) {
+ WcaLog(LOGMSG_STANDARD, "INSTALLDIR is suspiciously short, better not do anything.");
+ return 0;
+ }
+
+ if(check_only == 0) {
+ WcaLog(LOGMSG_STANDARD, "Determining number of matching services...");
+ int servicecount = remove_service(installdir, 1);
+ if(servicecount <= 0) {
+ WcaLog(LOGMSG_STANDARD, "No services found, not removing anything.");
+ return 0;
+ } else if(servicecount == 1) {
+ TCHAR buf[256];
+ swprintf_s(buf, sizeof(buf), TEXT("There is a service called '%ls' set up to run from this installation. Do you wish me to stop and remove that service?"), last_service_name);
+ int rc = MessageBox(NULL, buf, TEXT("Removing MySQL Server"), MB_ICONQUESTION|MB_YESNOCANCEL|MB_SYSTEMMODAL);
+ if(rc == IDCANCEL) return -1;
+ if(rc != IDYES) return 0;
+ } else if(servicecount > 0) {
+ TCHAR buf[256];
+ swprintf_s(buf, sizeof(buf), TEXT("There appear to be %d services set up to run from this installation. Do you wish me to stop and remove those services?"), servicecount);
+ int rc = MessageBox(NULL, buf, TEXT("Removing MySQL Server"), MB_ICONQUESTION|MB_YESNOCANCEL|MB_SYSTEMMODAL);
+ if(rc == IDCANCEL) return -1;
+ if(rc != IDYES) return 0;
+ }
+ }
+
+ if(check_only == -1) check_only = 0;
+
+ WcaLog(LOGMSG_STANDARD, "Looking for service...");
+ WcaLog(LOGMSG_STANDARD, "INSTALLDIR = %ls", installdir);
+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\services"), 0, KEY_READ, &hKey)==ERROR_SUCCESS) {
+ DWORD index = 0;
+ TCHAR keyname[1024];
+ DWORD keylen = sizeof(keyname);
+ FILETIME t;
+ /* Go through all services in the registry */
+ while(RegEnumKeyExW(hKey, index, keyname, &keylen, NULL, NULL, NULL, &t) == ERROR_SUCCESS) {
+ HKEY hServiceKey = 0;
+ TCHAR path[1024];
+ DWORD pathlen = sizeof(path)-1;
+ if (RegOpenKeyExW(hKey, keyname, NULL, KEY_READ, &hServiceKey) == ERROR_SUCCESS) {
+ /* Look at the ImagePath value of each service */
+ if (RegQueryValueExW(hServiceKey, TEXT("ImagePath"), NULL, NULL, (LPBYTE)path, &pathlen) == ERROR_SUCCESS) {
+ path[pathlen] = 0;
+ TCHAR *p = path;
+ if(p[0] == '"') p += 1;
+ /* See if it is similar to our install directory */
+ if(wcsncmp(p, installdir, wcslen(installdir)) == 0) {
+ WcaLog(LOGMSG_STANDARD, "Found service '%ls' with ImagePath '%ls'.", keyname, path);
+ swprintf_s(last_service_name, sizeof(last_service_name), TEXT("%ls"), keyname);
+ /* If we are supposed to stop and remove the service... */
+ if(!check_only) {
+ WcaLog(LOGMSG_STANDARD, "Trying to stop the service.");
+ SC_HANDLE hSCM = NULL;
+ hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
+ if(hSCM != NULL) {
+ SC_HANDLE hService = NULL;
+ hService = OpenService(hSCM, keyname, SERVICE_STOP|SERVICE_QUERY_STATUS|DELETE);
+ if(hService != NULL) {
+ WcaLog(LOGMSG_STANDARD, "Waiting for the service to stop...");
+ SERVICE_STATUS status;
+ /* Attempt to stop the service */
+ if(ControlService(hService, SERVICE_CONTROL_STOP, &status)) {
+ /* Now wait until it's stopped */
+ while("it's one big, mean and cruel world out there") {
+ if(!QueryServiceStatus(hService, &status)) break;
+ if(status.dwCurrentState == SERVICE_STOPPED) break;
+ Sleep(1000);
+ }
+ WcaLog(LOGMSG_STANDARD, "Stopped the service.");
+ }
+ /* Mark the service for deletion */
+ DeleteService(hService);
+ CloseServiceHandle(hService);
+ }
+ CloseServiceHandle(hSCM);
+ }
+ }
+ done++;
+ }
+ }
+ RegCloseKey(hServiceKey);
+ }
+ index++;
+ keylen = sizeof(keyname)-1;
+ }
+ RegCloseKey(hKey);
+ } else {
+ WcaLog(LOGMSG_STANDARD, "Can't seem to go through the list of installed services in the registry.");
+ }
+ return done;
+}
+
+UINT wrap(MSIHANDLE hInstall, char *name, int check_only) {
+ HRESULT hr = S_OK;
+ UINT er = ERROR_SUCCESS;
+
+ hr = WcaInitialize(hInstall, name);
+ ExitOnFailure(hr, "Failed to initialize");
+
+ WcaLog(LOGMSG_STANDARD, "Initialized.");
+
+ TCHAR INSTALLDIR[1024];
+ DWORD INSTALLDIR_size = sizeof(INSTALLDIR);
+ if(MsiGetPropertyW(hInstall, TEXT("CustomActionData"), INSTALLDIR, &INSTALLDIR_size) == ERROR_SUCCESS) {
+ int rc = remove_service(INSTALLDIR, check_only);
+ if(rc < 0) {
+ er = ERROR_CANCELLED;
+ }
+ } else {
+ er = ERROR_CANT_ACCESS_FILE;
+ }
+
+LExit:
+ return WcaFinalize(er);
+}
+
+UINT __stdcall RemoveServiceNoninteractive(MSIHANDLE hInstall)
+{
+ return wrap(hInstall, "RemoveServiceNoninteractive", -1);
+}
+
+UINT __stdcall RemoveService(MSIHANDLE hInstall)
+{
+ return wrap(hInstall, "RemoveService", 0);
+}
+
+UINT __stdcall TestService(MSIHANDLE hInstall)
+{
+ return wrap(hInstall, "TestService", 1);
+}
+
+/* DllMain - Initialize and cleanup WiX custom action utils */
+extern "C" BOOL WINAPI DllMain(
+ __in HINSTANCE hInst,
+ __in ULONG ulReason,
+ __in LPVOID
+ )
+{
+ switch(ulReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ WcaGlobalInitialize(hInst);
+ break;
+
+ case DLL_PROCESS_DETACH:
+ WcaGlobalFinalize();
+ break;
+ }
+
+ return TRUE;
+}
diff --git a/packaging/WiX/ca/CustomAction.def b/packaging/WiX/ca/CustomAction.def
new file mode 100644
index 00000000000..5f5e6630013
--- /dev/null
+++ b/packaging/WiX/ca/CustomAction.def
@@ -0,0 +1,8 @@
+LIBRARY "wixca"
+VERSION 1.0
+
+EXPORTS
+
+RemoveService
+RemoveServiceNoninteractive
+TestService
diff --git a/packaging/WiX/ca/CustomAction.rc b/packaging/WiX/ca/CustomAction.rc
new file mode 100644
index 00000000000..3f37126ee77
--- /dev/null
+++ b/packaging/WiX/ca/CustomAction.rc
@@ -0,0 +1,18 @@
+#include "afxres.h"
+#undef APSTUDIO_READONLY_SYMBOLS
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+END
+
diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in
new file mode 100644
index 00000000000..d6725e9ae6c
--- /dev/null
+++ b/packaging/WiX/create_msi.cmake.in
@@ -0,0 +1,312 @@
+SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
+SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
+SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@")
+SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@")
+SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
+SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
+SET(VERSION "@VERSION@")
+SET(MAJOR_VERSION "@MAJOR_VERSION@")
+SET(MINOR_VERSION "@MINOR_VERSION@")
+SET(PATCH "@PATCH@")
+SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
+SET(MANUFACTURER "@MANUFACTURER@")
+
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(Win64 " Win64='yes'")
+ SET(Platform x64)
+ SET(PlatformProgramFilesFolder ProgramFiles64Folder)
+ELSE()
+ SET(Platform x86)
+ SET(PlatformProgramFilesFolder ProgramFilesFolder)
+ SET(Win64)
+ENDIF()
+
+SET(ENV{VS_UNICODE_OUTPUT})
+
+INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
+
+IF(CPACK_WIX_CONFIG)
+ INCLUDE(${CPACK_WIX_CONFIG})
+ENDIF()
+
+IF(NOT CPACK_WIX_UI)
+ SET(CPACK_WIX_UI "WixUI_Mondo")
+ENDIF()
+
+SET(WIX_FEATURES)
+FOREACH(comp ${CPACK_COMPONENTS_ALL})
+ STRING(TOUPPER "${comp}" comp_upper)
+ IF(NOT CPACK_COMPONENT_${comp_upper}_GROUP)
+ SET(WIX_FEATURE_${comp_upper}_COMPONENTS "${comp}")
+ SET(CPACK_COMPONENT_${comp_upper}_HIDDEN 1)
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_DISPLAY_NAME ${CPACK_COMPONENT_${comp_upper}_DISPLAY_NAME})
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_DESCRIPTION ${CPACK_COMPONENT_${comp_upper}_DESCRIPTION})
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_WIX_LEVEL ${CPACK_COMPONENT_${comp_upper}_WIX_LEVEL})
+ SET(WIX_FEATURES ${WIX_FEATURES} WIX_FEATURE_${comp_upper})
+ ELSE()
+ SET(FEATURE_NAME WIX_FEATURE_${CPACK_COMPONENT_${comp_upper}_GROUP})
+ SET(WIX_FEATURES ${WIX_FEATURES} ${FEATURE_NAME})
+ LIST(APPEND ${FEATURE_NAME}_COMPONENTS ${comp})
+ ENDIF()
+ENDFOREACH()
+
+LIST(REMOVE_DUPLICATES WIX_FEATURES)
+
+SET(CPACK_WIX_FEATURES)
+
+FOREACH(f ${WIX_FEATURES})
+ STRING(TOUPPER "${f}" f_upper)
+ STRING(REPLACE "WIX_FEATURE_" "" f_upper ${f_upper})
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ ENDIF()
+
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ ENDIF()
+ IF(CPACK_COMPONENT_${f_upper}_WIX_LEVEL)
+ SET(Level ${CPACK_COMPONENT_${f_upper}_WIX_LEVEL})
+ ELSE()
+ SET(Level 1)
+ ENDIF()
+ IF(CPACK_COMPONENT_GROUP_${f_upper}_HIDDEN)
+ SET(DISPLAY "Display='hidden'")
+ SET(TITLE ${f_upper})
+ SET(DESCRIPTION ${f_upper})
+ ELSE()
+ SET(DISPLAY)
+ IF(CPACK_COMPONENT_GROUP_${f_upper}_EXPANDED)
+ SET(DISPLAY "Display='expand'")
+ ENDIF()
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ ENDIF()
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ ENDIF()
+ ENDIF()
+
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <Feature Id='${f_upper}'
+ Title='${TITLE}'
+ Description='${DESCRIPTION}'
+ ConfigurableDirectory='INSTALLDIR'
+ Level='${Level}' ${DISPLAY} >"
+ )
+ FOREACH(c ${${f}_COMPONENTS})
+ STRING(TOUPPER "${c}" c_upper)
+ IF (CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_${c_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
+ ENDIF()
+
+ IF (CPACK_COMPONENT_${c_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_${c_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_${c_upper}_DESCRIPTION)
+ ENDIF()
+ IF(CPACK_COMPONENT_${c_upper}_WIX_LEVEL)
+ SET(Level ${CPACK_COMPONENT_${c_upper}_WIX_LEVEL})
+ ELSE()
+ SET(Level 1)
+ ENDIF()
+ IF(CPACK_COMPONENT_${c_upper}_HIDDEN)
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <ComponentGroupRef Id='componentgroup.${c}'/>")
+ ELSE()
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <Feature Id='${c}'
+ Title='${TITLE}'
+ Description='${DESCRIPTION}'
+ ConfigurableDirectory='INSTALLDIR'
+ Level='${Level}'>
+ <ComponentGroupRef Id='componentgroup.${c}'/>
+ </Feature>")
+ ENDIF()
+
+ ENDFOREACH()
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ </Feature>
+ ")
+ENDFOREACH()
+
+
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
+
+
+IF(CMAKE_INSTALL_CONFIG_NAME)
+ SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
+ENDIF()
+
+FOREACH(comp ${CPACK_COMPONENTS_ALL})
+ SET(ENV{DESTDIR} testinstall/${comp})
+ SET(DIRS ${DIRS} testinstall/${comp})
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -DCMAKE_INSTALL_COMPONENT=${comp}
+ -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_QUIET
+ )
+ENDFOREACH()
+
+MACRO(GENERATE_GUID VarName)
+ EXECUTE_PROCESS(COMMAND uuidgen -c
+ OUTPUT_VARIABLE ${VarName}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDMACRO()
+
+SET(INC_VAR 0)
+MACRO(MAKE_WIX_IDENTIFIER str varname)
+ STRING(REPLACE "/" "." ${varname} "${str}")
+ STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
+ STRING(LENGTH "${${varname}}" len)
+ # Identifier should be smaller than 72 character
+ # We have to cut down the length to 70 chars, since we add 2 char prefix
+ # pretty often
+ IF(len GREATER 70)
+ STRING(SUBSTRING "${${varname}}" 0 67 shortstr)
+ MATH(EXPR INC_VAR ${INC_VAR}+1)
+ SET(${varname} "${shortstr}${INC_VAR}")
+ ENDIF()
+ENDMACRO()
+
+
+FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
+ FILE(GLOB all_files ${dir}/*)
+ IF(NOT all_files)
+ RETURN()
+ ENDIF()
+ FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
+ IF(dir_rel)
+ MAKE_DIRECTORY(${dir_root}/${dir_rel})
+ MAKE_WIX_IDENTIFIER("${dir_rel}" id)
+ SET(DirectoryRefId "D.${id}")
+ ELSE()
+ SET(DirectoryRefId "INSTALLDIR")
+ ENDIF()
+ FILE(APPEND ${file} "<DirectoryRef Id='${DirectoryRefId}'>\n")
+
+ SET(NONEXEFILES)
+ FOREACH(f ${all_files})
+ IF(NOT IS_DIRECTORY ${f})
+ FILE(RELATIVE_PATH rel ${topdir} ${f})
+ MAKE_WIX_IDENTIFIER("${rel}" id)
+ FILE(TO_NATIVE_PATH ${f} f_native)
+ GET_FILENAME_COMPONENT(f_ext "${f}" EXT)
+ # According to MSDN each DLL or EXE should be in the own component
+ IF(f_ext MATCHES ".exe" OR f_ext MATCHES ".dll")
+
+ FILE(APPEND ${file} " <Component Id='C.${id}' Guid='*' ${Win64}>\n")
+ FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n")
+ FILE(APPEND ${file} " </Component>\n")
+ FILE(APPEND ${file_comp} " <ComponentRef Id='C.${id}'/>\n")
+ ELSE()
+ SET(NONEXEFILES "${NONEXEFILES}\n<File Id='F.${id}' Source='${f_native}'/>" )
+ ENDIF()
+ ENDIF()
+ ENDFOREACH()
+ FILE(APPEND ${file} "</DirectoryRef>\n")
+ IF(NONEXEFILES)
+ GENERATE_GUID(guid)
+ SET(ComponentId "C._files_${COMP_NAME}.${DirectoryRefId}")
+ FILE(APPEND ${file}
+ "<DirectoryRef Id='${DirectoryRefId}'>\n<Component Guid='${guid}' Id='${ComponentId}' ${Win64}>${NONEXEFILES}\n</Component></DirectoryRef>\n")
+ FILE(APPEND ${file_comp} " <ComponentRef Id='${ComponentId}'/>\n")
+ ENDIF()
+ FOREACH(f ${all_files})
+ IF(IS_DIRECTORY ${f})
+ TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${dir_root})
+ ENDIF()
+ ENDFOREACH()
+ENDFUNCTION()
+
+FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
+ FILE(RELATIVE_PATH rel ${topdir} ${dir})
+ IF(rel AND IS_DIRECTORY "${f}")
+ MAKE_WIX_IDENTIFIER("${rel}" id)
+ GET_FILENAME_COMPONENT(name ${dir} NAME)
+ FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n")
+ ENDIF()
+ FILE(GLOB all_files ${dir}/*)
+ FOREACH(f ${all_files})
+ IF(IS_DIRECTORY ${f})
+ TRAVERSE_DIRECTORIES(${f} ${topdir} ${file} "${prefix} ")
+ ENDIF()
+ ENDFOREACH()
+ IF(rel AND IS_DIRECTORY "${f}")
+ FILE(APPEND ${file} "${prefix}</Directory>\n")
+ ENDIF()
+ENDFUNCTION()
+
+SET(CPACK_WIX_COMPONENTS)
+SET(CPACK_WIX_COMPONENT_GROUPS)
+GET_FILENAME_COMPONENT(abs . ABSOLUTE)
+FOREACH(d ${DIRS})
+ GET_FILENAME_COMPONENT(d ${d} ABSOLUTE)
+ GET_FILENAME_COMPONENT(d_name ${d} NAME)
+ FILE(WRITE ${abs}/${d_name}_component_group.wxs "<ComponentGroup Id='componentgroup.${d_name}'>")
+ SET(COMP_NAME ${d_name})
+ TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs")
+ FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>")
+ FILE(READ ${d_name}.wxs WIX_TMP)
+ SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
+ FILE(REMOVE ${d_name}.wxs)
+ FILE(READ ${d_name}_component_group.wxs WIX_TMP)
+
+ SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}")
+ FILE(REMOVE ${d_name}_component_group.wxs)
+ENDFOREACH()
+
+FILE(WRITE directories.wxs "<DirectoryRef Id='INSTALLDIR'>\n")
+TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "")
+FILE(APPEND directories.wxs "</DirectoryRef>\n")
+
+FILE(READ directories.wxs CPACK_WIX_DIRECTORIES)
+FILE(REMOVE directories.wxs)
+
+
+FOREACH(src ${CPACK_WIX_INCLUDE})
+SET(CPACK_WIX_INCLUDES
+"${CPACK_WIX_INCLUDES}
+ <?include ${src}?>"
+)
+ENDFOREACH()
+
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
+
+SET(EXTRA_CANDLE_ARGS)
+IF("$ENV{EXTRA_CANDLE_ARGS}")
+ SET(EXTRA_CANDLE_ARGS "$ENV{EXTRA_CANDLE_ARGS}")
+ENDIF()
+
+SET(EXTRA_LIGHT_ARGS)
+IF("$ENV{EXTRA_LIGHT_ARGS}")
+ SET(EXTRA_LIGHT_ARGS "$ENV{EXTRA_LIGHT_ARGS}")
+ENDIF()
+
+FILE(REMOVE mysql_server.wixobj)
+EXECUTE_PROCESS(
+ COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs ${EXTRA_CANDLE_ARGS}
+)
+EXECUTE_PROCESS(
+ COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
+ mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
+ ${EXTRA_LIGHT_ARGS}
+)
+
diff --git a/packaging/WiX/extra.wxs.in b/packaging/WiX/extra.wxs.in
new file mode 100644
index 00000000000..b6c42136129
--- /dev/null
+++ b/packaging/WiX/extra.wxs.in
@@ -0,0 +1,60 @@
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+
+ <!-- Datafiles that installation will copy to CommonAppData (initial database)
+ They are declared Permanent and NeverOverwrite since it is user data -->
+ <DirectoryRef Id='TARGETDIR'>
+ <Directory Id="CommonAppDataFolder">
+ <Directory Id="datadir.mysql" Name="MySQL">
+ <Directory Id="datadir.mysql.mysqlserver"
+ Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@">
+ <Directory Id="DATADIR" Name=".">
+ <Component Id="component.datadir" Guid="d3491319-5dbc-4477-95f3-4f809ef1dd2d">
+ <CreateFolder>
+ <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
+ </CreateFolder>
+ </Component>
+ <Directory Id="datadir.mysql.mysqlserver.data" Name="data">
+ <Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql">
+ <Component Id="component.datadir.mysql"
+ Guid="19ec0f1f-1a7f-424e-a788-b09346c0a709"
+ Permanent="yes" NeverOverwrite="yes">
+ <CreateFolder>
+ <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
+ </CreateFolder>
+ @DATADIR_MYSQL_FILES@
+ </Component>
+ </Directory>
+ <Directory Id="datadir.mysql.mysqlserver.data.performance_schema"
+ Name="performance_schema">
+ <Component Id="component.datadir.performance_schema"
+ Guid="af2a6776-2655-431f-a748-9e9f4645acc3"
+ Permanent="yes" NeverOverwrite="yes">
+ <CreateFolder>
+ <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
+ </CreateFolder>
+ @DATADIR_PERFORMANCE_SCHEMA_FILES@
+ </Component>
+ </Directory>
+ <Directory Id="datadir.mysql.mysqlserver.data.test" Name="test">
+ <Component Id="component.datadir.test" Guid="52fa9f0a-fcd1-420a-b2ac-95a8f70ad20a">
+ <CreateFolder/>
+ </Component>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+ </DirectoryRef>
+
+ <Feature Id="UserEditableDatafiles" Level='1' Display='hidden' ConfigurableDirectory="DATADIR">
+ <ComponentRef Id="component.datadir"/>
+ <ComponentRef Id="component.datadir.mysql"/>
+ <ComponentRef Id="component.datadir.performance_schema"/>
+ <ComponentRef Id="component.datadir.test"/>
+ </Feature>
+</Include>
+
+
+
diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in
new file mode 100644
index 00000000000..8b20644e58d
--- /dev/null
+++ b/packaging/WiX/mysql_server.wxs.in
@@ -0,0 +1,114 @@
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <Product
+ Id="*"
+ UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
+ Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"
+ Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
+ Language="1033"
+ Manufacturer="@MANUFACTURER@">
+
+ <Package Id='*'
+ Keywords='Installer'
+ Description="MySQL Database Server"
+ Manufacturer='@MANUFACTURER@'
+ InstallerVersion='200'
+ Languages='1033'
+ Compressed='yes'
+ SummaryCodepage='1252'
+ Platform='@Platform@'/>
+
+ <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
+
+ <!-- Upgrade -->
+ <Upgrade Id="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3">
+ <UpgradeVersion
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
+ IncludeMinimum="yes"
+ Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
+ Property="OLDERVERSIONBEINGUPGRADED" />
+ <UpgradeVersion
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
+ OnlyDetect="yes"
+ Property="NEWERVERSIONDETECTED" />
+ </Upgrade>
+ <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
+ NOT NEWERVERSIONDETECTED OR Installed
+ </Condition>
+ <InstallExecuteSequence>
+ <RemoveExistingProducts After="InstallInitialize"/>
+ </InstallExecuteSequence>
+
+
+ <!-- UI -->
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
+ <UIRef Id="@CPACK_WIX_UI@" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+ <WixVariable
+ Id="WixUIBannerBmp"
+ Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
+ <WixVariable
+ Id="WixUIDialogBmp"
+ Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
+ <Icon
+ Id="icon.ico"
+ SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/>
+ <Property
+ Id="ARPPRODUCTICON"
+ Value="icon.ico" />
+
+ <!-- License -->
+ <WixVariable
+ Id="WixUILicenseRtf"
+ Value="@CMAKE_CURRENT_BINARY_DIR@/COPYING.rtf"/>
+
+ <!-- How to remove the service on uninstall -->
+ <Binary Id='wixca.dll' SourceFile='@CMAKE_CURRENT_BINARY_DIR@/ca/RelWithDebInfo/wixca.dll' />
+ <CustomAction Id="UnregisterProperty" Property="UnregisterService" Value="[INSTALLDIR]" Return="check" />
+ <CustomAction Id="UnregisterPropertySilent" Property="UnregisterServiceSilently" Value="[INSTALLDIR]" Return="check" />
+ <CustomAction Id="UnregisterService"
+ BinaryKey="wixca.dll"
+ DllEntry="RemoveService"
+ Execute="deferred"
+ Impersonate="no"
+ Return="check" />
+ <CustomAction Id="UnregisterServiceSilently"
+ BinaryKey="wixca.dll"
+ DllEntry="RemoveServiceNoninteractive"
+ Execute="deferred"
+ Impersonate="no"
+ Return="check" />
+ <InstallExecuteSequence>
+ <Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE</Custom>
+ <Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE</Custom>
+ <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And UILevel&gt;2</Custom>
+ <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And UILevel&lt;=2</Custom>
+ </InstallExecuteSequence>
+
+ <!-- Installation root-->
+ <Directory Id='TARGETDIR' Name='SourceDir'>
+ <Directory Id='@PlatformProgramFilesFolder@'>
+ <Directory Id='directory.MySQL' Name='MySQL'>
+ <Directory Id='INSTALLDIR' Name='MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@'>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <!-- CPACK_WIX_FEATURES -->
+ @CPACK_WIX_FEATURES@
+
+ <!-- CPACK_WIX_DIRECTORIES -->
+ @CPACK_WIX_DIRECTORIES@
+
+ <!--CPACK_WIX_COMPONENTS-->
+ @CPACK_WIX_COMPONENTS@
+
+ <!--CPACK_WIX_COMPONENTS_GROUPS -->
+ @CPACK_WIX_COMPONENT_GROUPS@
+
+ <!--CPACK_WIX_INCLUDES -->
+ @CPACK_WIX_INCLUDES@
+ </Product>
+
+</Wix> \ No newline at end of file
diff --git a/plugin/audit_null/CMakeLists.txt b/plugin/audit_null/CMakeLists.txt
index 4e27ae7e0d9..4baa1da35fe 100644
--- a/plugin/audit_null/CMakeLists.txt
+++ b/plugin/audit_null/CMakeLists.txt
@@ -13,4 +13,5 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-MYSQL_ADD_PLUGIN(audit_null audit_null.c MODULE_ONLY)
+MYSQL_ADD_PLUGIN(audit_null audit_null.c
+ MODULE_ONLY MODULE_OUTPUT_NAME "adt_null")
diff --git a/plugin/daemon_example/CMakeLists.txt b/plugin/daemon_example/CMakeLists.txt
index 1c21d57b326..de4310b0244 100644
--- a/plugin/daemon_example/CMakeLists.txt
+++ b/plugin/daemon_example/CMakeLists.txt
@@ -13,4 +13,5 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-MYSQL_ADD_PLUGIN(daemon_example daemon_example.cc MODULE_ONLY)
+MYSQL_ADD_PLUGIN(daemon_example daemon_example.cc
+ MODULE_ONLY MODULE_OUTPUT_NAME "libdaemon_example")
diff --git a/plugin/daemon_example/Makefile.am b/plugin/daemon_example/Makefile.am
index 75151bdd4d9..d60271521b3 100644
--- a/plugin/daemon_example/Makefile.am
+++ b/plugin/daemon_example/Makefile.am
@@ -28,14 +28,14 @@ EXTRA_LTLIBRARIES = libdaemon_example.la
pkgplugin_LTLIBRARIES = @plugin_daemon_example_shared_target@
libdaemon_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
-libdaemon_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libdaemon_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
libdaemon_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
libdaemon_example_la_SOURCES = daemon_example.cc
EXTRA_LIBRARIES = libdaemon_example.a
noinst_LIBRARIES = @plugin_daemon_example_static_target@
-libdaemon_example_a_CXXFLAGS = $(AM_CFLAGS)
+libdaemon_example_a_CXXFLAGS = $(AM_CXXFLAGS)
libdaemon_example_a_CFLAGS = $(AM_CFLAGS)
libdaemon_example_a_SOURCES= daemon_example.cc
EXTRA_DIST = CMakeLists.txt
diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc
index 43138f0655f..9bdacdfeae9 100644
--- a/plugin/daemon_example/daemon_example.cc
+++ b/plugin/daemon_example/daemon_example.cc
@@ -175,7 +175,7 @@ static int daemon_example_plugin_deinit(void *p)
my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
my_close(con->heartbeat_file, MYF(0));
- my_free((char *)con, MYF(0));
+ my_free(con);
DBUG_RETURN(0);
}
diff --git a/plugin/semisync/Makefile.am b/plugin/semisync/Makefile.am
index 0022d600f57..ec1ecee46a2 100644
--- a/plugin/semisync/Makefile.am
+++ b/plugin/semisync/Makefile.am
@@ -26,12 +26,12 @@ noinst_HEADERS = semisync.h semisync_master.h semisync_slave.h
pkgplugin_LTLIBRARIES = semisync_master.la semisync_slave.la
semisync_master_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
-semisync_master_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+semisync_master_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
semisync_master_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
semisync_master_la_SOURCES = semisync.cc semisync_master.cc semisync_master_plugin.cc
semisync_slave_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
-semisync_slave_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+semisync_slave_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
semisync_slave_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
semisync_slave_la_SOURCES = semisync.cc semisync_slave.cc semisync_slave_plugin.cc
diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h
index 1a562e8bb77..dfadf85f271 100644
--- a/plugin/semisync/semisync_master.h
+++ b/plugin/semisync/semisync_master.h
@@ -255,7 +255,7 @@ private:
*/
void free_block(Block *block)
{
- my_free(block, MYF(0));
+ my_free(block);
--block_num;
}
diff --git a/regex/CMakeLists.txt b/regex/CMakeLists.txt
index 02132eefaad..02132eefaad 100755..100644
--- a/regex/CMakeLists.txt
+++ b/regex/CMakeLists.txt
diff --git a/regex/regcomp.c b/regex/regcomp.c
index b203d4941e1..81c435ed552 100644
--- a/regex/regcomp.c
+++ b/regex/regcomp.c
@@ -690,7 +690,6 @@ register cset *cs;
case '-':
SETERROR(REG_ERANGE);
return; /* NOTE RETURN */
- break;
default:
c = '\0';
break;
@@ -1564,13 +1563,13 @@ struct parse *p;
register struct re_guts *g;
{
register sop *scan;
- sop *start;
- register sop *newstart;
+ sop *UNINIT_VAR(start);
+ register sop *UNINIT_VAR(newstart);
register sopno newlen;
register sop s;
register char *cp;
register sopno i;
- LINT_INIT(start); LINT_INIT(newstart);
+
/* avoid making error situations worse */
if (p->error != 0)
return;
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index fc55a2923f2..ced207da98b 100755..100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -77,7 +77,7 @@ INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
${FIX_PRIVILEGES_SQL}
- DESTINATION ${INSTALL_MYSQLSHAREDIR}
+ DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server
)
# TCMalloc hacks
@@ -90,17 +90,17 @@ IF(MALLOC_LIB)
ENDIF()
IF(CMAKE_GENERATOR MATCHES "Makefiles")
- # No multiconfig build - use CMAKE_C_FLAGS
- SET(CFLAGS "@CMAKE_C_FLAGS@")
- SET(CXXFLAGS "@CMAKE_CXX_FLAGS@")
+ # Strip maintainer mode options if necessary
+ STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+ STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES})
SET(CFLAGS "${CFLAGS} -arch ${ARCH}")
SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}")
ENDFOREACH()
ELSE()
- # Multiconfig build - use CMAKE_C_FLAGS_RELWITHDEBINFO
- SET(CFLAGS "@CMAKE_C_FLAGS_RELWITHDEBINFO@")
- SET(CXXFLAGS "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@")
+ # Strip maintainer mode options if necessary
+ STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+ STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
ENDIF()
IF(UNIX)
@@ -140,6 +140,43 @@ ENDIF()
SET(HOSTNAME "hostname")
+# Required for mysqlbug until autotools are deprecated, once done remove these
+# and expand default cmake variables
+SET(CC ${CMAKE_C_COMPILER})
+SET(CXX ${CMAKE_CXX_COMPILER})
+SET(SAVE_CC ${CMAKE_C_COMPILER})
+SET(SAVE_CXX ${CMAKE_CXX_COMPILER})
+SET(SAVE_CFLAGS ${CFLAGS})
+SET(SAVE_CXXFLAGS ${CXXFLAGS})
+# XXX no cmake equivalent for this, just make one up
+SET(CONFIGURE_LINE "Built using CMake")
+
+# Also required for mysqlbug, autoconf only supports --version so for now we
+# just explicitly require GNU
+IF(CMAKE_COMPILER_IS_GNUCC)
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version
+ COMMAND sed 1q
+ OUTPUT_VARIABLE CC_VERSION)
+ELSE()
+ SET(CC_VERSION "")
+ENDIF()
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version
+ COMMAND sed 1q
+ OUTPUT_VARIABLE CXX_VERSION)
+ELSE()
+ SET(CXX_VERSION "")
+ENDIF()
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/mysqlbug ESCAPE_QUOTES @ONLY)
+INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/mysqlbug
+ DESTINATION ${INSTALL_BINDIR}
+ COMPONENT Server
+ )
+
ENDIF(UNIX)
# Really ugly, one script, "mysql_install_db", needs prefix set to ".",
@@ -175,12 +212,10 @@ ELSE()
SET(EXT ".pl")
ENDIF()
-INSTALL(FILES
+INSTALL_SCRIPT(
"${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db${EXT}"
DESTINATION ${DEST}
- PERMISSIONS OWNER_READ OWNER_WRITE
- OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
+ COMPONENT Server
)
@@ -198,9 +233,9 @@ SET(localstatedir ${MYSQL_DATADIR})
# some scripts use @TARGET_LINUX@
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
- SET(TARGET_LINUX 1)
+ SET(TARGET_LINUX "true")
ELSE()
- SET(TARGET_LINUX 0)
+ SET(TARGET_LINUX "false")
ENDIF()
# Use cmake variables to inspect dependencies for
@@ -255,6 +290,7 @@ IF(MSVC)
ENDIF()
SET(NON_THREADED_LIBS ${CLIENT_LIBS})
+SET(mysql_config_COMPONENT COMPONENT Development)
IF(WIN32)
# On Windows, some .sh and some .pl.in files are configured
@@ -268,31 +304,22 @@ IF(WIN32)
mysqlhotcopy)
FOREACH(file ${PLIN_FILES})
+ IF(NOT ${file}_COMPONENT)
+ SET(${file}_COMPONENT Server_Scripts)
+ ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.pl.in
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
-
- INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${file}.pl
- DESTINATION scripts
- PERMISSIONS OWNER_READ OWNER_WRITE
- OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- )
+ INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT ${${file}_COMPONENT})
ENDFOREACH()
FOREACH(file ${SH_FILES})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
- INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${file}.pl
- DESTINATION scripts
- PERMISSIONS OWNER_READ OWNER_WRITE
- OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- )
+ INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT ${${file}_COMPONENT})
ENDFOREACH()
ELSE()
# On Unix, most of the files end up in the bin directory
+ SET(mysql_config_COMPONENT COMPONENT Development)
SET(BIN_SCRIPTS
msql2mysql
mysql_config
@@ -302,7 +329,6 @@ ELSE()
mysql_zap
mysqlaccess
mysqlaccess.conf
- mysqlbug
mysql_convert_table_format
mysql_find_rows
mysqlhotcopy
@@ -321,13 +347,14 @@ ELSE()
MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file} in "
"${CMAKE_CURRENT_SOURCE_DIR}" )
ENDIF()
- INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${file}
- DESTINATION ${INSTALL_BINDIR}
- PERMISSIONS OWNER_READ OWNER_WRITE
- OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- )
+ IF(NOT ${file}_COMPONENT)
+ SET(${file}_COMPONENT Server)
+ ENDIF()
+ INSTALL_SCRIPT(
+ ${CMAKE_CURRENT_BINARY_DIR}/${file}
+ DESTINATION ${INSTALL_BINDIR}
+ COMPONENT ${${file}_COMPONENT}
+ )
ENDFOREACH()
ENDIF()
@@ -342,7 +369,8 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static")
ERROR_QUIET
)
IF(${RESULT} EQUAL 0 AND EXISTS ${LIBGCC_LOCATION})
- INSTALL(FILES "${LIBGCC_LOCATION}" DESTINATION ${INSTALL_LIBDIR})
+ INSTALL(FILES "${LIBGCC_LOCATION}" DESTINATION ${INSTALL_LIBDIR}
+ COMPONENT Development)
ENDIF()
ENDIF()
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index bd0f4f99ca6..951699317fd 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -162,10 +162,6 @@ fi
# Print the platform name for build logs
echo "PLATFORM NAME: $PLATFORM"
-case $PLATFORM in
- *netware*) BASE_SYSTEM="netware" ;;
-esac
-
# Change the distribution to a long descriptive name
# For the cluster product, concentrate on the second part
VERSION_NAME=@VERSION@
@@ -226,316 +222,121 @@ fi
#
##############################################################################
-if [ x"$BASE_SYSTEM" != x"netware" ] ; then
-
- # ----------------------------------------------------------------------
- # Terminate on any base level error
- # ----------------------------------------------------------------------
- set -e
-
- # ----------------------------------------------------------------------
- # Really ugly, one script, "mysql_install_db", needs prefix set to ".",
- # i.e. makes access relative the current directory. This matches
- # the documentation, so better not change this. And for another script,
- # "mysql.server", we make some relative, others not.
- # ----------------------------------------------------------------------
-
- cd scripts
- rm -f mysql_install_db
- @MAKE@ mysql_install_db \
- prefix=. \
- bindir=./bin \
- sbindir=./bin \
- scriptdir=./bin \
- libexecdir=./bin \
- pkgdatadir=./share \
- localstatedir=./data
- cd ..
-
- cd support-files
- rm -f mysql.server
- @MAKE@ mysql.server \
- bindir=./bin \
- sbindir=./bin \
- scriptdir=./bin \
- libexecdir=./bin \
- pkgdatadir=@pkgdatadir@
- cd ..
-
- # ----------------------------------------------------------------------
- # Do a install that we later are to pack. Use the same paths as in
- # the build for the relevant directories.
- # ----------------------------------------------------------------------
- @MAKE@ DESTDIR=$BASE install \
- pkglibdir=@pkglibdir@ \
- pkgincludedir=@pkgincludedir@ \
- pkgdatadir=@pkgdatadir@ \
- pkgplugindir=@pkgplugindir@ \
- pkgsuppdir=@pkgsuppdir@ \
- mandir=@mandir@ \
- infodir=@infodir@
-
- # ----------------------------------------------------------------------
- # Rename top directory, and set DEST to the new directory
- # ----------------------------------------------------------------------
- mv $BASE@prefix@ $BASE/$NEW_NAME
- DEST=$BASE/$NEW_NAME
-
- # ----------------------------------------------------------------------
- # If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a
- # ----------------------------------------------------------------------
- if [ x"@GXX@" = x"yes" ] ; then
- gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true
- if [ -z "$gcclib" ] ; then
- echo "Warning: Compiler doesn't tell libgcc.a!"
- elif [ -f "$gcclib" ] ; then
- $CP $gcclib $DEST/lib/libmygcc.a
- else
- echo "Warning: Compiler result '$gcclib' not found / no file!"
- fi
- fi
-
- # If requested, add a malloc library .so into pkglibdir for use
- # by mysqld_safe
- if [ -n "$MALLOC_LIB" ]; then
- cp "$MALLOC_LIB" "$DEST/lib/"
- fi
-
- # FIXME let this script be in "bin/", where it is in the RPMs?
- # http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html
- mkdir $DEST/scripts
- mv $DEST/bin/mysql_install_db $DEST/scripts/
-
- # Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1
+# ----------------------------------------------------------------------
+# Terminate on any base level error
+# ----------------------------------------------------------------------
+set -e
- # Copy readme and license files
- cp README Docs/INSTALL-BINARY $DEST/
- if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then
- cp COPYING EXCEPTIONS-CLIENT $DEST/
- elif [ -f LICENSE.mysql ] ; then
- cp LICENSE.mysql $DEST/
- else
- echo "ERROR: no license files found"
- exit 1
- fi
+# ----------------------------------------------------------------------
+# Really ugly, one script, "mysql_install_db", needs prefix set to ".",
+# i.e. makes access relative the current directory. This matches
+# the documentation, so better not change this. And for another script,
+# "mysql.server", we make some relative, others not.
+# ----------------------------------------------------------------------
- # FIXME should be handled by make file, and to other dir
- mkdir -p $DEST/bin $DEST/support-files
- cp scripts/mysqlaccess.conf $DEST/bin/
- cp support-files/magic $DEST/support-files/
+cd scripts
+rm -f mysql_install_db
+@MAKE@ mysql_install_db \
+ prefix=. \
+ bindir=./bin \
+ sbindir=./bin \
+ scriptdir=./bin \
+ libexecdir=./bin \
+ pkgdatadir=./share \
+ localstatedir=./data
+cd ..
+
+cd support-files
+rm -f mysql.server
+@MAKE@ mysql.server \
+ bindir=./bin \
+ sbindir=./bin \
+ scriptdir=./bin \
+ libexecdir=./bin \
+ pkgdatadir=@pkgdatadir@
+cd ..
- # Create empty data directories, set permission (FIXME why?)
- mkdir $DEST/data $DEST/data/mysql $DEST/data/test
- chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test
+# ----------------------------------------------------------------------
+# Do a install that we later are to pack. Use the same paths as in
+# the build for the relevant directories.
+# ----------------------------------------------------------------------
+@MAKE@ DESTDIR=$BASE install \
+ pkglibdir=@pkglibdir@ \
+ pkgincludedir=@pkgincludedir@ \
+ pkgdatadir=@pkgdatadir@ \
+ pkgplugindir=@pkgplugindir@ \
+ pkgsuppdir=@pkgsuppdir@ \
+ mandir=@mandir@ \
+ infodir=@infodir@
- # ----------------------------------------------------------------------
- # Create the result tar file
- # ----------------------------------------------------------------------
+# ----------------------------------------------------------------------
+# Rename top directory, and set DEST to the new directory
+# ----------------------------------------------------------------------
+mv $BASE@prefix@ $BASE/$NEW_NAME
+DEST=$BASE/$NEW_NAME
- echo "Using $tar to create archive"
- OPT=cvf
- if [ x$SILENT = x1 ] ; then
- OPT=cf
+# ----------------------------------------------------------------------
+# If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a
+# ----------------------------------------------------------------------
+if [ x"@GXX@" = x"yes" ] ; then
+ gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true
+ if [ -z "$gcclib" ] ; then
+ echo "Warning: Compiler doesn't tell libgcc.a!"
+ elif [ -f "$gcclib" ] ; then
+ $CP $gcclib $DEST/lib/libmygcc.a
+ else
+ echo "Warning: Compiler result '$gcclib' not found / no file!"
fi
-
- echo "Creating and compressing archive"
- rm -f $NEW_NAME.tar.gz
- (cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz
- echo "$NEW_NAME.tar.gz created"
-
- echo "Removing temporary directory"
- rm -rf $BASE
- exit 0
fi
+# If requested, add a malloc library .so into pkglibdir for use
+# by mysqld_safe
+if [ -n "$MALLOC_LIB" ]; then
+ cp "$MALLOC_LIB" "$DEST/lib/"
+fi
-##############################################################################
-#
-# Handle the Netware case, until integrated above
-#
-##############################################################################
+# FIXME let this script be in "bin/", where it is in the RPMs?
+# http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html
+mkdir $DEST/scripts
+mv $DEST/bin/mysql_install_db $DEST/scripts/
-BS=".nlm"
-MYSQL_SHARE=$BASE/share
-
-mkdir $BASE $BASE/bin $BASE/docs \
- $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \
- $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \
- $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib \
- $BASE/mysql-test/suite
-
-# Copy files if they exists, warn for those that don't.
-# Note that when listing files to copy, we might list the file name
-# twice, once in the directory location where it is built, and a
-# second time in the ".libs" location. In the case the first one
-# is a wrapper script, the second one will overwrite it with the
-# binary file.
-copyfileto()
-{
- destdir=$1
- shift
- for i
- do
- if [ -f $i ] ; then
- $CP $i $destdir
- elif [ -d $i ] ; then
- echo "Warning: Will not copy directory \"$i\""
- else
- echo "Warning: Listed file not found \"$i\""
- fi
- done
-}
+# Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1
-copyfileto $BASE/docs ChangeLog Docs/mysql.info
-
-copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY \
- EXCEPTIONS-CLIENT LICENSE.mysql
-
-# Non platform-specific bin dir files:
-BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
- extra/resolveip$BS extra/my_print_defaults$BS \
- extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \
- storage/myisam/myisamchk$BS storage/myisam/myisampack$BS \
- storage/myisam/myisamlog$BS storage/myisam/myisam_ftdump$BS \
- sql/mysqld$BS sql/mysqld-debug$BS \
- sql/mysql_tzinfo_to_sql$BS \
- client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
- client/mysqlslap$BS \
- client/mysqldump$BS client/mysqlimport$BS \
- client/mysqltest$BS client/mysqlcheck$BS \
- client/mysqlbinlog$BS client/mysql_upgrade$BS \
- tests/mysql_client_test$BS \
- libmysqld/examples/mysql_client_test_embedded$BS \
- libmysqld/examples/mysqltest_embedded$BS \
- ";
-
-# Platform-specific bin dir files:
-BIN_FILES="$BIN_FILES \
- netware/mysqld_safe$BS netware/mysql_install_db$BS \
- netware/init_db.sql netware/test_db.sql \
- netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql \
- ";
-
-copyfileto $BASE/bin $BIN_FILES
-
-$CP netware/*.pl $BASE/scripts
-$CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl
-
-copyfileto $BASE/lib \
- libmysql/.libs/libmysqlclient.a \
- libmysql/.libs/libmysqlclient.so* \
- libmysql/.libs/libmysqlclient.sl* \
- libmysql/.libs/libmysqlclient*.dylib \
- libmysql/libmysqlclient.* \
- libmysql_r/.libs/libmysqlclient_r.a \
- libmysql_r/.libs/libmysqlclient_r.so* \
- libmysql_r/.libs/libmysqlclient_r.sl* \
- libmysql_r/.libs/libmysqlclient_r*.dylib \
- libmysql_r/libmysqlclient_r.* \
- libmysqld/.libs/libmysqld.a \
- libmysqld/.libs/libmysqld.so* \
- libmysqld/.libs/libmysqld.sl* \
- libmysqld/.libs/libmysqld*.dylib \
- mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \
- libmysqld/libmysqld.a netware/libmysql.imp \
- zlib/.libs/libz.a
-
-# convert the .a to .lib for NetWare
-for i in $BASE/lib/*.a
-do
- libname=`basename $i .a`
- $MV $i $BASE/lib/$libname.lib
-done
-rm -f $BASE/lib/*.la
-
-
-copyfileto $BASE/include config.h include/*
-
-rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
-
-# In a NetWare binary package, these tools and their manuals are not useful
-rm -f $BASE/man/man1/make_win_*
-
-copyfileto $BASE/support-files support-files/*
-
-copyfileto $BASE/share scripts/*.sql
-
-$CP -r sql/share/* $MYSQL_SHARE
-rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
-
-copyfileto $BASE/mysql-test \
- mysql-test/mysql-test-run mysql-test/install_test_db \
- mysql-test/mysql-test-run.pl mysql-test/README \
- mysql-test/mysql-stress-test.pl \
- mysql-test/valgrind.supp \
- netware/mysql_test_run.nlm netware/install_test_db.ncf
-
-$CP mysql-test/lib/*.pl $BASE/mysql-test/lib
-$CP mysql-test/t/*.def $BASE/mysql-test/t
-$CP mysql-test/include/*.inc $BASE/mysql-test/include
-$CP mysql-test/include/*.sql $BASE/mysql-test/include
-$CP mysql-test/include/*.test $BASE/mysql-test/include
-$CP mysql-test/t/*.def $BASE/mysql-test/t
-$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
- mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \
- mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \
- mysql-test/std_data/Index.xml \
- mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \
- mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \
- $BASE/mysql-test/std_data
-$CP mysql-test/t/*.test mysql-test/t/*.imtest \
- mysql-test/t/*.disabled mysql-test/t/*.opt \
- mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t
-$CP mysql-test/r/*.result mysql-test/r/*.require \
- $BASE/mysql-test/r
-
-# Copy the additional suites "as is", they are in flux
-$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - )
-# Clean up if we did this from a bk tree
-if [ -d mysql-test/SCCS ] ; then
- find $BASE/mysql-test -name SCCS -print | xargs rm -rf
+# Copy readme and license files
+cp README Docs/INSTALL-BINARY $DEST/
+if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then
+ cp COPYING EXCEPTIONS-CLIENT $DEST/
+elif [ -f LICENSE.mysql ] ; then
+ cp LICENSE.mysql $DEST/
+else
+ echo "ERROR: no license files found"
+ exit 1
fi
-rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \
- $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \
- $BASE/bin/make_win_* \
- $BASE/bin/setsomevars $BASE/support-files/Makefile* \
- $BASE/support-files/*.sh
+# FIXME should be handled by make file, and to other dir
+mkdir -p $DEST/bin $DEST/support-files
+cp scripts/mysqlaccess.conf $DEST/bin/
+cp support-files/magic $DEST/support-files/
-#
-# Copy system dependent files
-#
-./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
+# Create empty data directories, set permission (FIXME why?)
+mkdir $DEST/data $DEST/data/mysql $DEST/data/test
+chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test
-#
-# Remove system dependent files
-#
-rm -f $BASE/support-files/magic \
- $BASE/support-files/mysql.server \
- $BASE/support-files/mysql*.spec \
- $BASE/support-files/mysql-log-rotate \
- $BASE/support-files/binary-configure \
- $BASE/support-files/build-tags \
- $BASE/support-files/MySQL-shared-compat.spec \
- $BASE/INSTALL-BINARY
-
-# Clean up if we did this from a bk tree
-if [ -d $BASE/sql-bench/SCCS ] ; then
- find $BASE/share -name SCCS -print | xargs rm -rf
- find $BASE/sql-bench -name SCCS -print | xargs rm -rf
-fi
+# ----------------------------------------------------------------------
+# Create the result tar file
+# ----------------------------------------------------------------------
-BASE2=$TMP/$NEW_NAME
-rm -rf $BASE2
-mv $BASE $BASE2
-BASE=$BASE2
+echo "Using $tar to create archive"
+OPT=cvf
+if [ x$SILENT = x1 ] ; then
+ OPT=cf
+fi
-#
-# Create a zip file for NetWare users
-#
-rm -f $NEW_NAME.zip
-(cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME)
-echo "$NEW_NAME.zip created"
+echo "Creating and compressing archive"
+rm -f $NEW_NAME.tar.gz
+(cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz
+echo "$NEW_NAME.tar.gz created"
echo "Removing temporary directory"
rm -rf $BASE
+exit 0
diff --git a/scripts/mysql_config.pl.in b/scripts/mysql_config.pl.in
index 415c0d3040e..58482691213 100644
--- a/scripts/mysql_config.pl.in
+++ b/scripts/mysql_config.pl.in
@@ -42,8 +42,7 @@ use Cwd;
use strict;
my @exclude_cflags =
- qw/DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX
- DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
+ qw/DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
DEXTRA_DEBUG DHAVE_purify O O[0-9] xO[0-9] W[-A-Za-z]*
Xa xstrconst xc99=none
unroll2 ip mp restrict/;
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index d2699726a25..10755fc698b 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -88,6 +88,8 @@ pkglibdir_rel=`echo $pkglibdir | sed -e "s;^$basedir/;;"`
fix_path pkglibdir $pkglibdir_rel lib/mysql lib
plugindir='@pkgplugindir@'
+plugindir_rel=`echo $plugindir | sed -e "s;^$basedir/;;"`
+fix_path plugindir $plugindir_rel lib/mysql/plugin lib/plugin
pkgincludedir='@pkgincludedir@'
fix_path pkgincludedir include/mysql include
@@ -127,8 +129,7 @@ include="-I$pkgincludedir"
# and -xstrconst to make --cflags usable for Sun Forte C++
# FIXME until we have a --cxxflags, we need to remove -AC99
# to make --cflags usable for HP C++ (aCC)
-for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
- DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
+for remove in DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
Xa xstrconst "xc99=none" AC99 \
diff --git a/scripts/mysql_secure_installation.pl.in b/scripts/mysql_secure_installation.pl.in
index 25339f9b916..0cd99267cdb 100755
--- a/scripts/mysql_secure_installation.pl.in
+++ b/scripts/mysql_secure_installation.pl.in
@@ -208,7 +208,7 @@ sub remove_anonymous_users {
}
sub remove_remote_root {
- if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';")) {
+ if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');")) {
print " ... Success!\n";
} else {
print " ... Failed!\n";
diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh
index 25d6343ee2c..ed789677bf0 100644
--- a/scripts/mysql_secure_installation.sh
+++ b/scripts/mysql_secure_installation.sh
@@ -17,6 +17,7 @@
config=".my.cnf.$$"
command=".mysql.$$"
+mysql_client=""
trap "interrupt" 2
@@ -37,10 +38,26 @@ prepare() {
chmod 600 $config $command
}
+find_mysql_client()
+{
+ for n in ./bin/mysql mysql
+ do
+ $n --no-defaults --help > /dev/null 2>&1
+ status=$?
+ if test $status -eq 0
+ then
+ mysql_client=$n
+ return
+ fi
+ done
+ echo "Can't find a 'mysql' client in PATH or ./bin"
+ exit 1
+}
+
do_query() {
echo "$1" >$command
#sed 's,^,> ,' < $command # Debugging
- mysql --defaults-file=$config <$command
+ $mysql_client --defaults-file=$config <$command
return $?
}
@@ -147,7 +164,7 @@ remove_anonymous_users() {
}
remove_remote_root() {
- do_query "DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';"
+ do_query "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
if [ $? -eq 0 ]; then
echo " ... Success!"
else
@@ -204,6 +221,7 @@ cleanup() {
# The actual script starts here
prepare
+find_mysql_client
set_echo_compat
echo
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 3b6f0cccf20..2020971fb1a 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -69,7 +69,7 @@ ALTER TABLE tables_priv
COLLATE utf8_general_ci DEFAULT '' NOT NULL,
MODIFY Table_priv set('Select','Insert','Update','Delete','Create',
'Drop','Grant','References','Index','Alter',
- 'Create View','Show view')
+ 'Create View','Show view','Trigger')
COLLATE utf8_general_ci DEFAULT '' NOT NULL,
COMMENT='Table privileges';
@@ -603,8 +603,6 @@ ALTER TABLE host MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAU
ALTER TABLE db ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
-ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
-
UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0;
#
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 5d7f0760b82..a537bf27aad 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -413,6 +413,29 @@ else
DATADIR=@localstatedir@
fi
+#
+# Try to find the plugin directory
+#
+
+# Use user-supplied argument
+if [ -n "${PLUGIN_DIR}" ]; then
+ plugin_dir="${PLUGIN_DIR}"
+else
+ # Try to find plugin dir relative to basedir
+ for dir in lib/mysql/plugin lib/plugin
+ do
+ if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
+ plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
+ break
+ fi
+ done
+ # Give up and use compiled-in default
+ if [ -z "${plugin_dir}" ]; then
+ plugin_dir='@pkgplugindir@'
+ fi
+fi
+plugin_dir="${plugin_dir}${PLUGIN_VARIANT}"
+
if test -z "$MYSQL_HOME"
then
if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf"
@@ -704,8 +727,6 @@ fi
cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
-plugin_dir="${PLUGIN_DIR:-$MY_BASEDIR_VERSION/lib/plugin}${PLUGIN_VARIANT}"
-
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
"--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
do
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index aea7a657c9e..a08db77ac56 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -234,10 +234,6 @@ elsif (defined($tgt_name) && ($tgt_name =~ m:/: || $tgt_name eq '.')) {
elsif ( $opt{suffix} ) {
print "Using copy suffix '$opt{suffix}'\n" unless $opt{quiet};
}
-elsif ( ($^O =~ m/^(NetWare)$/) && defined($tgt_name) && ($tgt_name =~ m:\\: || $tgt_name eq '.'))
-{
- $tgt_dirname = $tgt_name;
-}
else
{
$tgt_name="" if (!defined($tgt_name));
@@ -423,11 +419,8 @@ foreach my $rdb ( @db_desc ) {
else {
mkdir($tgt_dirpath, 0750) or die "Can't create '$tgt_dirpath': $!\n"
unless -d $tgt_dirpath;
- if ($^O !~ m/^(NetWare)$/)
- {
- my @f_info= stat "$datadir/$rdb->{src}";
- chown $f_info[4], $f_info[5], $tgt_dirpath;
- }
+ my @f_info= stat "$datadir/$rdb->{src}";
+ chown $f_info[4], $f_info[5], $tgt_dirpath;
}
}
@@ -598,14 +591,7 @@ sub copy_files {
my @cmd;
print "Copying ".@$files." files...\n" unless $opt{quiet};
- if ($^O =~ m/^(NetWare)$/) # on NetWare call PERL copy (slower)
- {
- foreach my $file ( @$files )
- {
- copy($file, $target."/".basename($file));
- }
- }
- elsif ($method =~ /^s?cp\b/) # cp or scp with optional flags
+ if ($method =~ /^s?cp\b/) # cp or scp with optional flags
{
my $cp = $method;
# add option to preserve mod time etc of copied files
diff --git a/sql-common/client.c b/sql-common/client.c
index bb7bd4d2633..f1bdcdc158f 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -80,7 +80,7 @@ my_bool net_flush(NET *net);
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
-#if !defined(MSDOS) && !defined(__WIN__)
+#if !defined(__WIN__)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -91,12 +91,12 @@ my_bool net_flush(NET *net);
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#endif /*!defined(MSDOS) && !defined(__WIN__) */
+#endif /* !defined(__WIN__) */
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
-#if defined(MSDOS) || defined(__WIN__)
+#if defined(__WIN__)
#define perror(A)
#else
#include <errno.h>
@@ -126,7 +126,7 @@ static void mysql_close_free_options(MYSQL *mysql);
static void mysql_close_free(MYSQL *mysql);
static void mysql_prune_stmt_list(MYSQL *mysql);
-#if !(defined(__WIN__) || defined(__NETWARE__))
+#if !defined(__WIN__)
static int wait_for_data(my_socket fd, uint timeout);
#endif
@@ -148,7 +148,7 @@ char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
int my_connect(my_socket fd, const struct sockaddr *name, uint namelen,
uint timeout)
{
-#if defined(__WIN__) || defined(__NETWARE__)
+#if defined(__WIN__)
DBUG_ENTER("my_connect");
DBUG_RETURN(connect(fd, (struct sockaddr*) name, namelen));
#else
@@ -193,7 +193,7 @@ int my_connect(my_socket fd, const struct sockaddr *name, uint namelen,
If not, we will use select()
*/
-#if !(defined(__WIN__) || defined(__NETWARE__))
+#if !defined(__WIN__)
static int wait_for_data(my_socket fd, uint timeout)
{
@@ -316,7 +316,7 @@ static int wait_for_data(my_socket fd, uint timeout)
DBUG_RETURN(0); /* ok */
#endif /* HAVE_POLL */
}
-#endif /* defined(__WIN__) || defined(__NETWARE__) */
+#endif /* !defined(__WIN__) */
/**
Set the internal error message to mysql handler
@@ -688,8 +688,7 @@ err2:
CloseHandle(handle_file_map);
}
err:
- if (tmp)
- my_free(tmp, MYF(0));
+ my_free(tmp);
if (error_allow)
error_code = GetLastError();
if (event_connect_request)
@@ -802,7 +801,7 @@ void free_rows(MYSQL_DATA *cur)
if (cur)
{
free_root(&cur->alloc,MYF(0));
- my_free((uchar*) cur,MYF(0));
+ my_free(cur);
}
}
@@ -1127,9 +1126,8 @@ mysql_free_result(MYSQL_RES *result)
free_rows(result->data);
if (result->fields)
free_root(&result->field_alloc,MYF(0));
- if (result->row)
- my_free((uchar*) result->row,MYF(0));
- my_free((uchar*) result,MYF(0));
+ my_free(result->row);
+ my_free(result);
}
DBUG_VOID_RETURN;
}
@@ -1167,13 +1165,13 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
{
options->init_commands= (DYNAMIC_ARRAY*)my_malloc(sizeof(DYNAMIC_ARRAY),
MYF(MY_WME));
- init_dynamic_array(options->init_commands,sizeof(char*),0,5 CALLER_INFO);
+ init_dynamic_array(options->init_commands,sizeof(char*),0,5);
}
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
insert_dynamic(options->init_commands, (uchar*)&tmp))
{
- my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(tmp);
return 1;
}
@@ -1221,7 +1219,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
case 2: /* socket */
if (opt_arg)
{
- my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->unix_socket);
options->unix_socket=my_strdup(opt_arg,MYF(MY_WME));
}
break;
@@ -1232,7 +1230,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
case 4: /* password */
if (opt_arg)
{
- my_free(options->password,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->password);
options->password=my_strdup(opt_arg,MYF(MY_WME));
}
break;
@@ -1246,7 +1244,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
case 7: /* user */
if (opt_arg)
{
- my_free(options->user,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->user);
options->user=my_strdup(opt_arg,MYF(MY_WME));
}
break;
@@ -1256,14 +1254,14 @@ void mysql_read_default_options(struct st_mysql_options *options,
case 9: /* host */
if (opt_arg)
{
- my_free(options->host,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->host);
options->host=my_strdup(opt_arg,MYF(MY_WME));
}
break;
case 10: /* database */
if (opt_arg)
{
- my_free(options->db,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->db);
options->db=my_strdup(opt_arg,MYF(MY_WME));
}
break;
@@ -1277,23 +1275,23 @@ void mysql_read_default_options(struct st_mysql_options *options,
break;
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
case 13: /* ssl_key */
- my_free(options->ssl_key, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->ssl_key);
options->ssl_key = my_strdup(opt_arg, MYF(MY_WME));
break;
case 14: /* ssl_cert */
- my_free(options->ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->ssl_cert);
options->ssl_cert = my_strdup(opt_arg, MYF(MY_WME));
break;
case 15: /* ssl_ca */
- my_free(options->ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->ssl_ca);
options->ssl_ca = my_strdup(opt_arg, MYF(MY_WME));
break;
case 16: /* ssl_capath */
- my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->ssl_capath);
options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME));
break;
case 23: /* ssl_cipher */
- my_free(options->ssl_cipher, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->ssl_cipher);
options->ssl_cipher= my_strdup(opt_arg, MYF(MY_WME));
break;
#else
@@ -1305,11 +1303,11 @@ void mysql_read_default_options(struct st_mysql_options *options,
break;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
case 17: /* charset-lib */
- my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->charset_dir);
options->charset_dir = my_strdup(opt_arg, MYF(MY_WME));
break;
case 18:
- my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->charset_name);
options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
break;
case 19: /* Interactive-timeout */
@@ -1339,7 +1337,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
case 26: /* shared_memory_base_name */
#ifdef HAVE_SMEM
if (options->shared_memory_base_name != def_shared_memory_base_name)
- my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(options->shared_memory_base_name);
options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME));
#endif
break;
@@ -1760,14 +1758,14 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
struct st_VioSSLFd *ssl_fd= (struct st_VioSSLFd*) mysql->connector_fd;
DBUG_ENTER("mysql_ssl_free");
- my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.ssl_key);
+ my_free(mysql->options.ssl_cert);
+ my_free(mysql->options.ssl_ca);
+ my_free(mysql->options.ssl_capath);
+ my_free(mysql->options.ssl_cipher);
if (ssl_fd)
SSL_CTX_free(ssl_fd->ssl_context);
- my_free(mysql->connector_fd,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->connector_fd);
mysql->options.ssl_key = 0;
mysql->options.ssl_cert = 0;
mysql->options.ssl_ca = 0;
@@ -2271,8 +2269,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
(mysql->options.my_cnf_file ?
mysql->options.my_cnf_file : "my"),
mysql->options.my_cnf_group);
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.my_cnf_file);
+ my_free(mysql->options.my_cnf_group);
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
}
@@ -3014,7 +3012,7 @@ mysql_select_db(MYSQL *mysql, const char *db)
if ((error=simple_command(mysql,COM_INIT_DB, (const uchar*) db,
(ulong) strlen(db),0)))
DBUG_RETURN(error);
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->db);
mysql->db=my_strdup(db,MYF(MY_WME));
DBUG_RETURN(0);
}
@@ -3029,32 +3027,32 @@ static void mysql_close_free_options(MYSQL *mysql)
{
DBUG_ENTER("mysql_close_free_options");
- my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.unix_socket,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.db,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.client_ip,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.user);
+ my_free(mysql->options.host);
+ my_free(mysql->options.password);
+ my_free(mysql->options.unix_socket);
+ my_free(mysql->options.db);
+ my_free(mysql->options.my_cnf_file);
+ my_free(mysql->options.my_cnf_group);
+ my_free(mysql->options.charset_dir);
+ my_free(mysql->options.charset_name);
+ my_free(mysql->options.client_ip);
if (mysql->options.init_commands)
{
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
char **ptr= (char**)init_commands->buffer;
char **end= ptr + init_commands->elements;
for (; ptr<end; ptr++)
- my_free(*ptr,MYF(MY_WME));
+ my_free(*ptr);
delete_dynamic(init_commands);
- my_free((char*)init_commands,MYF(MY_WME));
+ my_free(init_commands);
}
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
mysql_ssl_free(mysql);
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
#ifdef HAVE_SMEM
if (mysql->options.shared_memory_base_name != def_shared_memory_base_name)
- my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.shared_memory_base_name);
#endif /* HAVE_SMEM */
bzero((char*) &mysql->options,sizeof(mysql->options));
DBUG_VOID_RETURN;
@@ -3063,12 +3061,12 @@ static void mysql_close_free_options(MYSQL *mysql)
static void mysql_close_free(MYSQL *mysql)
{
- my_free((uchar*) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->host_info);
+ my_free(mysql->user);
+ my_free(mysql->passwd);
+ my_free(mysql->db);
#if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100
- my_free(mysql->info_buffer,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->info_buffer);
mysql->info_buffer= 0;
#endif
/* Clear pointers for better safety */
@@ -3176,7 +3174,7 @@ void STDCALL mysql_close(MYSQL *mysql)
(*mysql->methods->free_embedded_thd)(mysql);
#endif
if (mysql->free_me)
- my_free((uchar*) mysql,MYF(0));
+ my_free(mysql);
}
DBUG_VOID_RETURN;
}
@@ -3313,7 +3311,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
if (!(result->data=
(*mysql->methods->read_rows)(mysql,mysql->fields,mysql->field_count)))
{
- my_free((uchar*) result,MYF(0));
+ my_free(result);
DBUG_RETURN(0);
}
mysql->affected_rows= result->row_count= result->data->rows;
@@ -3361,7 +3359,7 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql)
if (!(result->row=(MYSQL_ROW)
my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
{ /* Ptrs: to one row */
- my_free((uchar*) result,MYF(0));
+ my_free(result);
DBUG_RETURN(0);
}
result->fields= mysql->fields;
@@ -3482,19 +3480,19 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
add_init_command(&mysql->options,arg);
break;
case MYSQL_READ_DEFAULT_FILE:
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.my_cnf_file);
mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME));
break;
case MYSQL_READ_DEFAULT_GROUP:
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.my_cnf_group);
mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME));
break;
case MYSQL_SET_CHARSET_DIR:
- my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.charset_dir);
mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME));
break;
case MYSQL_SET_CHARSET_NAME:
- my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.charset_name);
mysql->options.charset_name=my_strdup(arg,MYF(MY_WME));
break;
case MYSQL_OPT_PROTOCOL:
@@ -3503,7 +3501,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
case MYSQL_SHARED_MEMORY_BASE_NAME:
#ifdef HAVE_SMEM
if (mysql->options.shared_memory_base_name != def_shared_memory_base_name)
- my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->options.shared_memory_base_name);
mysql->options.shared_memory_base_name=my_strdup(arg,MYF(MY_WME));
#endif
break;
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 0a09e945022..ac6c2ace890 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1024,30 +1024,21 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type)
int my_time_to_str(const MYSQL_TIME *l_time, char *to)
{
uint extra_hours= 0;
- return my_sprintf(to, (to, "%s%02u:%02u:%02u",
- (l_time->neg ? "-" : ""),
- extra_hours+ l_time->hour,
- l_time->minute,
- l_time->second));
+ return sprintf(to, "%s%02u:%02u:%02u", (l_time->neg ? "-" : ""),
+ extra_hours+ l_time->hour, l_time->minute, l_time->second);
}
int my_date_to_str(const MYSQL_TIME *l_time, char *to)
{
- return my_sprintf(to, (to, "%04u-%02u-%02u",
- l_time->year,
- l_time->month,
- l_time->day));
+ return sprintf(to, "%04u-%02u-%02u",
+ l_time->year, l_time->month, l_time->day);
}
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to)
{
- return my_sprintf(to, (to, "%04u-%02u-%02u %02u:%02u:%02u",
- l_time->year,
- l_time->month,
- l_time->day,
- l_time->hour,
- l_time->minute,
- l_time->second));
+ return sprintf(to, "%04u-%02u-%02u %02u:%02u:%02u",
+ l_time->year, l_time->month, l_time->day,
+ l_time->hour, l_time->minute, l_time->second);
}
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index a0e157b7806..7107a68ee84 100755..100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -75,7 +75,7 @@ SET (SQL_SOURCE
sql_connect.cc scheduler.cc
sql_profile.cc event_parse_data.cc
sql_signal.cc rpl_handler.cc mdl.cc
- transaction.cc sys_vars.cc
+ transaction.cc sys_vars.cc sql_truncate.cc datadict.cc
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE})
@@ -97,7 +97,7 @@ ELSE()
SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
ENDIF()
-MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR})
+MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server)
IF(NOT WITHOUT_DYNAMIC_PLUGINS)
SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
@@ -156,7 +156,10 @@ IF(WITH_MYSQLD_LDFLAGS)
SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS
"${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}")
ENDIF()
-INSTALL_DEBUG_TARGET(mysqld DESTINATION ${INSTALL_SBINDIR} RENAME mysqld-debug)
+INSTALL_DEBUG_TARGET(mysqld
+ DESTINATION ${INSTALL_SBINDIR}
+ PDB_DESTINATION ${INSTALL_SBINDIR}/debug
+ RENAME mysqld-debug)
# Handle out-of-source build from source package with possibly broken
# bison. Copy bison output to from source to build directory, if not already
@@ -252,7 +255,7 @@ IF(INSTALL_LAYOUT STREQUAL "STANDALONE")
# Avoid completely empty directories and install dummy file instead.
SET(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.empty )
FILE(WRITE ${DUMMY_FILE} "")
-INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test)
+INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test COMPONENT DataFiles)
# Install initial database on windows
IF(NOT CMAKE_CROSSCOMPILING)
@@ -280,7 +283,7 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm
)
- INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
+ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION . COMPONENT DataFiles
PATTERN "bootstrap.sql" EXCLUDE)
ELSE()
# Not windows or cross compiling, just install an empty directory
diff --git a/sql/Makefile.am b/sql/Makefile.am
index f57d1f3bc34..4b1ecbbc8da 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -39,7 +39,9 @@ DTRACEFILES = filesort.o \
sql_connect.o \
sql_cursor.o \
sql_delete.o \
+ sql_truncate.o \
sql_insert.o \
+ datadict.o \
sql_parse.o \
sql_prepare.o \
sql_select.o \
@@ -56,7 +58,9 @@ DTRACEFILES_DEPEND = filesort.o \
sql_connect.o \
sql_cursor.o \
sql_delete.o \
+ sql_truncate.o \
sql_insert.o \
+ datadict.o \
sql_parse.o \
sql_prepare.o \
sql_select.o \
@@ -121,7 +125,8 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
sql_audit.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_plist.h transaction.h sys_vars.h sql_truncate.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 \
@@ -130,16 +135,15 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
item_row.cc item_geofunc.cc item_xmlfunc.cc \
field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \
net_serv.cc protocol.cc sql_state.c \
- lock.cc my_lock.c \
- sql_string.cc sql_manager.cc sql_map.cc \
+ lock.cc sql_string.cc sql_manager.cc sql_map.cc \
main.cc mysqld.cc password.c hash_filo.cc hostname.cc \
sql_connect.cc scheduler.cc sql_parse.cc \
keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \
sql_base.cc table.cc sql_select.cc sql_insert.cc \
- sql_profile.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 \
+ procedure.cc sql_test.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 \
diff --git a/sql/datadict.cc b/sql/datadict.cc
new file mode 100644
index 00000000000..33c3b6bc700
--- /dev/null
+++ b/sql/datadict.cc
@@ -0,0 +1,161 @@
+/* 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 "datadict.h"
+#include "sql_priv.h"
+#include "sql_class.h"
+#include "sql_table.h"
+
+
+/**
+ Check type of .frm if we are not going to parse it.
+
+ @param path path to FRM file
+
+ @retval FRMTYPE_ERROR error
+ @retval FRMTYPE_TABLE table
+ @retval FRMTYPE_VIEW view
+*/
+
+frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
+{
+ File file;
+ uchar header[10]; //"TYPE=VIEW\n" it is 10 characters
+ size_t error;
+ DBUG_ENTER("dd_frm_type");
+
+ *dbt= DB_TYPE_UNKNOWN;
+
+ if ((file= mysql_file_open(key_file_frm, path, O_RDONLY | O_SHARE, MYF(0))) < 0)
+ DBUG_RETURN(FRMTYPE_ERROR);
+ error= mysql_file_read(file, (uchar*) header, sizeof(header), MYF(MY_NABP));
+ mysql_file_close(file, MYF(MY_WME));
+
+ if (error)
+ DBUG_RETURN(FRMTYPE_ERROR);
+ if (!strncmp((char*) header, "TYPE=VIEW\n", sizeof(header)))
+ DBUG_RETURN(FRMTYPE_VIEW);
+
+ /*
+ This is just a check for DB_TYPE. We'll return default unknown type
+ if the following test is true (arg #3). This should not have effect
+ on return value from this function (default FRMTYPE_TABLE)
+ */
+ if (header[0] != (uchar) 254 || header[1] != 1 ||
+ (header[2] != FRM_VER && header[2] != FRM_VER+1 &&
+ (header[2] < FRM_VER+3 || header[2] > FRM_VER+4)))
+ DBUG_RETURN(FRMTYPE_TABLE);
+
+ *dbt= (enum legacy_db_type) (uint) *(header + 3);
+
+ /* Probably a table. */
+ DBUG_RETURN(FRMTYPE_TABLE);
+}
+
+
+/**
+ 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)
+{
+ char path[FN_REFLEN + 1];
+ enum legacy_db_type db_type;
+ handlerton *table_type;
+ LEX_STRING db_name = {(char *) db, strlen(db)};
+
+ if (check_db_name(&db_name))
+ {
+ my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
+ return TRUE;
+ }
+
+ if (check_table_name(table_name, strlen(table_name), FALSE))
+ {
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name);
+ 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)
+ {
+ my_error(ER_NO_SUCH_TABLE, MYF(0), db, table_name);
+ return TRUE;
+ }
+
+ table_type= ha_resolve_by_legacy_type(thd, db_type);
+ *yes_no= ha_check_storage_engine_flag(table_type, flag);
+
+ return FALSE;
+}
+
+
+/*
+ Regenerate a metadata locked table.
+
+ @param thd Thread context.
+ @param db Name of the database to which the table belongs to.
+ @param name Table name.
+
+ @retval FALSE Success.
+ @retval TRUE Error.
+*/
+
+bool dd_recreate_table(THD *thd, const char *db, const char *table_name)
+{
+ bool error= TRUE;
+ HA_CREATE_INFO create_info;
+ char path[FN_REFLEN + 1];
+ DBUG_ENTER("dd_recreate_table");
+
+ /* There should be a exclusive metadata lock on the table. */
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name,
+ MDL_EXCLUSIVE));
+
+ memset(&create_info, 0, sizeof(create_info));
+
+ /* Create a path to the table, but without a extension. */
+ build_table_filename(path, sizeof(path) - 1, db, table_name, "", 0);
+
+ /* Attempt to reconstruct the table. */
+ mysql_mutex_lock(&LOCK_open);
+ error= ha_create_table(thd, path, db, table_name, &create_info, TRUE);
+ mysql_mutex_unlock(&LOCK_open);
+
+ DBUG_RETURN(error);
+}
+
diff --git a/sql/datadict.h b/sql/datadict.h
new file mode 100644
index 00000000000..05b5a9bba4b
--- /dev/null
+++ b/sql/datadict.h
@@ -0,0 +1,40 @@
+#ifndef DATADICT_INCLUDED
+#define DATADICT_INCLUDED
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "handler.h"
+
+/*
+ Data dictionary API.
+*/
+
+enum frm_type_enum
+{
+ FRMTYPE_ERROR= 0,
+ FRMTYPE_TABLE,
+ FRMTYPE_VIEW
+};
+
+
+frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt);
+
+bool dd_check_storage_engine_flag(THD *thd,
+ const char *db, const char *table_name,
+ uint32 flag,
+ bool *yes_no);
+bool dd_recreate_table(THD *thd, const char *db, const char *table_name);
+
+#endif // DATADICT_INCLUDED
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index dde6267331f..74e5b2c70f3 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -626,7 +626,7 @@ void debug_sync_end_thread(THD *thd)
action->wait_for.free();
action->sync_point.free();
}
- my_free(ds_control->ds_action, MYF(0));
+ my_free(ds_control->ds_action);
}
/* Statistics. */
@@ -637,7 +637,7 @@ void debug_sync_end_thread(THD *thd)
debug_sync_global.dsp_max_active= ds_control->dsp_max_active;
mysql_mutex_unlock(&debug_sync_global.ds_mutex);
- my_free(ds_control, MYF(0));
+ my_free(ds_control);
thd->debug_sync_control= NULL;
}
diff --git a/sql/derror.cc b/sql/derror.cc
index 7f1435e89c1..bf8c589a65f 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -79,7 +79,7 @@ bool init_errmessage(void)
/* Register messages for use with my_error(). */
if (my_error_register(get_server_errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST))
{
- x_free((uchar*) errmsgs);
+ my_free(errmsgs);
DBUG_RETURN(TRUE);
}
@@ -155,7 +155,8 @@ Check that the above file is the right version for this program!",
DBUG_RETURN(1);
}
- x_free((uchar*) *point); /* Free old language */
+ /* Free old language */
+ my_free(*point);
if (!(*point= (const char**)
my_malloc((size_t) (length+count*sizeof(char*)),MYF(0))))
{
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index c778d72a016..dd1845b29bc 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -176,7 +176,7 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n)
return TRUE;
if (!(name.str= my_strndup(n.str, name.length= n.length, MYF(MY_WME))))
{
- my_free((uchar*) dbname.str, MYF(0));
+ my_free(dbname.str);
return TRUE;
}
return FALSE;
@@ -192,8 +192,8 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n)
Event_queue_element_for_exec::~Event_queue_element_for_exec()
{
- my_free((uchar*) dbname.str, MYF(0));
- my_free((uchar*) name.str, MYF(0));
+ my_free(dbname.str);
+ my_free(name.str);
}
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index 33b9a1cafda..aa4d376d86e 100755..100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -203,7 +203,6 @@ pre_init_event_thread(THD* thd)
*/
thd->proc_info= "Initialized";
- thd->version= refresh_version;
thd->set_time();
/* Do not use user-supplied timeout value for system threads. */
@@ -239,7 +238,7 @@ event_scheduler_thread(void *arg)
res= post_init_event_thread(thd);
DBUG_ENTER("event_scheduler_thread");
- my_free((char*)arg, MYF(0));
+ my_free(arg);
if (!res)
scheduler->run(thd);
diff --git a/sql/examples/CMakeLists.txt b/sql/examples/CMakeLists.txt
index 1a22e9a3efd..3c5cc23ec3b 100755..100644
--- a/sql/examples/CMakeLists.txt
+++ b/sql/examples/CMakeLists.txt
@@ -13,8 +13,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/extra/yassl/include
diff --git a/sql/field.cc b/sql/field.cc
index bfaaf10b141..56d60ff5b28 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8280,7 +8280,13 @@ int Field_set::store(longlong nr, bool unsigned_val)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
int error= 0;
- ulonglong max_nr= set_bits(ulonglong, typelib->count);
+ ulonglong max_nr;
+
+ if (sizeof(ulonglong)*8 <= typelib->count)
+ max_nr= ULONGLONG_MAX;
+ else
+ max_nr= (ULL(1) << typelib->count) - 1;
+
if ((ulonglong) nr > max_nr)
{
nr&= max_nr;
@@ -10135,7 +10141,7 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
{
/* DBL_DIG is enough to print '-[digits].E+###' */
char str_nr[DBL_DIG + 8];
- uint str_len= my_sprintf(str_nr, (str_nr, "%g", nr));
+ uint str_len= sprintf(str_nr, "%g", nr);
make_truncated_value_warning(thd, level, str_nr, str_len, ts_type,
field_name);
}
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 3f3dc4e1e3e..b98a7f780f4 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -264,7 +264,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
{
if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
{
- x_free(table_sort.buffpek);
+ my_free(table_sort.buffpek);
table_sort.buffpek= 0;
}
if (!(table_sort.buffpek=
@@ -304,13 +304,12 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
error =0;
err:
- if (param.tmp_buffer)
- x_free(param.tmp_buffer);
+ my_free(param.tmp_buffer);
if (!subselect || !subselect->is_uncacheable())
{
- x_free((uchar*) sort_keys);
+ my_free(sort_keys);
table_sort.sort_keys= 0;
- x_free((uchar*) buffpek);
+ my_free(buffpek);
table_sort.buffpek= 0;
table_sort.buffpek_len= 0;
}
@@ -347,32 +346,22 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
void filesort_free_buffers(TABLE *table, bool full)
{
- if (table->sort.record_pointers)
- {
- my_free((uchar*) table->sort.record_pointers,MYF(0));
- table->sort.record_pointers=0;
- }
+ my_free(table->sort.record_pointers);
+ table->sort.record_pointers= NULL;
+
if (full)
{
- if (table->sort.sort_keys )
- {
- x_free((uchar*) table->sort.sort_keys);
- table->sort.sort_keys= 0;
- }
- if (table->sort.buffpek)
- {
- x_free((uchar*) table->sort.buffpek);
- table->sort.buffpek= 0;
- table->sort.buffpek_len= 0;
- }
- }
- if (table->sort.addon_buf)
- {
- my_free((char *) table->sort.addon_buf, MYF(0));
- my_free((char *) table->sort.addon_field, MYF(MY_ALLOW_ZERO_PTR));
- table->sort.addon_buf=0;
- table->sort.addon_field=0;
+ my_free(table->sort.sort_keys);
+ table->sort.sort_keys= NULL;
+ my_free(table->sort.buffpek);
+ table->sort.buffpek= NULL;
+ table->sort.buffpek_len= 0;
}
+
+ my_free(table->sort.addon_buf);
+ my_free(table->sort.addon_field);
+ table->sort.addon_buf= NULL;
+ table->sort.addon_field= NULL;
}
/** Make a array of string pointers. */
@@ -413,7 +402,7 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
if (reinit_io_cache(buffpek_pointers,READ_CACHE,0L,0,0) ||
my_b_read(buffpek_pointers, (uchar*) tmp, length))
{
- my_free((char*) tmp, MYF(0));
+ my_free(tmp);
tmp=0;
}
}
@@ -522,6 +511,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
volatile THD::killed_state *killed= &thd->killed;
handler *file;
MY_BITMAP *save_read_set, *save_write_set;
+ bool skip_record;
DBUG_ENTER("find_all_keys");
DBUG_PRINT("info",("using: %s",
(select ? select->quick ? "ranges" : "where":
@@ -614,7 +604,8 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
}
if (error == 0)
param->examined_rows++;
- if (error == 0 && (!select || select->skip_record() == 0))
+ if (!error && (!select ||
+ (!select->skip_record(thd, &skip_record) && !skip_record)))
{
if (idx == param->keys)
{
diff --git a/sql/gstream.h b/sql/gstream.h
index 65acc2ff193..6bb3c9bac10 100644
--- a/sql/gstream.h
+++ b/sql/gstream.h
@@ -45,7 +45,7 @@ public:
{}
~Gis_read_stream()
{
- my_free((uchar*) m_err_msg, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_err_msg);
}
enum enum_tok_types get_next_toc_type();
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 9f003174d2e..ecf2984a4c0 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -1035,7 +1035,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
}
if (loop == 0 && offset > buffer_size)
{
- my_free(buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buffer);
buffer_size= 0;
DBUG_PRINT("info", ("allocate blobs buffer size %u", offset));
buffer= (uchar*) my_malloc(offset, MYF(MY_WME));
@@ -1188,8 +1188,8 @@ int ha_ndbcluster::get_metadata(const char *path)
if (readfrm(path, &data, &length) ||
packfrm(data, length, &pack_data, &pack_length))
{
- my_free(data, MYF(MY_ALLOW_ZERO_PTR));
- my_free(pack_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data);
+ my_free(pack_data);
DBUG_RETURN(1);
}
@@ -1208,8 +1208,8 @@ int ha_ndbcluster::get_metadata(const char *path)
DBUG_DUMP("frm", (uchar*) tab->getFrmData(), tab->getFrmLength());
error= HA_ERR_TABLE_DEF_CHANGED;
}
- my_free((char*)data, MYF(0));
- my_free((char*)pack_data, MYF(0));
+ my_free(data);
+ my_free(pack_data);
if (error)
goto err;
@@ -1235,7 +1235,7 @@ static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
unsigned sz= index->getNoOfIndexColumns();
if (data.unique_index_attrid_map)
- my_free((char*)data.unique_index_attrid_map, MYF(0));
+ my_free(data.unique_index_attrid_map);
data.unique_index_attrid_map= (uchar*)my_malloc(sz,MYF(MY_WME));
if (data.unique_index_attrid_map == 0)
{
@@ -1313,7 +1313,7 @@ static void ndb_clear_index(NDB_INDEX_DATA &data)
{
if (data.unique_index_attrid_map)
{
- my_free((char*)data.unique_index_attrid_map, MYF(0));
+ my_free(data.unique_index_attrid_map);
}
if (data.index_stat)
{
@@ -5399,15 +5399,15 @@ int ha_ndbcluster::create(const char *name,
DBUG_RETURN(1);
if (packfrm(data, length, &pack_data, &pack_length))
{
- my_free((char*)data, MYF(0));
+ my_free(data);
DBUG_RETURN(2);
}
DBUG_PRINT("info",
("setFrm data: 0x%lx len: %lu", (long) pack_data,
(ulong) pack_length));
tab.setFrm(pack_data, pack_length);
- my_free((char*)data, MYF(0));
- my_free((char*)pack_data, MYF(0));
+ my_free(data);
+ my_free(pack_data);
/*
Check for disk options
@@ -5751,8 +5751,8 @@ int ha_ndbcluster::create_handler_files(const char *file,
packfrm(data, length, &pack_data, &pack_length))
{
DBUG_PRINT("info", ("Missing frm for %s", m_tabname));
- my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data);
+ my_free(pack_data);
error= 1;
}
else
@@ -5766,8 +5766,8 @@ int ha_ndbcluster::create_handler_files(const char *file,
set_ndb_err(current_thd, dict->getNdbError());
error= ndb_to_mysql_error(&dict->getNdbError());
}
- my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data);
+ my_free(pack_data);
}
set_ndb_share_state(m_share, NSS_INITIAL);
@@ -6565,7 +6565,7 @@ ha_ndbcluster::~ha_ndbcluster()
free_share(&m_share);
}
release_metadata(thd, ndb);
- my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_blobs_buffer);
m_blobs_buffer= 0;
// Check for open cursor/transaction
@@ -6911,7 +6911,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db,
DBUG_RETURN(0);
err:
- my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data);
if (share)
{
/* ndb_share reference temporary free */
@@ -7177,8 +7177,8 @@ int ndbcluster_find_all_files(THD *thd)
free_share(&share);
}
}
- my_free((char*) data, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) pack_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data);
+ my_free(pack_data);
mysql_mutex_lock(&LOCK_open);
if (discover)
@@ -7408,9 +7408,10 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
DBUG_PRINT("info", ("Remove table %s/%s", db, file_name_str));
// Delete the table and all related files
TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
- table_list.db= (char*) db;
- table_list.alias= table_list.table_name= (char*)file_name_str;
+ table_list.init_one_table(db, strlen(db), file_name_str,
+ strlen(file_name_str), file_name_str,
+ TL_WRITE);
+ table_list.mdl_request.set_type(MDL_EXCLUSIVE);
(void)mysql_rm_table_part2(thd, &table_list,
FALSE, /* if_exists */
FALSE, /* drop_temporary */
@@ -8680,7 +8681,7 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table,
if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share))
{
free_root(&share->mem_root, MYF(0));
- my_free((uchar*) share, 0);
+ my_free(share);
*root_ptr= old_root;
if (!have_lock)
mysql_mutex_unlock(&ndbcluster_mutex);
@@ -8751,7 +8752,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share)
}
#endif
free_root(&(*share)->mem_root, MYF(0));
- my_free((uchar*) *share, MYF(0));
+ my_free(*share);
*share= 0;
dbug_print_open_tables();
@@ -9509,7 +9510,6 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
if (thd->store_globals())
goto ndb_util_thread_fail;
thd->init_for_queries();
- thd->version=refresh_version;
thd->main_security_ctx.host_or_ip= "";
thd->client_capabilities = 0;
my_net_init(&thd->net, 0);
@@ -10076,7 +10076,7 @@ int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info)
}
tab->setRangeListData(range_data, sizeof(int32)*part_info->num_parts);
error:
- my_free((char*)range_data, MYF(0));
+ my_free(range_data);
DBUG_RETURN(error);
}
@@ -10113,7 +10113,7 @@ int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info)
}
tab->setRangeListData(list_data, 2*sizeof(int32)*part_info->num_list_values);
error:
- my_free((char*)list_data, MYF(0));
+ my_free(list_data);
DBUG_RETURN(error);
}
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index a61f5b4feea..4f8bb66fcb0 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -1020,7 +1020,7 @@ static void ndbcluster_get_schema(NDB_SHARE *share,
ptrdiff);
if (ret != 0)
{
- my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(blobs_buffer);
DBUG_PRINT("info", ("blob read error"));
DBUG_ASSERT(FALSE);
}
@@ -1071,7 +1071,7 @@ static void ndbcluster_get_schema(NDB_SHARE *share,
field++;
s->type= ((Field_long *)*field)->val_int();
/* free blobs buffer */
- my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(blobs_buffer);
dbug_tmp_restore_column_map(table->read_set, old_map);
}
@@ -1739,7 +1739,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
old->getObjectVersion() != altered_table->getObjectVersion())
dict->putTable(altered_table);
- my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data);
data= NULL;
if ((error= unpackfrm(&data, &length,
(const uchar*) altered_table->getFrmData())) ||
@@ -1772,8 +1772,8 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
mysql_mutex_unlock(&LOCK_open);
}
- my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data);
+ my_free(pack_data);
}
// If only frm was changed continue replicating
@@ -3507,8 +3507,8 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
if (share->flags & NSF_BLOB_FLAG)
{
- my_free(blobs_buffer[0], MYF(MY_ALLOW_ZERO_PTR));
- my_free(blobs_buffer[1], MYF(MY_ALLOW_ZERO_PTR));
+ my_free(blobs_buffer[0]);
+ my_free(blobs_buffer[1]);
}
return 0;
@@ -3580,7 +3580,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key,
ndb_schema_object->key_length= length;
if (my_hash_insert(&ndb_schema_objects, (uchar*) ndb_schema_object))
{
- my_free((uchar*) ndb_schema_object, 0);
+ my_free(ndb_schema_object);
break;
}
mysql_mutex_init(key_ndb_schema_object_mutex, &ndb_schema_object->mutex, MY_MUTEX_INIT_FAST);
@@ -3612,7 +3612,7 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object,
DBUG_PRINT("info", ("use_count: %d", (*ndb_schema_object)->use_count));
my_hash_delete(&ndb_schema_objects, (uchar*) *ndb_schema_object);
mysql_mutex_destroy(&(*ndb_schema_object)->mutex);
- my_free((uchar*) *ndb_schema_object, MYF(0));
+ my_free(*ndb_schema_object);
*ndb_schema_object= 0;
}
else
@@ -3679,7 +3679,6 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
thd->init_for_queries();
thd->command= COM_DAEMON;
thd->system_thread= SYSTEM_THREAD_NDBCLUSTER_BINLOG;
- thd->version= refresh_version;
thd->main_security_ctx.host_or_ip= "";
thd->client_capabilities= 0;
my_net_init(&thd->net, 0);
@@ -3966,9 +3965,9 @@ restart:
!ndb_binlog_running))
break; /* Shutting down server */
- if (ndb_binlog_index && ndb_binlog_index->s->version < refresh_version)
+ if (ndb_binlog_index && ndb_binlog_index->s->needs_reopen())
{
- if (ndb_binlog_index->s->version < refresh_version)
+ if (ndb_binlog_index->s->needs_reopen())
{
close_thread_tables(thd);
ndb_binlog_index= 0;
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index a6f106be3be..bd3cd780bc5 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -287,7 +287,7 @@ ha_partition::~ha_partition()
for (i= 0; i < m_tot_parts; i++)
delete m_file[i];
}
- my_free((char*) m_ordered_rec_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_ordered_rec_buffer);
clear_handler_file();
DBUG_VOID_RETURN;
@@ -1308,7 +1308,7 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
assumes that external_lock() is last call that may fail here.
Otherwise see description for cleanup_new_partition().
*/
- if ((error= file->ha_external_lock(ha_thd(), m_lock_type)))
+ if ((error= file->ha_external_lock(ha_thd(), F_WRLCK)))
goto error_external_lock;
DBUG_PRINT("info", ("partition %s external locked", part_name));
@@ -2267,7 +2267,7 @@ bool ha_partition::create_handler_file(const char *name)
}
else
result= TRUE;
- my_free((char*) file_buffer, MYF(0));
+ my_free(file_buffer);
DBUG_RETURN(result);
}
@@ -2285,8 +2285,8 @@ void ha_partition::clear_handler_file()
{
if (m_engine_array)
plugin_unlock_list(NULL, m_engine_array, m_tot_parts);
- my_free((char*) m_file_buffer, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) m_engine_array, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_file_buffer);
+ my_free(m_engine_array);
m_file_buffer= NULL;
m_engine_array= NULL;
}
@@ -2495,7 +2495,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
err3:
my_afree((gptr) engine_array);
err2:
- my_free(file_buffer, MYF(0));
+ my_free(file_buffer);
err1:
(void) mysql_file_close(file, MYF(0));
DBUG_RETURN(TRUE);
@@ -4371,6 +4371,58 @@ int ha_partition::index_read_last_map(uchar *buf, const uchar *key,
/*
+ Optimization of the default implementation to take advantage of dynamic
+ partition pruning.
+*/
+int ha_partition::index_read_idx_map(uchar *buf, uint index,
+ const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
+{
+ int error= HA_ERR_KEY_NOT_FOUND;
+ DBUG_ENTER("ha_partition::index_read_idx_map");
+
+ if (find_flag == HA_READ_KEY_EXACT)
+ {
+ uint part;
+ m_start_key.key= key;
+ m_start_key.keypart_map= keypart_map;
+ m_start_key.flag= find_flag;
+ m_start_key.length= calculate_key_len(table, index, m_start_key.key,
+ m_start_key.keypart_map);
+
+ get_partition_set(table, buf, index, &m_start_key, &m_part_spec);
+
+ /* How can it be more than one partition with the current use? */
+ DBUG_ASSERT(m_part_spec.start_part == m_part_spec.end_part);
+
+ for (part= m_part_spec.start_part; part <= m_part_spec.end_part; part++)
+ {
+ if (bitmap_is_set(&(m_part_info->used_partitions), part))
+ {
+ error= m_file[part]->index_read_idx_map(buf, index, key,
+ keypart_map, find_flag);
+ if (error != HA_ERR_KEY_NOT_FOUND &&
+ error != HA_ERR_END_OF_FILE)
+ break;
+ }
+ }
+ }
+ else
+ {
+ /*
+ If not only used with READ_EXACT, we should investigate if possible
+ to optimize for other find_flag's as well.
+ */
+ DBUG_ASSERT(0);
+ /* fall back on the default implementation */
+ error= handler::index_read_idx_map(buf, index, key, keypart_map, find_flag);
+ }
+ DBUG_RETURN(error);
+}
+
+
+/*
Read next record in a forward index scan
SYNOPSIS
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index eec3cb71537..cdbfb2163c7 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -36,8 +36,7 @@ enum partition_keywords
HA_CAN_FULLTEXT | \
HA_DUPLICATE_POS | \
HA_CAN_SQL_HANDLER | \
- HA_CAN_INSERT_DELAYED | \
- HA_PRIMARY_KEY_REQUIRED_FOR_POSITION)
+ HA_CAN_INSERT_DELAYED)
class ha_partition :public handler
{
private:
@@ -431,6 +430,15 @@ public:
virtual int index_init(uint idx, bool sorted);
virtual int index_end();
+ /**
+ @breif
+ Positions an index cursor to the index specified in the hanlde. Fetches the
+ row if available. If the key value is null, begin at first key of the
+ index.
+ */
+ virtual int index_read_idx_map(uchar *buf, uint index, const uchar *key,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
/*
These methods are used to jump to next or previous entry in the index
scan. There are also methods to jump to first and last entry.
@@ -749,9 +757,6 @@ public:
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION:
Does the storage engine need a PK for position?
- Used with hidden primary key in InnoDB.
- Hidden primary keys cannot be supported by partitioning, since the
- partitioning expressions columns must be a part of the primary key.
(InnoDB)
HA_FILE_BASED is always set for partition handler since we use a
diff --git a/sql/handler.cc b/sql/handler.cc
index 11f684a8010..b42840c7b1b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -392,7 +392,7 @@ static int ha_finish_errors(void)
/* Allocate a pointer array for the error message strings. */
if (! (errmsgs= my_error_unregister(HA_ERR_FIRST, HA_ERR_LAST)))
return 1;
- my_free((uchar*) errmsgs, MYF(0));
+ my_free(errmsgs);
return 0;
}
@@ -447,7 +447,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
hton2plugin[hton->slot]= NULL;
}
- my_free((uchar*)hton, MYF(0));
+ my_free(hton);
end:
DBUG_RETURN(0);
@@ -580,7 +580,7 @@ err_deinit:
(void) plugin->plugin->deinit(NULL);
err:
- my_free((uchar*) hton, MYF(0));
+ my_free(hton);
err_no_hton_memory:
plugin->data= NULL;
DBUG_RETURN(1);
@@ -1302,7 +1302,6 @@ int ha_commit_one_phase(THD *thd, bool all)
if (thd->transaction.changed_tables)
query_cache.invalidate(thd->transaction.changed_tables);
#endif
- thd->variables.tx_isolation=thd->session_tx_isolation;
}
}
/* Free resources and perform other cleanup even for 'empty' transactions. */
@@ -1379,8 +1378,6 @@ int ha_rollback_trans(THD *thd, bool all)
if (is_real_trans && thd->transaction_rollback_request &&
thd->transaction.xid_state.xa_state != XA_NOTR)
thd->transaction.xid_state.rm_error= thd->stmt_da->sql_errno();
- if (all)
- thd->variables.tx_isolation=thd->session_tx_isolation;
}
/* Always cleanup. Even if nht==0. There may be savepoints. */
if (is_real_trans)
@@ -1633,7 +1630,7 @@ int ha_recover(HASH *commit_list)
plugin_foreach(NULL, xarecover_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN, &info);
- my_free((uchar*)info.list, MYF(0));
+ my_free(info.list);
if (info.found_foreign_xids)
sql_print_warning("Found %d prepared XA transactions",
info.found_foreign_xids);
@@ -3661,7 +3658,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
build_table_filename(path, sizeof(path) - 1, db, name, "", 0);
// Save the frm file
error= writefrm(path, frmblob, frmlen);
- my_free(frmblob, MYF(0));
+ my_free(frmblob);
if (error)
DBUG_RETURN(2);
@@ -4868,7 +4865,7 @@ int fl_log_iterator_next(struct handler_iterator *iterator,
void fl_log_iterator_destroy(struct handler_iterator *iterator)
{
- my_free((uchar*)iterator->buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(iterator->buffer);
}
diff --git a/sql/handler.h b/sql/handler.h
index fc49d9e647d..96095798d18 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -100,7 +100,10 @@
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
/*
If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
- uses a primary key. Without primary key, we can't call position().
+ uses a primary key given by the record argument.
+ Without primary key, we can't call position().
+ If not set, the position is returned as the current rows position
+ regardless of what argument is given.
*/
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
#define HA_CAN_RTREEKEYS (1 << 17)
@@ -458,11 +461,7 @@ typedef struct xid_t XID;
/* for recover() handlerton call */
#define MIN_XID_LIST_SIZE 128
-#ifdef SAFEMALLOC
-#define MAX_XID_LIST_SIZE 256
-#else
#define MAX_XID_LIST_SIZE (1024*128)
-#endif
/*
These structures are used to pass information from a set of SQL commands
@@ -1537,10 +1536,9 @@ public:
virtual int rnd_next(uchar *buf)=0;
virtual int rnd_pos(uchar * buf, uchar *pos)=0;
/**
- One has to use this method when to find
- random position by record as the plain
- position() call doesn't work for some
- handlers for random position.
+ This function only works for handlers having
+ HA_PRIMARY_KEY_REQUIRED_FOR_POSITION set.
+ It will return the row with the PK given in the record argument.
*/
virtual int rnd_pos_by_record(uchar *record)
{
@@ -1558,6 +1556,12 @@ public:
{ return HA_ERR_WRONG_COMMAND; }
virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key)
{ return (ha_rows) 10; }
+ /*
+ If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, then it sets ref
+ (reference to the row, aka position, with the primary key given in
+ the record).
+ Otherwise it set ref to the current row.
+ */
virtual void position(const uchar *record)=0;
virtual int info(uint)=0; // see my_base.h for full description
virtual void get_dynamic_partition_info(PARTITION_STATS *stat_info,
diff --git a/sql/item.cc b/sql/item.cc
index 05363f41d07..92cf2df8a4c 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4400,8 +4400,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
context->first_name_resolution_table,
context->last_name_resolution_table,
reference, REPORT_ALL_ERRORS,
- !any_privileges &&
- TRUE, TRUE);
+ !any_privileges, TRUE);
}
return -1;
}
@@ -4915,11 +4914,8 @@ Item *Item_field::equal_fields_propagator(uchar *arg)
e.g. <bin_col> = <int_col> AND <bin_col> = <hex_string>) since
Items don't know the context they are in and there are functions like
IF (<hex_string>, 'yes', 'no').
- The same problem occurs when comparing a DATE/TIME field with a
- DATE/TIME represented as an int and as a string.
*/
- if (!item ||
- (cmp_context != (Item_result)-1 && item->cmp_context != cmp_context))
+ if (!item || !has_compatible_context(item))
item= this;
else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type()))
{
@@ -4983,8 +4979,7 @@ Item *Item_field::replace_equal_field(uchar *arg)
Item *const_item= item_equal->get_const();
if (const_item)
{
- if (cmp_context != (Item_result)-1 &&
- const_item->cmp_context != cmp_context)
+ if (!has_compatible_context(const_item))
return this;
return const_item;
}
@@ -5054,21 +5049,6 @@ enum_field_types Item::field_type() const
}
-bool Item::is_datetime()
-{
- switch (field_type())
- {
- case MYSQL_TYPE_DATE:
- case MYSQL_TYPE_DATETIME:
- case MYSQL_TYPE_TIMESTAMP:
- return TRUE;
- default:
- break;
- }
- return FALSE;
-}
-
-
String *Item::check_well_formed_result(String *str, bool send_error)
{
/* Check whether we got a well-formed string */
@@ -7469,6 +7449,8 @@ bool Item_cache_datetime::cache_value_int()
return FALSE;
value_cached= TRUE;
+ // Mark cached string value obsolete
+ str_value_cached= FALSE;
/* Assume here that the underlying item will do correct conversion.*/
int_value= example->val_int_result();
null_value= example->null_value;
@@ -7481,7 +7463,13 @@ bool Item_cache_datetime::cache_value()
{
if (!example)
return FALSE;
+
+ if (cmp_context == INT_RESULT)
+ return cache_value_int();
+
str_value_cached= TRUE;
+ // Mark cached int value obsolete
+ value_cached= FALSE;
/* Assume here that the underlying item will do correct conversion.*/
String *res= example->str_result(&str_value);
if (res && res != &str_value)
@@ -7505,8 +7493,47 @@ void Item_cache_datetime::store(Item *item, longlong val_arg)
String *Item_cache_datetime::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
- if (!str_value_cached && !cache_value())
- return NULL;
+ if (!str_value_cached)
+ {
+ /*
+ When it's possible the Item_cache_datetime uses INT datetime
+ representation due to speed reasons. But still, it always has the STRING
+ result type and thus it can be asked to return a string value.
+ It is possible that at this time cached item doesn't contain correct
+ string value, thus we have to convert cached int value to string and
+ return it.
+ */
+ if (value_cached)
+ {
+ MYSQL_TIME ltime;
+ if (str_value.alloc(MAX_DATE_STRING_REP_LENGTH))
+ return NULL;
+ if (cached_field_type == MYSQL_TYPE_TIME)
+ {
+ ulonglong time= int_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;
+ }
+ else
+ {
+ int was_cut;
+ longlong res;
+ res= number_to_datetime(val_int(), &ltime, TIME_FUZZY_DATE, &was_cut);
+ if (res == -1)
+ return NULL;
+ }
+ str_value.length(my_TIME_to_str(&ltime,
+ const_cast<char*>(str_value.ptr())));
+ str_value_cached= TRUE;
+ }
+ else if (!cache_value())
+ return NULL;
+ }
return &str_value;
}
diff --git a/sql/item.h b/sql/item.h
index e18fa43037a..c7a97ca716a 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1171,7 +1171,40 @@ public:
representation is more precise than the string one).
*/
virtual bool result_as_longlong() { return FALSE; }
- bool is_datetime();
+ inline bool is_datetime() const
+ {
+ switch (field_type())
+ {
+ case MYSQL_TYPE_DATE:
+ case MYSQL_TYPE_DATETIME:
+ case MYSQL_TYPE_TIMESTAMP:
+ return TRUE;
+ default:
+ break;
+ }
+ return FALSE;
+ }
+ /**
+ Check whether this and the given item has compatible comparison context.
+ Used by the equality propagation. See Item_field::equal_fields_propagator.
+
+ @return
+ TRUE if the context is the same or if fields could be
+ compared as DATETIME values by the Arg_comparator.
+ FALSE otherwise.
+ */
+ inline bool has_compatible_context(Item *item) const
+ {
+ /* Same context. */
+ if (cmp_context == (Item_result)-1 || item->cmp_context == cmp_context)
+ return TRUE;
+ /* DATETIME comparison context. */
+ if (is_datetime())
+ return item->is_datetime() || item->cmp_context == STRING_RESULT;
+ if (item->is_datetime())
+ return is_datetime() || cmp_context == STRING_RESULT;
+ return FALSE;
+ }
virtual Field::geometry_type get_geometry_type() const
{ return Field::GEOM_GEOMETRY; };
String *check_well_formed_result(String *str, bool send_error= 0);
@@ -2791,6 +2824,7 @@ protected:
cached_field_type= item->field_type();
cached_result_type= item->result_type();
unsigned_flag= item->unsigned_flag;
+ fixed= item->fixed;
}
public:
@@ -3231,6 +3265,7 @@ public:
virtual bool cache_value()= 0;
bool basic_const_item() const
{ return test(example && example->basic_const_item());}
+ virtual void clear() { null_value= TRUE; value_cached= FALSE; }
};
@@ -3411,6 +3446,7 @@ public:
*/
bool cache_value_int();
bool cache_value();
+ void clear() { Item_cache::clear(); str_value_cached= FALSE; }
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 3c871bc0663..2a7c9ac8144 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -876,8 +876,10 @@ get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
Do not cache GET_USER_VAR() function as its const_item() may return TRUE
for the current thread but it still may change during the execution.
*/
- if (item->const_item() && cache_arg && (item->type() != Item::FUNC_ITEM ||
- ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC))
+ if (item->const_item() && cache_arg &&
+ item->type() != Item::CACHE_ITEM &&
+ (item->type() != Item::FUNC_ITEM ||
+ ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC))
{
Item_cache_int *cache= new Item_cache_int();
/* Mark the cache as non-const to prevent re-caching. */
@@ -937,6 +939,7 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg,
get_value_a_func= &get_datetime_value;
get_value_b_func= &get_datetime_value;
cmp_collation.set(&my_charset_numeric);
+ set_cmp_context_for_datetime();
return 0;
}
else if (type == STRING_RESULT && (*a)->field_type() == MYSQL_TYPE_TIME &&
@@ -949,6 +952,7 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg,
func= &Arg_comparator::compare_datetime;
get_value_a_func= &get_time_value;
get_value_b_func= &get_time_value;
+ set_cmp_context_for_datetime();
return 0;
}
else if (type == STRING_RESULT &&
@@ -1005,6 +1009,7 @@ bool Arg_comparator::try_year_cmp_func(Item_result type)
is_nulls_eq= is_owner_equal_func();
func= &Arg_comparator::compare_datetime;
+ set_cmp_context_for_datetime();
return TRUE;
}
@@ -1058,6 +1063,7 @@ void Arg_comparator::set_datetime_cmp_func(Item_result_field *owner_arg,
func= &Arg_comparator::compare_datetime;
get_value_a_func= &get_datetime_value;
get_value_b_func= &get_datetime_value;
+ set_cmp_context_for_datetime();
}
@@ -1144,8 +1150,10 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
Do not cache GET_USER_VAR() function as its const_item() may return TRUE
for the current thread but it still may change during the execution.
*/
- if (item->const_item() && cache_arg && (item->type() != Item::FUNC_ITEM ||
- ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC))
+ if (item->const_item() && cache_arg &&
+ item->type() != Item::CACHE_ITEM &&
+ (item->type() != Item::FUNC_ITEM ||
+ ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC))
{
Item_cache_int *cache= new Item_cache_int(MYSQL_TYPE_DATETIME);
/* Mark the cache as non-const to prevent re-caching. */
@@ -2777,6 +2785,8 @@ Item *Item_func_case::find_item(String *str)
/* Compare every WHEN argument with it and return the first match */
for (uint i=0 ; i < ncases ; i+=2)
{
+ if (args[i]->real_item()->type() == NULL_ITEM)
+ continue;
cmp_type= item_cmp_type(left_result_type, args[i]->result_type());
DBUG_ASSERT(cmp_type != ROW_RESULT);
DBUG_ASSERT(cmp_items[(uint)cmp_type]);
@@ -4007,9 +4017,17 @@ longlong Item_func_in::val_int()
return (longlong) (!null_value && tmp != negated);
}
+ if ((null_value= args[0]->real_item()->type() == NULL_ITEM))
+ return 0;
+
have_null= 0;
for (uint i= 1 ; i < arg_count ; i++)
{
+ if (args[i]->real_item()->type() == NULL_ITEM)
+ {
+ have_null= TRUE;
+ continue;
+ }
Item_result cmp_type= item_cmp_type(left_result_type, args[i]->result_type());
in_item= cmp_items[(uint)cmp_type];
DBUG_ASSERT(in_item);
@@ -4571,13 +4589,14 @@ Item_func::optimize_type Item_func_like::select_optimize() const
if (args[1]->const_item())
{
String* res2= args[1]->val_str((String *)&cmp.value2);
+ const char *ptr2;
- if (!res2)
+ if (!res2 || !(ptr2= res2->ptr()))
return OPTIMIZE_NONE;
- if (*res2->ptr() != wild_many)
+ if (*ptr2 != wild_many)
{
- if (args[0]->result_type() != STRING_RESULT || *res2->ptr() != wild_one)
+ if (args[0]->result_type() != STRING_RESULT || *ptr2 != wild_one)
return OPTIMIZE_OP;
}
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 8813324262c..b20a6892ce2 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -123,7 +123,17 @@ public:
delete [] comparators;
comparators= 0;
}
-
+ /*
+ Set correct cmp_context if items would be compared as INTs.
+ */
+ inline void set_cmp_context_for_datetime()
+ {
+ DBUG_ASSERT(func == &Arg_comparator::compare_datetime);
+ if ((*a)->result_as_longlong())
+ (*a)->cmp_context= INT_RESULT;
+ if ((*b)->result_as_longlong())
+ (*b)->cmp_context= INT_RESULT;
+ }
friend class Item_func;
};
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 5f30a10d1e0..672e59986d5 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -5131,8 +5131,6 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
CHARSET_INFO *cs)
{
Item *UNINIT_VAR(res);
- ulong len;
- uint dec;
switch (cast_type) {
case ITEM_CAST_BINARY:
@@ -5155,11 +5153,10 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
break;
case ITEM_CAST_DECIMAL:
{
- if (c_len == NULL)
- {
- len= 0;
- }
- else
+ ulong len= 0;
+ uint dec= 0;
+
+ if (c_len)
{
ulong decoded_size;
errno= 0;
@@ -5173,11 +5170,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
len= decoded_size;
}
- if (c_dec == NULL)
- {
- dec= 0;
- }
- else
+ if (c_dec)
{
ulong decoded_size;
errno= 0;
@@ -5213,12 +5206,9 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
}
case ITEM_CAST_CHAR:
{
+ int len= -1;
CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection);
- if (c_len == NULL)
- {
- len= LL(-1);
- }
- else
+ if (c_len)
{
ulong decoded_size;
errno= 0;
@@ -5228,7 +5218,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH);
return NULL;
}
- len= decoded_size;
+ len= (int) decoded_size;
}
res= new (thd->mem_root) Item_char_typecast(a, len, real_cs);
break;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 26c802b8057..833eac6893b 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -51,6 +51,7 @@
#include "sp_rcontext.h"
#include "sp.h"
#include "set_var.h"
+#include "debug_sync.h"
#ifdef NO_EMBEDDED_ACCESS_CHECKS
#define sp_restore_security_context(A,B) while (0) {}
@@ -1941,6 +1942,8 @@ double Item_func_pow::val_real()
double Item_func_acos::val_real()
{
DBUG_ASSERT(fixed == 1);
+ /* One can use this to defer SELECT processing. */
+ DEBUG_SYNC(current_thd, "before_acos_function");
// the volatile's for BUG #2338 to calm optimizer down (because of gcc's bug)
volatile double value= args[0]->val_real();
if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0))))
@@ -3557,7 +3560,7 @@ public:
{
if (my_hash_insert(&hash_user_locks,(uchar*) this))
{
- my_free(key,MYF(0));
+ my_free(key);
key=0;
}
}
@@ -3567,7 +3570,7 @@ public:
if (key)
{
my_hash_delete(&hash_user_locks,(uchar*) this);
- my_free(key, MYF(0));
+ my_free(key);
}
mysql_cond_destroy(&cond);
}
@@ -4076,7 +4079,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
memcpy(entry->name.str, name.str, name.length+1);
if (my_hash_insert(hash,(uchar*) entry))
{
- my_free((char*) entry,MYF(0));
+ my_free(entry);
return 0;
}
}
@@ -4214,7 +4217,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
{
char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry));
if (entry->value && entry->value != pos)
- my_free(entry->value,MYF(0));
+ my_free(entry->value);
entry->value= 0;
entry->length= 0;
}
@@ -4229,7 +4232,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
if (entry->value != pos)
{
if (entry->value)
- my_free(entry->value,MYF(0));
+ my_free(entry->value);
entry->value=pos;
}
}
@@ -5066,6 +5069,7 @@ bool Item_func_get_user_var::set_value(THD *thd,
bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref)
{
DBUG_ASSERT(fixed == 0);
+ DBUG_ASSERT(thd->lex->exchange);
if (Item::fix_fields(thd, ref) ||
!(entry= get_variable(&thd->user_vars, name, 1)))
return TRUE;
@@ -5075,7 +5079,9 @@ bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref)
of fields in LOAD DATA INFILE.
(Since Item_user_var_as_out_param is used only there).
*/
- entry->collation.set(thd->variables.collation_database);
+ entry->collation.set(thd->lex->exchange->cs ?
+ thd->lex->exchange->cs :
+ thd->variables.collation_database);
entry->update_query_id= thd->query_id;
return FALSE;
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 61febb01e93..851d0e07a7e 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -72,7 +72,12 @@ String *Item_str_ascii_func::val_str(String *str)
DBUG_ASSERT(fixed == 1);
if (!(collation.collation->state & MY_CS_NONASCII))
- return val_str_ascii(str);
+ {
+ String *res= val_str_ascii(str);
+ if (res)
+ res->set_charset(collation.collation);
+ return res;
+ }
DBUG_ASSERT(str != &ascii_buf);
@@ -242,7 +247,7 @@ void Item_func_sha::fix_length_and_dec()
fix_length_and_charset(SHA1_HASH_SIZE * 2, default_charset());
}
-String *Item_func_sha2::val_str(String *str)
+String *Item_func_sha2::val_str_ascii(String *str)
{
DBUG_ASSERT(fixed == 1);
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
@@ -338,19 +343,19 @@ void Item_func_sha2::fix_length_and_dec()
switch (sha_variant) {
#ifndef OPENSSL_NO_SHA512
case 512:
- max_length= SHA512_DIGEST_LENGTH*2;
+ fix_length_and_charset(SHA512_DIGEST_LENGTH * 2, default_charset());
break;
case 384:
- max_length= SHA384_DIGEST_LENGTH*2;
+ fix_length_and_charset(SHA384_DIGEST_LENGTH * 2, default_charset());
break;
#endif
#ifndef OPENSSL_NO_SHA256
case 256:
case 0: // SHA-256 is the default
- max_length= SHA256_DIGEST_LENGTH*2;
+ fix_length_and_charset(SHA256_DIGEST_LENGTH * 2, default_charset());
break;
case 224:
- max_length= SHA224_DIGEST_LENGTH*2;
+ fix_length_and_charset(SHA224_DIGEST_LENGTH * 2, default_charset());
break;
#endif
default:
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 2a34babae87..df794ecaaf4 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -82,16 +82,13 @@ public:
const char *func_name() const { return "sha"; }
};
-class Item_func_sha2 :public Item_str_func
+class Item_func_sha2 :public Item_str_ascii_func
{
public:
- Item_func_sha2(Item *a, Item *b) :Item_str_func(a, b)
- {
- collation.set(&my_charset_bin);
- }
- String *val_str(String *);
- void fix_length_and_dec();
- const char *func_name() const { return "sha2"; }
+ Item_func_sha2(Item *a, Item *b) :Item_str_ascii_func(a, b) {}
+ String *val_str_ascii(String *);
+ void fix_length_and_dec();
+ const char *func_name() const { return "sha2"; }
};
class Item_func_aes_encrypt :public Item_str_func
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 77c45ea85f7..b05d845dead 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1214,8 +1214,7 @@ void Item_sum_hybrid::setup_hybrid(Item *item, Item *value_arg)
{
value= Item_cache::get_cache(item);
value->setup(item);
- if (value_arg)
- value->store(value_arg);
+ value->store(value_arg);
cmp= new Arg_comparator();
cmp->set_cmp_func(this, args, (Item**)&value, FALSE);
collation.set(item->collation);
@@ -1903,7 +1902,7 @@ void Item_sum_variance::update_field()
void Item_sum_hybrid::clear()
{
- value->null_value= 1;
+ value->clear();
null_value= 1;
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index b4539995632..2a722b93165 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1010,6 +1010,11 @@ protected:
void no_rows_in_result();
Field *create_tmp_field(bool group, TABLE *table,
uint convert_blob_length);
+ /*
+ MIN/MAX uses Item_cache_datetime for storing DATETIME values, thus
+ in this case a correct INT value can be provided.
+ */
+ bool result_as_longlong() { return args[0]->result_as_longlong(); }
};
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index feff03e704a..1c2c1cfe512 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -775,13 +775,11 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
str->append(hours_i < 12 ? "AM" : "PM",2);
break;
case 'r':
- length= my_sprintf(intbuff,
- (intbuff,
- ((l_time->hour % 24) < 12) ?
- "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM",
- (l_time->hour+11)%12+1,
- l_time->minute,
- l_time->second));
+ length= sprintf(intbuff, ((l_time->hour % 24) < 12) ?
+ "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM",
+ (l_time->hour+11)%12+1,
+ l_time->minute,
+ l_time->second);
str->append(intbuff, length);
break;
case 'S':
@@ -790,12 +788,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'T':
- length= my_sprintf(intbuff,
- (intbuff,
- "%02d:%02d:%02d",
- l_time->hour,
- l_time->minute,
- l_time->second));
+ length= sprintf(intbuff, "%02d:%02d:%02d",
+ l_time->hour, l_time->minute, l_time->second);
str->append(intbuff, length);
break;
case 'U':
@@ -3057,12 +3051,12 @@ String *Item_func_maketime::val_str(String *str)
char buf[28];
char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10);
int len = (int)(ptr - buf) +
- my_sprintf(ptr, (ptr, ":%02u:%02u", (uint)minute, (uint)second));
+ sprintf(ptr, ":%02u:%02u", (uint) minute, (uint) second);
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
buf, len, MYSQL_TIMESTAMP_TIME,
NullS);
}
-
+
if (make_time_with_warn((DATE_TIME_FORMAT *) 0, &ltime, str))
{
null_value= 1;
diff --git a/sql/keycaches.cc b/sql/keycaches.cc
index d68e2bccd96..14551803cfc 100644
--- a/sql/keycaches.cc
+++ b/sql/keycaches.cc
@@ -44,7 +44,7 @@ public:
}
~NAMED_ILINK()
{
- my_free((uchar*) name, MYF(0));
+ my_free((void *) name);
}
};
@@ -104,7 +104,7 @@ KEY_CACHE *create_key_cache(const char *name, uint length)
{
if (!new NAMED_ILINK(&key_caches, name, length, (uchar*) key_cache))
{
- my_free((char*) key_cache, MYF(0));
+ my_free(key_cache);
key_cache= 0;
}
else
@@ -140,7 +140,7 @@ KEY_CACHE *get_or_create_key_cache(const char *name, uint length)
void free_key_cache(const char *name, KEY_CACHE *key_cache)
{
end_key_cache(key_cache, 1); // Can never fail
- my_free((char*) key_cache, MYF(0));
+ my_free(key_cache);
}
diff --git a/sql/lock.cc b/sql/lock.cc
index 3f13f15454a..0743120ec6b 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -262,7 +262,7 @@ static void reset_lock_data(MYSQL_LOCK *sql_lock)
static void reset_lock_data_and_free(MYSQL_LOCK **mysql_lock)
{
reset_lock_data(*mysql_lock);
- my_free(*mysql_lock, MYF(0));
+ my_free(*mysql_lock);
*mysql_lock= 0;
}
@@ -384,7 +384,7 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock)
thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
if (sql_lock->table_count)
(void) unlock_external(thd,sql_lock->table,sql_lock->table_count);
- my_free((uchar*) sql_lock,MYF(0));
+ my_free(sql_lock);
DBUG_VOID_RETURN;
}
@@ -415,7 +415,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
THR_LOCK_DATA **lock=sql_lock->locks;
for (i=found=0 ; i < sql_lock->lock_count ; i++)
{
- if (sql_lock->locks[i]->type >= TL_WRITE_ALLOW_READ)
+ if (sql_lock->locks[i]->type > TL_WRITE_ALLOW_WRITE)
{
swap_variables(THR_LOCK_DATA *, *lock, sql_lock->locks[i]);
lock++;
@@ -435,7 +435,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
for (i=found=0 ; i < sql_lock->table_count ; i++)
{
DBUG_ASSERT(sql_lock->table[i]->lock_position == i);
- if ((uint) sql_lock->table[i]->reginfo.lock_type >= TL_WRITE_ALLOW_READ)
+ if ((uint) sql_lock->table[i]->reginfo.lock_type > TL_WRITE_ALLOW_WRITE)
{
swap_variables(TABLE *, *table, sql_lock->table[i]);
table++;
@@ -545,7 +545,7 @@ void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock)
{
for (uint i=0; i < locked->lock_count; i++)
thr_abort_locks(locked->locks[i]->lock, upgrade_lock);
- my_free((uchar*) locked,MYF(0));
+ my_free(locked);
}
DBUG_VOID_RETURN;
}
@@ -577,7 +577,7 @@ bool mysql_lock_abort_for_thread(THD *thd, TABLE *table)
table->in_use->thread_id))
result= TRUE;
}
- my_free((uchar*) locked,MYF(0));
+ my_free(locked);
}
DBUG_RETURN(result);
}
@@ -619,8 +619,8 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b)
}
/* Delete old, not needed locks */
- my_free((uchar*) a,MYF(0));
- my_free((uchar*) b,MYF(0));
+ my_free(a);
+ my_free(b);
thr_lock_merge_status(sql_lock->locks, sql_lock->lock_count);
DBUG_RETURN(sql_lock);
@@ -866,6 +866,8 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
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.
@retval FALSE Success.
@retval TRUE Failure (OOM or thread was killed).
@@ -880,12 +882,7 @@ bool lock_table_names(THD *thd, TABLE_LIST *table_list)
global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
for (lock_table= table_list; lock_table; lock_table= lock_table->next_local)
- {
- lock_table->mdl_request.init(MDL_key::TABLE,
- lock_table->db, lock_table->table_name,
- MDL_EXCLUSIVE);
mdl_requests.push_front(&lock_table->mdl_request);
- }
mdl_requests.push_front(&global_request);
@@ -1301,7 +1298,8 @@ wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
old_message=thd->enter_cond(&COND_global_read_lock, &LOCK_global_read_lock,
"Waiting for release of readlock");
while (must_wait && ! thd->killed &&
- (!abort_on_refresh || thd->version == refresh_version))
+ (!abort_on_refresh || !thd->open_tables ||
+ thd->open_tables->s->version == refresh_version))
{
DBUG_PRINT("signal", ("Waiting for COND_global_read_lock"));
mysql_cond_wait(&COND_global_read_lock, &LOCK_global_read_lock);
diff --git a/sql/lock.h b/sql/lock.h
index f7c19913675..84c7bce0679 100644
--- a/sql/lock.h
+++ b/sql/lock.h
@@ -15,33 +15,32 @@ typedef struct st_mysql_lock MYSQL_LOCK;
#define MYSQL_OPEN_TEMPORARY_ONLY 0x0004
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008
#define MYSQL_LOCK_LOG_TABLE 0x0010
-#define MYSQL_OPEN_TAKE_UPGRADABLE_MDL 0x0020
/**
Do not try to acquire a metadata lock on the table: we
already have one.
*/
-#define MYSQL_OPEN_HAS_MDL_LOCK 0x0040
+#define MYSQL_OPEN_HAS_MDL_LOCK 0x0020
/**
If in locked tables mode, ignore the locked tables and get
a new instance of the table.
*/
-#define MYSQL_OPEN_GET_NEW_TABLE 0x0080
+#define MYSQL_OPEN_GET_NEW_TABLE 0x0040
/** Don't look up the table in the list of temporary tables. */
-#define MYSQL_OPEN_SKIP_TEMPORARY 0x0100
+#define MYSQL_OPEN_SKIP_TEMPORARY 0x0080
/** Fail instead of waiting when conficting metadata lock is discovered. */
-#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0200
+#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0100
/** Open tables using MDL_SHARED lock instead of one specified in parser. */
-#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0400
+#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0200
/**
Open tables using MDL_SHARED_HIGH_PRIO lock instead of one specified
in parser.
*/
-#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0800
+#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0400
/**
When opening or locking the table, use the maximum timeout
(LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value.
*/
-#define MYSQL_LOCK_IGNORE_TIMEOUT 0x1000
+#define MYSQL_LOCK_IGNORE_TIMEOUT 0x0800
/** Please refer to the internals manual. */
#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
diff --git a/sql/log.cc b/sql/log.cc
index fd17e04b212..b398cb1e73f 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -209,7 +209,7 @@ class binlog_cache_data
{
public:
binlog_cache_data(): m_pending(0), before_stmt_pos(MY_OFF_T_UNDEF),
- incident(FALSE)
+ incident(FALSE), changes_to_non_trans_temp_table_flag(FALSE)
{
cache_log.end_of_file= max_binlog_cache_size;
}
@@ -245,9 +245,20 @@ public:
return(incident);
}
+ void set_changes_to_non_trans_temp_table()
+ {
+ changes_to_non_trans_temp_table_flag= TRUE;
+ }
+
+ bool changes_to_non_trans_temp_table()
+ {
+ return (changes_to_non_trans_temp_table_flag);
+ }
+
void reset()
{
truncate(0);
+ changes_to_non_trans_temp_table_flag= FALSE;
incident= FALSE;
before_stmt_pos= MY_OFF_T_UNDEF;
cache_log.end_of_file= max_binlog_cache_size;
@@ -305,6 +316,12 @@ private:
bool incident;
/*
+ This flag indicates if the cache has changes to temporary tables.
+ @TODO This a temporary fix and should be removed after BUG#54562.
+ */
+ bool changes_to_non_trans_temp_table_flag;
+
+ /*
It truncates the cache to a certain position. This includes deleting the
pending event.
*/
@@ -370,8 +387,8 @@ bool LOGGER::is_log_table_enabled(uint log_table_type)
/* Check if a given table is opened log table */
-int check_if_log_table(uint db_len, const char *db, uint table_name_len,
- const char *table_name, uint check_if_opened)
+int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
+ const char *table_name, bool check_if_opened)
{
if (db_len == 5 &&
!(lower_case_table_names ?
@@ -1484,7 +1501,7 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
DBUG_ASSERT(cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty());
thd_set_ha_data(thd, binlog_hton, NULL);
cache_mngr->~binlog_cache_mngr();
- my_free((uchar*)cache_mngr, MYF(0));
+ my_free(cache_mngr);
return 0;
}
@@ -1772,13 +1789,23 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
/*
We flush the cache wrapped in a beging/rollback if:
. aborting a single or multi-statement transaction and;
- . the format is STMT and non-trans engines were updated or;
- . the OPTION_KEEP_LOG is activate.
+ . the OPTION_KEEP_LOG is active or;
+ . the format is STMT and a non-trans table was updated or;
+ . the format is MIXED and a temporary non-trans table was
+ updated or;
+ . the format is MIXED, non-trans table was updated and
+ aborting a single statement transaction;
*/
+
if (ending_trans(thd, all) &&
((thd->variables.option_bits & OPTION_KEEP_LOG) ||
(trans_has_updated_non_trans_table(thd) &&
- thd->variables.binlog_format == BINLOG_FORMAT_STMT)))
+ thd->variables.binlog_format == BINLOG_FORMAT_STMT) ||
+ (cache_mngr->trx_cache.changes_to_non_trans_temp_table() &&
+ thd->variables.binlog_format == BINLOG_FORMAT_MIXED) ||
+ (trans_has_updated_non_trans_table(thd) &&
+ ending_single_stmt_trans(thd,all) &&
+ thd->variables.binlog_format == BINLOG_FORMAT_MIXED)))
{
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE, TRUE, 0);
error= binlog_flush_trx_cache(thd, cache_mngr, &qev);
@@ -1786,13 +1813,18 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
/*
Truncate the cache if:
. aborting a single or multi-statement transaction or;
- . the OPTION_KEEP_LOG is not activate and;
- . the format is not STMT or no non-trans were updated.
+ . the OPTION_KEEP_LOG is not active and;
+ . the format is not STMT or no non-trans table was
+ updated and;
+ . the format is not MIXED or no temporary non-trans table
+ was updated.
*/
else if (ending_trans(thd, all) ||
(!(thd->variables.option_bits & OPTION_KEEP_LOG) &&
- ((!stmt_has_updated_non_trans_table(thd) ||
- thd->variables.binlog_format != BINLOG_FORMAT_STMT))))
+ (!stmt_has_updated_non_trans_table(thd) ||
+ thd->variables.binlog_format != BINLOG_FORMAT_STMT) &&
+ (!cache_mngr->trx_cache.changes_to_non_trans_temp_table() ||
+ thd->variables.binlog_format != BINLOG_FORMAT_MIXED)))
error= binlog_truncate_trx_cache(thd, cache_mngr, all);
}
@@ -2044,7 +2076,7 @@ static int find_uniq_filename(char *name)
file_info= dir_info->dir_entry;
for (i= dir_info->number_off_files ; i-- ; file_info++)
{
- if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 &&
+ if (memcmp(file_info->name, start, length) == 0 &&
test_if_number(file_info->name+length, &number,0))
{
set_if_bigger(max_found,(ulong) number);
@@ -2213,7 +2245,8 @@ shutdown the MySQL server and restart it.", name, errno);
if (file >= 0)
mysql_file_close(file, MYF(0));
end_io_cache(&log_file);
- safeFree(name);
+ my_free(name);
+ name= NULL;
log_state= LOG_CLOSED;
DBUG_RETURN(1);
}
@@ -2274,7 +2307,8 @@ void MYSQL_LOG::close(uint exiting)
}
log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED;
- safeFree(name);
+ my_free(name);
+ name= NULL;
DBUG_VOID_RETURN;
}
@@ -2352,7 +2386,7 @@ void MYSQL_QUERY_LOG::reopen_file()
*/
open(save_name, log_type, 0, io_cache_type);
- my_free(save_name, MYF(0));
+ my_free(save_name);
mysql_mutex_unlock(&LOCK_log);
@@ -2953,7 +2987,8 @@ shutdown the MySQL server and restart it.", name, errno);
mysql_file_close(file, MYF(0));
end_io_cache(&log_file);
end_io_cache(&index_file);
- safeFree(name);
+ my_free(name);
+ name= NULL;
log_state= LOG_CLOSED;
DBUG_RETURN(1);
}
@@ -3286,7 +3321,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
need_start_event=1;
if (!open_index_file(index_file_name, 0, FALSE))
open(save_name, log_type, 0, io_cache_type, no_auto_events, max_size, 0, FALSE);
- my_free((uchar*) save_name, MYF(0));
+ my_free((void *) save_name);
err:
if (error == 1)
@@ -3424,7 +3459,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
DBUG_ASSERT(!included || rli->linfo.index_file_start_offset == 0);
err:
- my_free(to_purge_if_included, MYF(0));
+ my_free(to_purge_if_included);
mysql_mutex_unlock(&LOCK_index);
DBUG_RETURN(error);
}
@@ -4064,7 +4099,7 @@ void MYSQL_BIN_LOG::new_file_impl(bool need_lock)
if (!open_index_file(index_file_name, 0, FALSE))
open(old_name, log_type, new_name_ptr,
io_cache_type, no_auto_events, max_size, 1, FALSE);
- my_free(old_name,MYF(0));
+ my_free(old_name);
end:
if (need_lock)
@@ -4254,7 +4289,23 @@ bool use_trans_cache(const THD* thd, bool is_transactional)
*/
bool ending_trans(THD* thd, const bool all)
{
- return (all || (!all && !thd->in_multi_stmt_transaction_mode()));
+ return (all || ending_single_stmt_trans(thd, all));
+}
+
+/**
+ This function checks if a single statement transaction is about
+ to commit or not.
+
+ @param thd The client thread that executed the current statement.
+ @param all Committing a transaction (i.e. TRUE) or a statement
+ (i.e. FALSE).
+ @return
+ @c true if committing a single statement transaction, otherwise
+ @c false.
+*/
+bool ending_single_stmt_trans(THD* thd, const bool all)
+{
+ return (!all && !thd->in_multi_stmt_transaction_mode());
}
/**
@@ -4306,7 +4357,7 @@ int THD::binlog_setup_trx_data()
open_cached_file(&cache_mngr->trx_cache.cache_log, mysql_tmpdir,
LOG_PREFIX, binlog_cache_size, MYF(MY_WME)))
{
- my_free((uchar*)cache_mngr, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(cache_mngr);
DBUG_RETURN(1); // Didn't manage to set it up
}
thd_set_ha_data(this, binlog_hton, cache_mngr);
@@ -4653,6 +4704,9 @@ 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())
+ cache_data->set_changes_to_non_trans_temp_table();
+
thd->binlog_start_trans_and_stmt();
}
DBUG_PRINT("info",("event type: %d",event_info->get_type_code()));
@@ -5310,7 +5364,8 @@ void MYSQL_BIN_LOG::close(uint exiting)
}
}
log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED;
- safeFree(name);
+ my_free(name);
+ name= NULL;
DBUG_VOID_RETURN;
}
@@ -6001,7 +6056,7 @@ void TC_LOG_MMAP::close()
mysql_cond_destroy(&pages[i].cond);
}
case 3:
- my_free((uchar*)pages, MYF(0));
+ my_free(pages);
case 2:
my_munmap((char*)data, (size_t)file_length);
case 1:
diff --git a/sql/log.h b/sql/log.h
index cd3faace598..4a58c3081d8 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -27,6 +27,7 @@ bool trans_has_updated_trans_table(const THD* thd);
bool stmt_has_updated_trans_table(const THD *thd);
bool use_trans_cache(const THD* thd, bool is_transactional);
bool ending_trans(THD* thd, const bool all);
+bool ending_single_stmt_trans(THD* thd, const bool all);
bool trans_has_updated_non_trans_table(const THD* thd);
bool stmt_has_updated_non_trans_table(const THD* thd);
@@ -490,8 +491,8 @@ public:
};
-int check_if_log_table(uint db_len, const char *db, uint table_name_len,
- const char *table_name, uint check_if_opened);
+int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
+ const char *table_name, bool check_if_opened);
class Log_to_csv_event_handler: public Log_event_handler
{
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 7778ee18f5c..5236a2794cf 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -678,8 +678,9 @@ 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->thread_temporary_used
+ cache_type= ((using_trans || stmt_has_updated_trans_table(thd) ||
+ (thd->stmt_accessed_temp_table() &&
+ trans_has_updated_trans_table(thd)))
? Log_event::EVENT_TRANSACTIONAL_CACHE :
Log_event::EVENT_STMT_CACHE);
}
@@ -1148,7 +1149,7 @@ err:
sql_print_error("Error in Log_event::read_log_event(): "
"'%s', data_len: %d, event_type: %d",
error,data_len,head[EVENT_TYPE_OFFSET]);
- my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buf);
/*
The SQL slave thread will check if file->error<0 to know
if there was an I/O error. Even if there is no "low-level" I/O errors
@@ -1653,17 +1654,17 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
int i, end;
char buff[512], *pos;
pos= buff;
- pos+= my_sprintf(buff, (buff, "%s", dec.sign() ? "-" : ""));
+ pos+= sprintf(buff, "%s", dec.sign() ? "-" : "");
end= ROUND_UP(dec.frac) + ROUND_UP(dec.intg)-1;
for (i=0; i < end; i++)
- pos+= my_sprintf(pos, (pos, "%09d.", dec.buf[i]));
- pos+= my_sprintf(pos, (pos, "%09d", dec.buf[i]));
+ pos+= sprintf(pos, "%09d.", dec.buf[i]);
+ pos+= sprintf(pos, "%09d", dec.buf[i]);
my_b_printf(file, "%s", buff);
my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)",
precision, decimals);
return bin_size;
}
-
+
case MYSQL_TYPE_FLOAT:
{
float fl;
@@ -2065,7 +2066,7 @@ void Log_event::print_base64(IO_CACHE* file,
}
}
- my_free(tmp_str, MYF(0));
+ my_free(tmp_str);
DBUG_VOID_RETURN;
}
@@ -2145,7 +2146,7 @@ void Query_log_event::pack_info(Protocol *protocol)
pos+= q_len;
}
protocol->store(buf, pos-buf, &my_charset_bin);
- my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buf);
}
#endif
@@ -2323,6 +2324,53 @@ bool Query_log_event::write(IO_CACHE* file)
start+= 4;
}
+ if (thd && thd->is_current_user_used())
+ {
+ LEX_STRING user;
+ LEX_STRING host;
+ memset(&user, 0, sizeof(user));
+ memset(&host, 0, sizeof(host));
+
+ if (thd->slave_thread && thd->has_invoker())
+ {
+ /* user will be null, if master is older than this patch */
+ user= thd->get_invoker_user();
+ host= thd->get_invoker_host();
+ }
+ else if (thd->security_ctx->priv_user)
+ {
+ Security_context *ctx= thd->security_ctx;
+
+ user.length= strlen(ctx->priv_user);
+ user.str= ctx->priv_user;
+ if (ctx->priv_host[0] != '\0')
+ {
+ host.str= ctx->priv_host;
+ host.length= strlen(ctx->priv_host);
+ }
+ }
+
+ if (user.length > 0)
+ {
+ *start++= Q_INVOKER;
+
+ /*
+ Store user length and user. The max length of use is 16, so 1 byte is
+ enough to store the user's length.
+ */
+ *start++= (uchar)user.length;
+ memcpy(start, user.str, user.length);
+ start+= user.length;
+
+ /*
+ Store host length and host. The max length of host is 60, so 1 byte is
+ enough to store the host's length.
+ */
+ *start++= (uchar)host.length;
+ memcpy(start, host.str, host.length);
+ start+= host.length;
+ }
+ }
/*
NOTE: When adding new status vars, please don't forget to update
the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function
@@ -2365,6 +2413,8 @@ bool Query_log_event::write(IO_CACHE* file)
Query_log_event::Query_log_event()
:Log_event(), data_buf(0)
{
+ memset(&user, 0, sizeof(user));
+ memset(&host, 0, sizeof(host));
}
@@ -2407,6 +2457,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
{
time_t end_time;
+ memset(&user, 0, sizeof(user));
+ memset(&host, 0, sizeof(host));
+
error_code= errcode;
time(&end_time);
@@ -2519,8 +2572,9 @@ 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->thread_temporary_used)
+ cache_type= ((using_trans || stmt_has_updated_trans_table(thd) || trx_cache ||
+ (thd->stmt_accessed_temp_table() &&
+ trans_has_updated_trans_table(thd)))
? Log_event::EVENT_TRANSACTIONAL_CACHE :
Log_event::EVENT_STMT_CACHE);
}
@@ -2652,6 +2706,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
bool catalog_nz= 1;
DBUG_ENTER("Query_log_event::Query_log_event(char*,...)");
+ memset(&user, 0, sizeof(user));
+ memset(&host, 0, sizeof(host));
common_header_len= description_event->common_header_len;
post_header_len= description_event->post_header_len[event_type-1];
DBUG_PRINT("info",("event_len: %u common_header_len: %d post_header_len: %d",
@@ -2806,6 +2862,20 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
data_written= master_data_written= uint4korr(pos);
pos+= 4;
break;
+ case Q_INVOKER:
+ {
+ CHECK_SPACE(pos, end, 1);
+ user.length= *pos++;
+ CHECK_SPACE(pos, end, user.length);
+ user.str= (char *)pos;
+ pos+= user.length;
+
+ CHECK_SPACE(pos, end, 1);
+ host.length= *pos++;
+ CHECK_SPACE(pos, end, host.length);
+ host.str= (char *)pos;
+ pos+= host.length;
+ }
default:
/* That's why you must write status vars in growing order of code */
DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
@@ -2819,12 +2889,16 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
time_zone_len + 1 +
data_len + 1 +
QUERY_CACHE_FLAGS_SIZE +
+ user.length + 1 +
+ host.length + 1 +
db_len + 1,
MYF(MY_WME))))
#else
if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
time_zone_len + 1 +
- data_len + 1,
+ data_len + 1 +
+ user.length + 1 +
+ host.length + 1,
MYF(MY_WME))))
#endif
DBUG_VOID_RETURN;
@@ -2847,6 +2921,11 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
if (time_zone_len)
copy_str_and_move(&time_zone_str, &start, time_zone_len);
+ if (user.length > 0)
+ copy_str_and_move((const char **)&(user.str), &start, user.length);
+ if (host.length > 0)
+ copy_str_and_move((const char **)&(host.str), &start, host.length);
+
/**
if time_zone_len or catalog_len are 0, then time_zone and catalog
are uninitialized at this point. shouldn't they point to the
@@ -2982,7 +3061,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
if (likely(charset_inited) &&
(unlikely(!print_event_info->charset_inited ||
- bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6))))
+ memcmp(print_event_info->charset, charset, 6))))
{
CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
if (cs_info)
@@ -3005,8 +3084,8 @@ void Query_log_event::print_query_header(IO_CACHE* file,
}
if (time_zone_len)
{
- if (bcmp((uchar*) print_event_info->time_zone_str,
- (uchar*) time_zone_str, time_zone_len+1))
+ if (memcmp(print_event_info->time_zone_str,
+ time_zone_str, time_zone_len+1))
{
my_b_printf(file,"SET @@session.time_zone='%s'%s\n",
time_zone_str, print_event_info->delimiter);
@@ -3252,7 +3331,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
thd->variables.collation_database= thd->db_charset;
thd->table_map_for_update= (table_map)table_map_for_update;
-
+ thd->set_invoker(&user, &host);
/* Execute the query (note that we bypass dispatch_command()) */
Parser_state parser_state;
if (!parser_state.init(thd, thd->query(), thd->query_length()))
@@ -3963,7 +4042,7 @@ Format_description_log_event(const char* buf,
DBUG_PRINT("info", (" number_of_event_types=%d",
number_of_event_types));
/* this makes is_valid() return false. */
- my_free(post_header_len, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(post_header_len);
post_header_len= NULL;
DBUG_VOID_RETURN;
}
@@ -4286,7 +4365,7 @@ void Load_log_event::pack_info(Protocol *protocol)
return;
print_query(TRUE, NULL, buf, &end, 0, 0);
protocol->store(buf, end-buf, &my_charset_bin);
- my_free(buf, MYF(0));
+ my_free(buf);
}
#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
@@ -5555,7 +5634,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
buf[2+name_len]= '`';
buf[3+name_len]= '=';
protocol->store(buf, event_len, &my_charset_bin);
- my_free(buf, MYF(0));
+ my_free(buf);
}
#endif /* !MYSQL_CLIENT */
@@ -5711,7 +5790,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
double real_val;
char real_buf[FMT_G_BUFSIZE(14)];
float8get(real_val, val);
- my_sprintf(real_buf, (real_buf, "%.14g", real_val));
+ sprintf(real_buf, "%.14g", real_val);
my_b_printf(&cache, ":=%s%s\n", real_buf, print_event_info->delimiter);
break;
case INT_RESULT:
@@ -5970,7 +6049,7 @@ Slave_log_event::Slave_log_event(THD* thd_arg,
Slave_log_event::~Slave_log_event()
{
- my_free(mem_pool, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mem_pool);
}
@@ -6470,10 +6549,9 @@ void Append_block_log_event::print(FILE* file,
void Append_block_log_event::pack_info(Protocol *protocol)
{
char buf[256];
- uint length;
- length= (uint) my_sprintf(buf,
- (buf, ";file_id=%u;block_len=%u", file_id,
- block_len));
+ size_t length;
+ length= my_snprintf(buf, sizeof(buf), ";file_id=%u;block_len=%u",
+ file_id, block_len);
protocol->store(buf, length, &my_charset_bin);
}
@@ -6628,9 +6706,9 @@ void Delete_file_log_event::print(FILE* file,
void Delete_file_log_event::pack_info(Protocol *protocol)
{
char buf[64];
- uint length;
- length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
- protocol->store(buf, (int32) length, &my_charset_bin);
+ size_t length;
+ length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id);
+ protocol->store(buf, length, &my_charset_bin);
}
#endif
@@ -6726,9 +6804,9 @@ void Execute_load_log_event::print(FILE* file,
void Execute_load_log_event::pack_info(Protocol *protocol)
{
char buf[64];
- uint length;
- length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
- protocol->store(buf, (int32) length, &my_charset_bin);
+ size_t length;
+ length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id);
+ protocol->store(buf, length, &my_charset_bin);
}
@@ -6792,7 +6870,7 @@ int Execute_load_log_event::do_apply_event(Relay_log_info const *rli)
{
rli->report(ERROR_LEVEL, rli->last_error().number,
"%s. Failed executing load from '%s'", tmp, fname);
- my_free(tmp,MYF(0));
+ my_free(tmp);
}
goto err;
}
@@ -6997,7 +7075,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol)
pos= strmov(pos, " ;file_id=");
pos= int10_to_str((long) file_id, pos, 10);
protocol->store(buf, pos-buf, &my_charset_bin);
- my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buf);
}
@@ -7013,7 +7091,7 @@ Execute_load_query_log_event::do_apply_event(Relay_log_info const *rli)
buf= (char*) my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) +
(FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME));
- DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", my_free(buf, MYF(0)); buf= NULL;);
+ DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", my_free(buf); buf= NULL;);
/* Replace filename and LOCAL keyword in query before executing it */
if (buf == NULL)
@@ -7056,7 +7134,7 @@ Execute_load_query_log_event::do_apply_event(Relay_log_info const *rli)
if (!error)
mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME));
- my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buf);
return error;
}
#endif
@@ -7321,7 +7399,7 @@ Rows_log_event::~Rows_log_event()
if (m_cols.bitmap == m_bitbuf) // no my_malloc happened
m_cols.bitmap= 0; // so no my_free in bitmap_free
bitmap_free(&m_cols); // To pair with bitmap_init().
- my_free((uchar*)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_rows_buf);
}
int Rows_log_event::get_data_size()
@@ -8245,8 +8323,8 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
Table_map_log_event::~Table_map_log_event()
{
- my_free(m_meta_memory, MYF(MY_ALLOW_ZERO_PTR));
- my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_meta_memory);
+ my_free(m_memory);
}
/*
@@ -8296,7 +8374,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
(!rpl_filter->db_ok(table_list->db) ||
(rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list))))
{
- my_free(memory, MYF(MY_WME));
+ my_free(memory);
}
else
{
@@ -8654,7 +8732,7 @@ Rows_log_event::write_row(const Relay_log_info *const rli,
TABLE *table= m_table; // pointer to event's table
int error;
- int keynum;
+ int UNINIT_VAR(keynum);
auto_afree_ptr<char> key(NULL);
/* fill table->record[0] with default values */
@@ -8848,19 +8926,19 @@ Rows_log_event::write_row(const Relay_log_info *const rli,
#endif
-int
+int
Write_rows_log_event::do_exec_row(const Relay_log_info *const rli)
{
DBUG_ASSERT(m_table != NULL);
int error= write_row(rli, slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT);
-
+
if (error && !thd->is_error())
{
DBUG_ASSERT(0);
my_error(ER_UNKNOWN_ERROR, MYF(0));
}
-
- return error;
+
+ return error;
}
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
@@ -9351,7 +9429,7 @@ Delete_rows_log_event::do_after_row_operations(const Slave_reporting_capability
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
m_table->file->ha_index_or_rnd_end();
- my_free(m_key, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_key);
m_key= NULL;
return error;
@@ -9474,7 +9552,7 @@ Update_rows_log_event::do_after_row_operations(const Slave_reporting_capability
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
m_table->file->ha_index_or_rnd_end();
- my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc
+ my_free(m_key); // Free for multi_malloc
m_key= NULL;
return error;
diff --git a/sql/log_event.h b/sql/log_event.h
index bd95c74b6c5..5d7250d8ebd 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -270,7 +270,8 @@ struct sql_ex_info
1 + 2 /* type, lc_time_names_number */ + \
1 + 2 /* type, charset_database_number */ + \
1 + 8 /* type, table_map_for_update */ + \
- 1 + 4 /* type, master_data_written */)
+ 1 + 4 /* type, master_data_written */ + \
+ 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */)
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
@@ -339,6 +340,8 @@ struct sql_ex_info
#define Q_MASTER_DATA_WRITTEN_CODE 10
+#define Q_INVOKER 11
+
/* Intvar event post-header */
/* Intvar event data */
@@ -1031,7 +1034,7 @@ public:
static void operator delete(void *ptr, size_t size)
{
- my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
+ my_free(ptr);
}
/* Placement version of the above operators */
@@ -1088,7 +1091,7 @@ public:
{
if (temp_buf)
{
- my_free(temp_buf, MYF(0));
+ my_free(temp_buf);
temp_buf = 0;
}
}
@@ -1610,6 +1613,8 @@ protected:
*/
class Query_log_event: public Log_event
{
+ LEX_STRING user;
+ LEX_STRING host;
protected:
Log_event::Byte* data_buf;
public:
@@ -1720,7 +1725,7 @@ public:
~Query_log_event()
{
if (data_buf)
- my_free((uchar*) data_buf, MYF(0));
+ my_free(data_buf);
}
Log_event_type get_type_code() { return QUERY_EVENT; }
#ifdef MYSQL_SERVER
@@ -2299,7 +2304,7 @@ public:
*description_event);
~Format_description_log_event()
{
- my_free((uchar*)post_header_len, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(post_header_len);
}
Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
#ifdef MYSQL_SERVER
@@ -2698,7 +2703,7 @@ public:
~Rotate_log_event()
{
if (flags & DUP_NAME)
- my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((void*) new_log_ident);
}
Log_event_type get_type_code() { return ROTATE_EVENT;}
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
@@ -2760,7 +2765,7 @@ public:
const Format_description_log_event* description_event);
~Create_file_log_event()
{
- my_free((char*) event_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((void*) event_buf);
}
Log_event_type get_type_code()
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index d9b48cd134e..88df4970816 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -418,7 +418,7 @@ copy_extra_record_fields(TABLE *table,
DBUG_ASSERT(master_reclength <= table->s->reclength);
if (master_reclength < table->s->reclength)
- bmove_align(table->record[0] + master_reclength,
+ memcpy(table->record[0] + master_reclength,
table->record[1] + master_reclength,
table->s->reclength - master_reclength);
@@ -697,7 +697,7 @@ static int find_and_fetch_row(TABLE *table, uchar *key)
rnd_pos() returns the record in table->record[0], so we have to
move it to table->record[1].
*/
- bmove_align(table->record[1], table->record[0], table->s->reclength);
+ memcpy(table->record[1], table->record[0], table->s->reclength);
DBUG_RETURN(error);
}
@@ -1017,7 +1017,7 @@ int Delete_rows_log_event_old::do_after_row_operations(TABLE *table, int error)
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
table->file->ha_index_or_rnd_end();
- my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc
+ my_free(m_memory); // Free for multi_malloc
m_memory= NULL;
m_after_image= NULL;
m_key= NULL;
@@ -1116,7 +1116,7 @@ int Update_rows_log_event_old::do_after_row_operations(TABLE *table, int error)
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
table->file->ha_index_or_rnd_end();
- my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_memory);
m_memory= NULL;
m_after_image= NULL;
m_key= NULL;
@@ -1190,7 +1190,7 @@ int Update_rows_log_event_old::do_exec_row(TABLE *table)
overwriting the default values that where put there by the
unpack_row() function.
*/
- bmove_align(table->record[0], m_after_image, table->s->reclength);
+ memcpy(table->record[0], m_after_image, table->s->reclength);
copy_extra_record_fields(table, m_master_reclength, m_width);
/*
@@ -1360,7 +1360,7 @@ Old_rows_log_event::~Old_rows_log_event()
if (m_cols.bitmap == m_bitbuf) // no my_malloc happened
m_cols.bitmap= 0; // so no my_free in bitmap_free
bitmap_free(&m_cols); // To pair with bitmap_init().
- my_free((uchar*)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_rows_buf);
}
@@ -2698,7 +2698,7 @@ Delete_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabil
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
m_table->file->ha_index_or_rnd_end();
- my_free(m_key, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(m_key);
m_key= NULL;
return error;
@@ -2797,7 +2797,7 @@ Update_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabil
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
m_table->file->ha_index_or_rnd_end();
- my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc
+ my_free(m_key); // Free for multi_malloc
m_key= NULL;
return error;
diff --git a/sql/mdl.cc b/sql/mdl.cc
index ddf518fbb1c..0426a410d98 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -21,28 +21,28 @@
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_MDL_map_mutex;
-static PSI_mutex_key key_MDL_context_signal_mutex;
+static PSI_mutex_key key_MDL_wait_LOCK_wait_status;
static PSI_mutex_info all_mdl_mutexes[]=
{
{ &key_MDL_map_mutex, "MDL_map::mutex", PSI_FLAG_GLOBAL},
- { &key_MDL_context_signal_mutex, "MDL_context::signal", 0}
+ { &key_MDL_wait_LOCK_wait_status, "MDL_wait::LOCK_wait_status", 0}
};
static PSI_rwlock_key key_MDL_lock_rwlock;
-static PSI_rwlock_key key_MDL_context_waiting_for_rwlock;
+static PSI_rwlock_key key_MDL_context_LOCK_waiting_for;
static PSI_rwlock_info all_mdl_rwlocks[]=
{
{ &key_MDL_lock_rwlock, "MDL_lock::rwlock", 0},
- { &key_MDL_context_waiting_for_rwlock, "MDL_context::waiting_for_lock", 0}
+ { &key_MDL_context_LOCK_waiting_for, "MDL_context::LOCK_waiting_for", 0}
};
-static PSI_cond_key key_MDL_context_signal_cond;
+static PSI_cond_key key_MDL_wait_COND_wait_status;
static PSI_cond_info all_mdl_conds[]=
{
- { &key_MDL_context_signal_cond, "MDL_context::signal", 0}
+ { &key_MDL_wait_COND_wait_status, "MDL_context::COND_wait_status", 0}
};
/**
@@ -105,23 +105,46 @@ enum enum_deadlock_weight
};
-
/**
A context of the recursive traversal through all contexts
in all sessions in search for deadlock.
*/
-class Deadlock_detection_context
+class Deadlock_detection_visitor
{
public:
- Deadlock_detection_context(MDL_context *start_arg)
- : start(start_arg),
- victim(NULL),
- current_search_depth(0)
- { }
- MDL_context *start;
- MDL_context *victim;
- uint current_search_depth;
+ Deadlock_detection_visitor(MDL_context *start_node_arg)
+ : m_start_node(start_node_arg),
+ m_victim(NULL),
+ m_current_search_depth(0)
+ {}
+ bool enter_node(MDL_context * /* unused */);
+ void leave_node(MDL_context * /* unused */);
+
+ bool inspect_edge(MDL_context *dest);
+
+ MDL_context *get_victim() const { return m_victim; }
+
+ /**
+ Change the deadlock victim to a new one if it has lower deadlock
+ weight.
+ */
+ MDL_context *opt_change_victim_to(MDL_context *new_victim);
+private:
+ /**
+ The context which has initiated the search. There
+ can be multiple searches happening in parallel at the same time.
+ */
+ MDL_context *m_start_node;
+ /** If a deadlock is found, the context that identifies the victim. */
+ MDL_context *m_victim;
+ /** Set to the 0 at start. Increased whenever
+ we descend into another MDL context (aka traverse to the next
+ wait-for graph node). When MAX_SEARCH_DEPTH is reached, we
+ assume that a deadlock is found, even if we have not found a
+ loop.
+ */
+ uint m_current_search_depth;
/**
Maximum depth for deadlock searches. After this depth is
achieved we will unconditionally declare that there is a
@@ -140,6 +163,74 @@ public:
/**
+ Enter a node of a wait-for graph. After
+ a node is entered, inspect_edge() will be called
+ for all wait-for destinations of this node. Then
+ leave_node() will be called.
+ We call "enter_node()" for all nodes we inspect,
+ including the starting node.
+
+ @retval TRUE Maximum search depth exceeded.
+ @retval FALSE OK.
+*/
+
+bool Deadlock_detection_visitor::enter_node(MDL_context * /* unused */)
+{
+ if (++m_current_search_depth >= MAX_SEARCH_DEPTH)
+ return TRUE;
+ return FALSE;
+}
+
+
+/**
+ Done inspecting this node. Decrease the search
+ depth. Clear the node for debug safety.
+*/
+
+void Deadlock_detection_visitor::leave_node(MDL_context * /* unused */)
+{
+ --m_current_search_depth;
+}
+
+
+/**
+ Inspect a wait-for graph edge from one MDL context to another.
+
+ @retval TRUE A loop is found.
+ @retval FALSE No loop is found.
+*/
+
+bool Deadlock_detection_visitor::inspect_edge(MDL_context *node)
+{
+ return node == m_start_node;
+}
+
+
+/**
+ Change the deadlock victim to a new one if it has lower deadlock
+ weight.
+
+ @retval new_victim Victim is not changed.
+ @retval !new_victim New victim became the current.
+*/
+
+MDL_context *
+Deadlock_detection_visitor::opt_change_victim_to(MDL_context *new_victim)
+{
+ if (m_victim == NULL ||
+ m_victim->get_deadlock_weight() >= new_victim->get_deadlock_weight())
+ {
+ /* Swap victims, unlock the old one. */
+ MDL_context *tmp= m_victim;
+ m_victim= new_victim;
+ return tmp;
+ }
+ /* No change, unlock the current context. */
+ return new_victim;
+}
+
+
+/**
Get a bit corresponding to enum_mdl_type value in a granted/waiting bitmaps
and compatibility matrices.
*/
@@ -168,7 +259,9 @@ public:
typedef I_P_List<MDL_ticket,
I_P_List_adapter<MDL_ticket,
&MDL_ticket::next_in_lock,
- &MDL_ticket::prev_in_lock> >
+ &MDL_ticket::prev_in_lock>,
+ I_P_List_null_counter,
+ I_P_List_fast_push_back<MDL_ticket> >
List;
operator const List &() const { return m_list; }
Ticket_list() :m_bitmap(0) {}
@@ -254,25 +347,12 @@ public:
}
}
- /**
- Wake up contexts which are waiting to acquire lock on the object and
- which may succeed now, when we released some lock on it or removed
- some pending request from its waiters list (the latter can happen,
- for example, when context trying to acquire exclusive on the object
- lock is killed).
- */
- void wake_up_waiters()
- {
- MDL_lock::Ticket_iterator it(m_waiting);
- MDL_ticket *awake_ticket;
+ void reschedule_waiters();
- while ((awake_ticket= it++))
- awake_ticket->get_ctx()->awake(MDL_context::NORMAL_WAKE_UP);
- }
void remove_ticket(Ticket_list MDL_lock::*queue, MDL_ticket *ticket);
bool find_deadlock(MDL_ticket *waiting_ticket,
- Deadlock_detection_context *deadlock_ctx);
+ Deadlock_detection_visitor *dvisitor);
/** List of granted tickets for this lock. */
Ticket_list m_granted;
@@ -408,7 +488,7 @@ mdl_locks_key(const uchar *record, size_t *length,
statement, the design capitalizes on that to later save on
look ups in the table definition cache. This leads to reduced
contention overall and on LOCK_open in particular.
- Please see the description of MDL_context::acquire_shared_lock()
+ Please see the description of MDL_context::acquire_lock()
for details.
*/
@@ -635,13 +715,9 @@ MDL_context::MDL_context()
:m_trans_sentinel(NULL),
m_thd(NULL),
m_needs_thr_lock_abort(FALSE),
- m_waiting_for(NULL),
- m_deadlock_weight(0),
- m_signal(NO_WAKE_UP)
+ m_waiting_for(NULL)
{
- mysql_prlock_init(key_MDL_context_waiting_for_rwlock, &m_waiting_for_lock);
- mysql_mutex_init(key_MDL_context_signal_mutex, &m_signal_lock, NULL);
- mysql_cond_init(key_MDL_context_signal_mutex, &m_signal_cond, NULL);
+ mysql_prlock_init(key_MDL_context_LOCK_waiting_for, &m_LOCK_waiting_for);
}
@@ -661,9 +737,7 @@ void MDL_context::destroy()
{
DBUG_ASSERT(m_tickets.is_empty());
- mysql_prlock_destroy(&m_waiting_for_lock);
- mysql_mutex_destroy(&m_signal_lock);
- mysql_cond_destroy(&m_signal_cond);
+ mysql_prlock_destroy(&m_LOCK_waiting_for);
}
@@ -750,13 +824,6 @@ MDL_request::create(MDL_key::enum_mdl_namespace mdl_namespace, const char *db,
}
-uint MDL_request::get_deadlock_weight() const
-{
- return key.mdl_namespace() == MDL_key::GLOBAL ||
- type > MDL_SHARED_NO_WRITE ?
- MDL_DEADLOCK_WEIGHT_DDL : MDL_DEADLOCK_WEIGHT_DML;
-}
-
/**
Auxiliary functions needed for creation/destruction of MDL_lock objects.
@@ -805,6 +872,21 @@ void MDL_ticket::destroy(MDL_ticket *ticket)
/**
+ Return the 'weight' of this ticket for the
+ victim selection algorithm. Requests with
+ lower weight are preferred to requests
+ with higher weight when choosing a victim.
+*/
+
+uint MDL_ticket::get_deadlock_weight() const
+{
+ return (m_lock->key.mdl_namespace() == MDL_key::GLOBAL ||
+ m_type > MDL_SHARED_NO_WRITE ?
+ MDL_DEADLOCK_WEIGHT_DDL : MDL_DEADLOCK_WEIGHT_DML);
+}
+
+
+/**
Helper functions and macros to be used for killable waiting in metadata
locking subsystem.
@@ -865,27 +947,120 @@ static inline void mdl_exit_cond(THD *thd,
}
-MDL_context::mdl_signal_type MDL_context::timed_wait(struct timespec
- *abs_timeout)
+/** Construct an empty wait slot. */
+
+MDL_wait::MDL_wait()
+ :m_wait_status(EMPTY)
+{
+ mysql_mutex_init(key_MDL_wait_LOCK_wait_status, &m_LOCK_wait_status, NULL);
+ mysql_cond_init(key_MDL_wait_COND_wait_status, &m_COND_wait_status, NULL);
+}
+
+
+/** Destroy system resources. */
+
+MDL_wait::~MDL_wait()
+{
+ mysql_mutex_destroy(&m_LOCK_wait_status);
+ mysql_cond_destroy(&m_COND_wait_status);
+}
+
+
+/**
+ Set the status unless it's already set. Return FALSE if set,
+ TRUE otherwise.
+*/
+
+bool MDL_wait::set_status(enum_wait_status status_arg)
+{
+ bool was_occupied= TRUE;
+ mysql_mutex_lock(&m_LOCK_wait_status);
+ if (m_wait_status == EMPTY)
+ {
+ was_occupied= FALSE;
+ m_wait_status= status_arg;
+ mysql_cond_signal(&m_COND_wait_status);
+ }
+ mysql_mutex_unlock(&m_LOCK_wait_status);
+ return was_occupied;
+}
+
+
+/** Query the current value of the wait slot. */
+
+MDL_wait::enum_wait_status MDL_wait::get_status()
+{
+ enum_wait_status result;
+ mysql_mutex_lock(&m_LOCK_wait_status);
+ result= m_wait_status;
+ mysql_mutex_unlock(&m_LOCK_wait_status);
+ return result;
+}
+
+
+/** Clear the current value of the wait slot. */
+
+void MDL_wait::reset_status()
+{
+ mysql_mutex_lock(&m_LOCK_wait_status);
+ m_wait_status= EMPTY;
+ mysql_mutex_unlock(&m_LOCK_wait_status);
+}
+
+
+/**
+ Wait for the status to be assigned to this wait slot.
+
+ @param abs_timeout Absolute time after which waiting should stop.
+ @param set_status_on_tiemout TRUE - If in case of timeout waiting
+ context should close the wait slot by
+ sending TIMEOUT to itself.
+ FALSE - Otherwise.
+
+ @returns Signal posted.
+*/
+
+MDL_wait::enum_wait_status
+MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
+ bool set_status_on_timeout)
{
const char *old_msg;
- mdl_signal_type result;
+ enum_wait_status result;
st_my_thread_var *mysys_var= my_thread_var;
int wait_result= 0;
- mysql_mutex_lock(&m_signal_lock);
+ mysql_mutex_lock(&m_LOCK_wait_status);
- old_msg= MDL_ENTER_COND(m_thd, mysys_var, &m_signal_cond, &m_signal_lock);
+ old_msg= MDL_ENTER_COND(thd, mysys_var, &m_COND_wait_status,
+ &m_LOCK_wait_status);
- while (!m_signal && !mysys_var->abort &&
+ while (!m_wait_status && !mysys_var->abort &&
wait_result != ETIMEDOUT && wait_result != ETIME)
- wait_result= mysql_cond_timedwait(&m_signal_cond, &m_signal_lock,
+ wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status,
abs_timeout);
- result= (m_signal != NO_WAKE_UP || mysys_var->abort) ?
- m_signal : TIMEOUT_WAKE_UP;
+ if (m_wait_status == EMPTY)
+ {
+ /*
+ Wait has ended not due to a status being set from another
+ thread but due to this connection/statement being killed or a
+ time out.
+ To avoid races, which may occur if another thread sets
+ GRANTED status before the code which calls this method
+ processes the abort/timeout, we assign the status under
+ protection of the m_LOCK_wait_status, within the critical
+ section. An exception is when set_status_on_timeout is
+ false, which means that the caller intends to restart the
+ wait.
+ */
+ if (mysys_var->abort)
+ m_wait_status= KILLED;
+ else if (set_status_on_timeout)
+ m_wait_status= TIMEOUT;
+ }
+ result= m_wait_status;
- MDL_EXIT_COND(m_thd, mysys_var, &m_signal_lock, old_msg);
+ MDL_EXIT_COND(thd, mysys_var, &m_LOCK_wait_status, old_msg);
return result;
}
@@ -925,7 +1100,11 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket)
called by other threads.
*/
DBUG_ASSERT(ticket->get_lock());
- m_list.push_front(ticket);
+ /*
+ Add ticket to the *back* of the queue to ensure fairness
+ among requests with the same priority.
+ */
+ m_list.push_back(ticket);
m_bitmap|= MDL_BIT(ticket->get_type());
}
@@ -953,6 +1132,75 @@ void MDL_lock::Ticket_list::remove_ticket(MDL_ticket *ticket)
/**
+ Determine waiting contexts which requests for the lock can be
+ satisfied, grant lock to them and wake them up.
+
+ @note Together with MDL_lock::add_ticket() this method implements
+ fair scheduling among requests with the same priority.
+ It tries to grant lock from the head of waiters list, while
+ add_ticket() adds new requests to the back of this list.
+
+*/
+
+void MDL_lock::reschedule_waiters()
+{
+ MDL_lock::Ticket_iterator it(m_waiting);
+ MDL_ticket *ticket;
+
+ /*
+ Find the first (and hence the oldest) waiting request which
+ can be satisfied (taking into account priority). Grant lock to it.
+ Repeat the process for the remainder of waiters.
+ Note we don't need to re-start iteration from the head of the
+ list after satisfying the first suitable request as in our case
+ all compatible types of requests have the same priority.
+
+ TODO/FIXME: We should:
+ - Either switch to scheduling without priorities
+ which will allow to stop iteration through the
+ list of waiters once we found the first ticket
+ which can't be satisfied
+ - Or implement some check using bitmaps which will
+ allow to stop iteration in cases when, e.g., we
+ grant SNRW lock and there are no pending S or
+ SH locks.
+ */
+ while ((ticket= it++))
+ {
+ if (can_grant_lock(ticket->get_type(), ticket->get_ctx()))
+ {
+ if (! ticket->get_ctx()->m_wait.set_status(MDL_wait::GRANTED))
+ {
+ /*
+ Satisfy the found request by updating lock structures.
+ It is OK to do so even after waking up the waiter since any
+ session which tries to get any information about the state of
+ this lock has to acquire MDL_lock::m_rwlock first and thus,
+ when manages to do so, already sees an updated state of the
+ MDL_lock object.
+ */
+ 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,
+ it can be due to fact that its connection/statement was
+ killed or it has timed out (i.e. the slot is not empty).
+ Since in all such cases the waiter assumes that the lock was
+ not been granted, we should keep the request in the waiting
+ queue and look for another request to reschedule.
+ */
+ }
+ }
+}
+
+
+/**
Compatibility (or rather "incompatibility") matrices for global metadata
lock. Arrays of bitmaps which elements specify which granted/waiting locks
are incompatible with type of lock being requested.
@@ -1159,9 +1407,19 @@ void MDL_lock::remove_ticket(Ticket_list MDL_lock::*list, MDL_ticket *ticket)
{
/*
There can be some contexts waiting to acquire a lock
- which now might be able to do it. Wake them up!
+ which now might be able to do it. Grant the lock to
+ them and wake them up!
+
+ We always try to reschedule locks, since there is no easy way
+ (i.e. by looking at the bitmaps) to find out whether it is
+ required or not.
+ In a general case, even when the queue's bitmap is not changed
+ after removal of the ticket, there is a chance that some request
+ can be satisfied (due to the fact that a granted request
+ reflected in the bitmap might belong to the same context as a
+ pending request).
*/
- wake_up_waiters();
+ reschedule_waiters();
mysql_prlock_unlock(&m_rwlock);
}
}
@@ -1262,29 +1520,6 @@ MDL_context::find_ticket(MDL_request *mdl_request,
/**
- Acquire one lock with waiting for conflicting locks to go away if needed.
-
- @note This is an internal method which should not be used outside of MDL
- subsystem as in most cases simply waiting for conflicting locks to
- go away will lead to deadlock.
-
- @param mdl_request [in/out] Lock request object for lock to be acquired
-
- @param lock_wait_timeout [in] Seconds to wait before timeout.
-
- @retval FALSE Success. MDL_request::ticket points to the ticket
- for the lock.
- @retval TRUE Failure (Out of resources or waiting is aborted),
-*/
-
-bool
-MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
-{
- return acquire_lock_impl(mdl_request, lock_wait_timeout);
-}
-
-
-/**
Try to acquire one lock.
Unlike exclusive locks, shared locks are acquired one by
@@ -1306,15 +1541,55 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
@retval FALSE Success. The lock may have not been acquired.
Check the ticket, if it's NULL, a conflicting lock
- exists and another attempt should be made after releasing
- all current locks and waiting for conflicting lock go
- away (using MDL_context::wait_for_lock()).
+ exists.
@retval TRUE Out of resources, an error has been reported.
*/
bool
MDL_context::try_acquire_lock(MDL_request *mdl_request)
{
+ MDL_ticket *ticket;
+
+ if (try_acquire_lock_impl(mdl_request, &ticket))
+ return TRUE;
+
+ if (! mdl_request->ticket)
+ {
+ /*
+ Our attempt to acquire lock without waiting has failed.
+ Let us release resources which were acquired in the process.
+ We can't get here if we allocated a new lock object so there
+ is no need to release it.
+ */
+ DBUG_ASSERT(! ticket->m_lock->is_empty());
+ mysql_prlock_unlock(&ticket->m_lock->m_rwlock);
+ MDL_ticket::destroy(ticket);
+ }
+
+ return FALSE;
+}
+
+
+/**
+ Auxiliary method for acquiring lock without waiting.
+
+ @param mdl_request [in/out] Lock request object for lock to be acquired
+ @param out_ticket [out] Ticket for the request in case when lock
+ has not been acquired.
+
+ @retval FALSE Success. The lock may have not been acquired.
+ Check MDL_request::ticket, if it's NULL, a conflicting
+ lock exists. In this case "out_ticket" out parameter
+ points to ticket which was constructed for the request.
+ MDL_ticket::m_lock points to the corresponding MDL_lock
+ object and MDL_lock::m_rwlock write-locked.
+ @retval TRUE Out of resources, an error has been reported.
+*/
+
+bool
+MDL_context::try_acquire_lock_impl(MDL_request *mdl_request,
+ MDL_ticket **out_ticket)
+{
MDL_lock *lock;
MDL_key *key= &mdl_request->key;
MDL_ticket *ticket;
@@ -1374,10 +1649,16 @@ MDL_context::try_acquire_lock(MDL_request *mdl_request)
return TRUE;
}
+ ticket->m_lock= lock;
+
if (lock->can_grant_lock(mdl_request->type, this))
{
- ticket->m_lock= lock;
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);
@@ -1385,12 +1666,7 @@ MDL_context::try_acquire_lock(MDL_request *mdl_request)
mdl_request->ticket= ticket;
}
else
- {
- /* We can't get here if we allocated a new lock. */
- DBUG_ASSERT(! lock->is_empty());
- mysql_prlock_unlock(&lock->m_rwlock);
- MDL_ticket::destroy(ticket);
- }
+ *out_ticket= ticket;
return FALSE;
}
@@ -1468,121 +1744,125 @@ void notify_shared_lock(THD *thd, MDL_ticket *conflicting_ticket)
/**
- Auxiliary method for acquiring an exclusive lock.
-
- @param mdl_request Request for the lock to be acqured.
+ Acquire one lock with waiting for conflicting locks to go away if needed.
- @param lock_wait_timeout Seconds to wait before timeout.
+ @param mdl_request [in/out] Lock request object for lock to be acquired
- @note Should not be used outside of MDL subsystem. Instead one
- should call acquire_lock() or acquire_locks()
- methods which ensure that conditions for deadlock-free
- lock acquisition are fulfilled.
+ @param lock_wait_timeout [in] Seconds to wait before timeout.
- @retval FALSE Success
- @retval TRUE Failure
+ @retval FALSE Success. MDL_request::ticket points to the ticket
+ for the lock.
+ @retval TRUE Failure (Out of resources or waiting is aborted),
*/
-bool MDL_context::acquire_lock_impl(MDL_request *mdl_request,
- ulong lock_wait_timeout)
+bool
+MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
{
MDL_lock *lock;
MDL_ticket *ticket;
- bool not_used;
- st_my_thread_var *mysys_var= my_thread_var;
- MDL_key *key= &mdl_request->key;
struct timespec abs_timeout;
- struct timespec abs_shortwait;
+ MDL_wait::enum_wait_status wait_status;
+ /* Do some work outside the critical section. */
set_timespec(abs_timeout, lock_wait_timeout);
- mysql_mutex_assert_not_owner(&LOCK_open);
-
- DBUG_ASSERT(mdl_request->ticket == NULL);
- /* Don't take chances in production. */
- mdl_request->ticket= NULL;
+ if (try_acquire_lock_impl(mdl_request, &ticket))
+ return TRUE;
- /*
- Check whether the context already holds an exclusive lock on the object,
- and if so, grant the request.
- */
- if ((ticket= find_ticket(mdl_request, &not_used)))
+ if (mdl_request->ticket)
{
- DBUG_ASSERT(ticket->m_lock);
- mdl_request->ticket= ticket;
+ /*
+ We have managed to acquire lock without waiting.
+ MDL_lock, MDL_context and MDL_request were updated
+ accordingly, so we can simply return success.
+ */
return FALSE;
}
- DBUG_ASSERT(mdl_request->type < MDL_SHARED_NO_WRITE ||
- is_lock_owner(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE));
-
- /* Early allocation: ticket will be needed in any case. */
- if (!(ticket= MDL_ticket::create(this, mdl_request->type)))
- return TRUE;
+ /*
+ Our attempt to acquire lock without waiting has failed.
+ As a result of this attempt we got MDL_ticket with m_lock
+ member pointing to the corresponding MDL_lock object which
+ has MDL_lock::m_rwlock write-locked.
+ */
+ lock= ticket->m_lock;
- /* The below call implicitly locks MDL_lock::m_rwlock on success. */
- if (!(lock= mdl_locks.find_or_insert(key)))
- {
- MDL_ticket::destroy(ticket);
- return TRUE;
- }
+ lock->m_waiting.add_ticket(ticket);
- ticket->m_lock= lock;
+ /*
+ Once we added a pending ticket to the waiting queue,
+ we must ensure that our wait slot is empty, so
+ that our lock request can be scheduled. Do that in the
+ critical section formed by the acquired write lock on MDL_lock.
+ */
+ m_wait.reset_status();
- lock->m_waiting.add_ticket(ticket);
+ if (ticket->is_upgradable_or_exclusive())
+ lock->notify_shared_locks(this);
- while (!lock->can_grant_lock(mdl_request->type, this))
- {
- wait_reset();
+ mysql_prlock_unlock(&lock->m_rwlock);
- if (ticket->is_upgradable_or_exclusive())
- lock->notify_shared_locks(this);
+ will_wait_for(ticket);
- mysql_prlock_unlock(&lock->m_rwlock);
+ /* There is a shared or exclusive lock on the object. */
+ DEBUG_SYNC(m_thd, "mdl_acquire_lock_wait");
- set_deadlock_weight(mdl_request->get_deadlock_weight());
- will_wait_for(ticket);
+ find_deadlock();
- /* There is a shared or exclusive lock on the object. */
- DEBUG_SYNC(m_thd, "mdl_acquire_lock_wait");
+ if (ticket->is_upgradable_or_exclusive())
+ {
+ struct timespec abs_shortwait;
+ set_timespec(abs_shortwait, 1);
+ wait_status= MDL_wait::EMPTY;
- bool is_deadlock= find_deadlock();
- bool is_timeout= FALSE;
- if (!is_deadlock)
+ while (cmp_timespec(abs_shortwait, abs_timeout) <= 0)
{
+ /* abs_timeout is far away. Wait a short while and notify locks. */
+ wait_status= m_wait.timed_wait(m_thd, &abs_shortwait, FALSE);
+
+ if (wait_status != MDL_wait::EMPTY)
+ break;
+
+ mysql_prlock_wrlock(&lock->m_rwlock);
+ lock->notify_shared_locks(this);
+ mysql_prlock_unlock(&lock->m_rwlock);
set_timespec(abs_shortwait, 1);
- bool timeout_is_near= cmp_timespec(abs_shortwait, abs_timeout) > 0;
- mdl_signal_type wait_result=
- timed_wait(timeout_is_near ? &abs_timeout : &abs_shortwait);
-
- if (timeout_is_near && wait_result == TIMEOUT_WAKE_UP)
- is_timeout= TRUE;
- else if (wait_result == VICTIM_WAKE_UP)
- is_deadlock= TRUE;
}
+ if (wait_status == MDL_wait::EMPTY)
+ wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE);
+ }
+ else
+ wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE);
- stop_waiting();
+ done_waiting_for();
- if (mysys_var->abort || is_deadlock || is_timeout)
+ if (wait_status != MDL_wait::GRANTED)
+ {
+ lock->remove_ticket(&MDL_lock::m_waiting, ticket);
+ MDL_ticket::destroy(ticket);
+ switch (wait_status)
{
- lock->remove_ticket(&MDL_lock::m_waiting, ticket);
- MDL_ticket::destroy(ticket);
- if (is_deadlock)
- my_error(ER_LOCK_DEADLOCK, MYF(0));
- else if (is_timeout)
- my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
- return TRUE;
+ case MDL_wait::VICTIM:
+ my_error(ER_LOCK_DEADLOCK, MYF(0));
+ break;
+ case MDL_wait::TIMEOUT:
+ my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
+ break;
+ case MDL_wait::KILLED:
+ break;
+ default:
+ DBUG_ASSERT(0);
+ break;
}
- mysql_prlock_wrlock(&lock->m_rwlock);
+ return TRUE;
}
- lock->m_waiting.remove_ticket(ticket);
- lock->m_granted.add_ticket(ticket);
-
- if (ticket->get_type() == MDL_EXCLUSIVE && lock->cached_object)
- (*lock->cached_object_release_hook)(lock->cached_object);
- lock->cached_object= NULL;
-
- mysql_prlock_unlock(&lock->m_rwlock);
+ /*
+ We have been granted our request.
+ State of MDL_lock object is already being appropriately updated by a
+ concurrent thread (@sa MDL_lock:reschedule_waiters()).
+ So all we need to do is to update MDL_context and MDL_request objects.
+ */
+ DBUG_ASSERT(wait_status == MDL_wait::GRANTED);
m_tickets.push_front(ticket);
@@ -1652,10 +1932,10 @@ bool MDL_context::acquire_locks(MDL_request_list *mdl_requests,
for (p_req= sort_buf; p_req < sort_buf + req_count; p_req++)
{
- if (acquire_lock_impl(*p_req, lock_wait_timeout))
+ if (acquire_lock(*p_req, lock_wait_timeout))
goto err;
}
- my_free(sort_buf, MYF(0));
+ my_free(sort_buf);
return FALSE;
err:
@@ -1671,7 +1951,7 @@ err:
{
(*p_req)->ticket= NULL;
}
- my_free(sort_buf, MYF(0));
+ my_free(sort_buf);
return TRUE;
}
@@ -1689,9 +1969,8 @@ err:
shared mode).
@note There can be only one upgrader for a lock or we will have deadlock.
- This invariant is ensured by code outside of metadata subsystem usually
- by obtaining some sort of exclusive table-level lock (e.g. TL_WRITE,
- TL_WRITE_ALLOW_READ) before performing upgrade of metadata lock.
+ This invariant is ensured by the fact that upgradeable locks SNW
+ and SNRW are not compatible with each other and themselves.
@retval FALSE Success
@retval TRUE Failure (thread was killed)
@@ -1721,7 +2000,7 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
mdl_xlock_request.init(&mdl_ticket->m_lock->key, MDL_EXCLUSIVE);
- if (acquire_lock_impl(&mdl_xlock_request, lock_wait_timeout))
+ if (acquire_lock(&mdl_xlock_request, lock_wait_timeout))
DBUG_RETURN(TRUE);
is_new_ticket= ! has_lock(mdl_svp, mdl_xlock_request.ticket);
@@ -1752,251 +2031,231 @@ MDL_context::upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
bool MDL_lock::find_deadlock(MDL_ticket *waiting_ticket,
- Deadlock_detection_context *deadlock_ctx)
+ Deadlock_detection_visitor *dvisitor)
{
MDL_ticket *ticket;
- bool result= FALSE;
+ MDL_context *src_ctx= waiting_ticket->get_ctx();
+ bool result= TRUE;
mysql_prlock_rdlock(&m_rwlock);
+ /* Must be initialized after taking a read lock. */
Ticket_iterator granted_it(m_granted);
Ticket_iterator waiting_it(m_waiting);
+ /*
+ MDL_lock's waiting and granted queues and MDL_context::m_waiting_for
+ member are updated by different threads when the lock is granted
+ (see MDL_context::acquire_lock() and MDL_lock::reschedule_waiters()).
+ As a result, here we may encounter a situation when MDL_lock data
+ already reflects the fact that the lock was granted but
+ m_waiting_for member has not been updated yet.
+
+ For example, imagine that:
+
+ thread1: Owns SNW lock on table t1.
+ thread2: Attempts to acquire SW lock on t1,
+ but sees an active SNW lock.
+ Thus adds the ticket to the waiting queue and
+ sets m_waiting_for to point to the ticket.
+ thread1: Releases SNW lock, updates MDL_lock object to
+ grant SW lock to thread2 (moves the ticket for
+ SW from waiting to the active queue).
+ Attempts to acquire a new SNW lock on t1,
+ sees an active SW lock (since it is present in the
+ active queue), adds ticket for SNW lock to the waiting
+ queue, sets m_waiting_for to point to this ticket.
+
+ At this point deadlock detection algorithm run by thread1 will see that:
+ - Thread1 waits for SNW lock on t1 (since m_waiting_for is set).
+ - SNW lock is not granted, because it conflicts with active SW lock
+ owned by thread 2 (since ticket for SW is present in granted queue).
+ - Thread2 waits for SW lock (since its m_waiting_for has not been
+ updated yet!).
+ - SW lock is not granted because there is pending SNW lock from thread1.
+ Therefore deadlock should exist [sic!].
+
+ To avoid detection of such false deadlocks we need to check the "actual"
+ status of the ticket being waited for, before analyzing its blockers.
+ We do this by checking the wait status of the context which is waiting
+ for it. To avoid races this has to be done under protection of
+ MDL_lock::m_rwlock lock.
+ */
+ if (src_ctx->m_wait.get_status() != MDL_wait::EMPTY)
+ {
+ result= FALSE;
+ goto end;
+ }
+
+ /*
+ To avoid visiting nodes which were already marked as victims of
+ deadlock detection (or whose requests were already satisfied) we
+ enter the node only after peeking at its wait status.
+ This is necessary to avoid active waiting in a situation
+ when previous searches for a deadlock already selected the
+ node we're about to enter as a victim (see the comment
+ in MDL_context::find_deadlock() for explanation why several searches
+ can be performed for the same wait).
+ There is no guarantee that the node isn't chosen a victim while we
+ are visiting it but this is OK: in the worst case we might do some
+ extra work and one more context might be chosen as a victim.
+ */
+ if (dvisitor->enter_node(src_ctx))
+ goto end;
+
+ /*
+ We do a breadth-first search first -- that is, inspect all
+ edges of the current node, and only then follow up to the next
+ node. In workloads that involve wait-for graph loops this
+ has proven to be a more efficient strategy [citation missing].
+ */
while ((ticket= granted_it++))
{
- if (ticket->is_incompatible_when_granted(waiting_ticket->get_type()) &&
- ticket->get_ctx() != waiting_ticket->get_ctx() &&
- ticket->get_ctx() == deadlock_ctx->start)
+ /* Filter out edges that point to the same node. */
+ if (ticket->get_ctx() != src_ctx &&
+ ticket->is_incompatible_when_granted(waiting_ticket->get_type()) &&
+ dvisitor->inspect_edge(ticket->get_ctx()))
{
- result= TRUE;
- goto end;
+ goto end_leave_node;
}
}
while ((ticket= waiting_it++))
{
- if (ticket->is_incompatible_when_waiting(waiting_ticket->get_type()) &&
- ticket->get_ctx() != waiting_ticket->get_ctx() &&
- ticket->get_ctx() == deadlock_ctx->start)
+ /* Filter out edges that point to the same node. */
+ if (ticket->get_ctx() != src_ctx &&
+ ticket->is_incompatible_when_waiting(waiting_ticket->get_type()) &&
+ dvisitor->inspect_edge(ticket->get_ctx()))
{
- result= TRUE;
- goto end;
+ goto end_leave_node;
}
}
+ /* Recurse and inspect all adjacent nodes. */
granted_it.rewind();
while ((ticket= granted_it++))
{
- if (ticket->is_incompatible_when_granted(waiting_ticket->get_type()) &&
- ticket->get_ctx() != waiting_ticket->get_ctx() &&
- ticket->get_ctx()->find_deadlock(deadlock_ctx))
+ if (ticket->get_ctx() != src_ctx &&
+ ticket->is_incompatible_when_granted(waiting_ticket->get_type()) &&
+ ticket->get_ctx()->find_deadlock(dvisitor))
{
- result= TRUE;
- goto end;
+ goto end_leave_node;
}
}
waiting_it.rewind();
while ((ticket= waiting_it++))
{
- if (ticket->is_incompatible_when_waiting(waiting_ticket->get_type()) &&
- ticket->get_ctx() != waiting_ticket->get_ctx() &&
- ticket->get_ctx()->find_deadlock(deadlock_ctx))
+ if (ticket->get_ctx() != src_ctx &&
+ ticket->is_incompatible_when_waiting(waiting_ticket->get_type()) &&
+ ticket->get_ctx()->find_deadlock(dvisitor))
{
- result= TRUE;
- goto end;
+ goto end_leave_node;
}
}
+ result= FALSE;
+
+end_leave_node:
+ dvisitor->leave_node(src_ctx);
+
end:
mysql_prlock_unlock(&m_rwlock);
return result;
}
-bool MDL_context::find_deadlock(Deadlock_detection_context *deadlock_ctx)
+/**
+ Recursively traverse the wait-for graph of MDL contexts
+ in search for deadlocks.
+
+ @retval TRUE A deadlock is found. A victim is remembered
+ by the visitor.
+ @retval FALSE
+*/
+
+bool MDL_context::find_deadlock(Deadlock_detection_visitor *dvisitor)
{
+ MDL_context *m_unlock_ctx= this;
bool result= FALSE;
- mysql_prlock_rdlock(&m_waiting_for_lock);
+ mysql_prlock_rdlock(&m_LOCK_waiting_for);
if (m_waiting_for)
{
- /*
- QQ: should we rather be checking for NO_WAKE_UP ?
-
- We want to do check signal only when m_waiting_for is set
- to avoid reading left-overs from previous kills.
- */
- if (peek_signal() != VICTIM_WAKE_UP)
- {
-
- if (++deadlock_ctx->current_search_depth >
- deadlock_ctx->MAX_SEARCH_DEPTH)
- result= TRUE;
- else
- result= m_waiting_for->m_lock->find_deadlock(m_waiting_for,
- deadlock_ctx);
- --deadlock_ctx->current_search_depth;
- }
- }
-
- if (result)
- {
- if (! deadlock_ctx->victim)
- deadlock_ctx->victim= this;
- else if (deadlock_ctx->victim->m_deadlock_weight >= m_deadlock_weight)
- {
- mysql_prlock_unlock(&deadlock_ctx->victim->m_waiting_for_lock);
- deadlock_ctx->victim= this;
- }
- else
- mysql_prlock_unlock(&m_waiting_for_lock);
+ result= m_waiting_for->m_lock->find_deadlock(m_waiting_for, dvisitor);
+ if (result)
+ m_unlock_ctx= dvisitor->opt_change_victim_to(this);
}
- else
- mysql_prlock_unlock(&m_waiting_for_lock);
+ /*
+ We may recurse into the same MDL_context more than once
+ in case this is not the starting node. Make sure we release the
+ read lock as it's been taken, except for 1 read lock for
+ the deadlock victim.
+ */
+ if (m_unlock_ctx)
+ mysql_prlock_unlock(&m_unlock_ctx->m_LOCK_waiting_for);
return result;
}
-bool MDL_context::find_deadlock()
-{
- while (1)
- {
- /*
- The fact that we use fresh instance of deadlock_ctx for each
- search performed by find_deadlock() below is important, code
- responsible for victim selection relies on this.
- */
- Deadlock_detection_context deadlock_ctx(this);
-
- if (! find_deadlock(&deadlock_ctx))
- {
- /* No deadlocks are found! */
- break;
- }
-
- if (deadlock_ctx.victim != this)
- {
- deadlock_ctx.victim->awake(VICTIM_WAKE_UP);
- mysql_prlock_unlock(&deadlock_ctx.victim->m_waiting_for_lock);
- /*
- After adding new arc to waiting graph we found that it participates
- in some loop (i.e. there is a deadlock). We decided to destroy this
- loop by removing some arc other than newly added. Since this doesn't
- guarantee that all loops created by addition of this arc are
- destroyed we have to repeat search.
- */
- continue;
- }
- else
- {
- DBUG_ASSERT(&deadlock_ctx.victim->m_waiting_for_lock == &m_waiting_for_lock);
- mysql_prlock_unlock(&deadlock_ctx.victim->m_waiting_for_lock);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
/**
- Wait until there will be no locks that conflict with lock requests
- in the given list.
-
- This is a part of the locking protocol and must be used by the
- acquirer of shared locks after a back-off.
-
- Does not acquire the locks!
+ Try to find a deadlock. This function produces no errors.
- @param lock_wait_timeout Seconds to wait before timeout.
+ @note If during deadlock resolution context which performs deadlock
+ detection is chosen as a victim it will be informed about the
+ fact by setting VICTIM status to its wait slot.
- @retval FALSE Success. One can try to obtain metadata locks.
- @retval TRUE Failure (thread was killed or deadlock is possible).
+ @retval TRUE A deadlock is found.
+ @retval FALSE No deadlock found.
*/
-bool
-MDL_context::wait_for_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
+void MDL_context::find_deadlock()
{
- MDL_lock *lock;
- st_my_thread_var *mysys_var= my_thread_var;
- struct timespec abs_timeout;
- set_timespec(abs_timeout, lock_wait_timeout);
-
- mysql_mutex_assert_not_owner(&LOCK_open);
-
- DBUG_ASSERT(mdl_request->ticket == NULL);
-
- while (TRUE)
+ while (1)
{
/*
- We have to check if there are some HANDLERs open by this thread
- which conflict with some pending exclusive locks. Otherwise we
- might have a deadlock in situations when we are waiting for
- pending writer to go away, which in its turn waits for HANDLER
- open by our thread.
-
- TODO: investigate situations in which we need to broadcast on
- COND_mdl because of above scenario.
+ The fact that we use fresh instance of dvisitor for each
+ search performed by find_deadlock() below is important,
+ the code responsible for victim selection relies on this.
*/
- mysql_ha_flush(m_thd);
-
- MDL_key *key= &mdl_request->key;
-
- /* The below call implicitly locks MDL_lock::m_rwlock on success. */
- if (! (lock= mdl_locks.find(key)))
- return FALSE;
-
- if (lock->can_grant_lock(mdl_request->type, this))
- {
- mysql_prlock_unlock(&lock->m_rwlock);
- return FALSE;
- }
+ Deadlock_detection_visitor dvisitor(this);
+ MDL_context *victim;
- MDL_ticket *pending_ticket;
- if (! (pending_ticket= MDL_ticket::create(this, mdl_request->type)))
+ if (! find_deadlock(&dvisitor))
{
- mysql_prlock_unlock(&lock->m_rwlock);
- return TRUE;
- }
-
- pending_ticket->m_lock= lock;
-
- lock->m_waiting.add_ticket(pending_ticket);
-
- wait_reset();
- mysql_prlock_unlock(&lock->m_rwlock);
-
- set_deadlock_weight(MDL_DEADLOCK_WEIGHT_DML);
- will_wait_for(pending_ticket);
-
- bool is_deadlock= find_deadlock();
- bool is_timeout= FALSE;
- if (!is_deadlock)
- {
- mdl_signal_type wait_result= timed_wait(&abs_timeout);
- if (wait_result == TIMEOUT_WAKE_UP)
- is_timeout= TRUE;
- else if (wait_result == VICTIM_WAKE_UP)
- is_deadlock= TRUE;
+ /* No deadlocks are found! */
+ break;
}
- stop_waiting();
+ victim= dvisitor.get_victim();
- lock->remove_ticket(&MDL_lock::m_waiting, pending_ticket);
- MDL_ticket::destroy(pending_ticket);
+ /*
+ Failure to change status of the victim is OK as it means
+ that the victim has received some other message and is
+ about to stop its waiting/to break deadlock loop.
+ Even when the initiator of the deadlock search is
+ chosen the victim, we need to set the respective wait
+ result in order to "close" it for any attempt to
+ schedule the request.
+ This is needed to avoid a possible race during
+ cleanup in case when the lock request on which the
+ context was waiting is concurrently satisfied.
+ */
+ (void) victim->m_wait.set_status(MDL_wait::VICTIM);
+ mysql_prlock_unlock(&victim->m_LOCK_waiting_for);
- if (mysys_var->abort || is_deadlock || is_timeout)
- {
- if (is_deadlock)
- my_error(ER_LOCK_DEADLOCK, MYF(0));
- else if (is_timeout)
- my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
- return TRUE;
- }
+ if (victim == this)
+ break;
+ /*
+ After adding a new edge to the waiting graph we found that it
+ creates a loop (i.e. there is a deadlock). We decided to destroy
+ this loop by removing an edge, but not the one that we added.
+ Since this doesn't guarantee that all loops created by addition
+ of the new edge are destroyed, we have to repeat the search.
+ */
}
- return TRUE;
}
@@ -2125,7 +2384,7 @@ void MDL_ticket::downgrade_exclusive_lock(enum_mdl_type type)
m_lock->m_granted.remove_ticket(this);
m_type= type;
m_lock->m_granted.add_ticket(this);
- m_lock->wake_up_waiters();
+ m_lock->reschedule_waiters();
mysql_prlock_unlock(&m_lock->m_rwlock);
}
@@ -2330,7 +2589,6 @@ void MDL_context::move_ticket_after_trans_sentinel(MDL_ticket *mdl_ticket)
if (m_trans_sentinel == NULL)
{
m_trans_sentinel= mdl_ticket;
- /* sic: linear from the number of transactional tickets acquired so-far! */
m_tickets.push_back(mdl_ticket);
}
else
diff --git a/sql/mdl.h b/sql/mdl.h
index 89a679be264..43d88c143c0 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -34,7 +34,7 @@ class THD;
class MDL_context;
class MDL_lock;
class MDL_ticket;
-class Deadlock_detection_context;
+class Deadlock_detection_visitor;
/**
Type of metadata lock request.
@@ -308,6 +308,10 @@ public:
MDL_key key;
public:
+ static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
+ { return alloc_root(mem_root, size); }
+ static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
+
void init(MDL_key::enum_mdl_namespace namespace_arg,
const char *db_arg, const char *name_arg,
enum_mdl_type mdl_type_arg);
@@ -318,8 +322,6 @@ public:
DBUG_ASSERT(ticket == NULL);
type= type_arg;
}
- uint get_deadlock_weight() const;
-
static MDL_request *create(MDL_key::enum_mdl_namespace mdl_namespace,
const char *db, const char *name,
enum_mdl_type mdl_type, MEM_ROOT *root);
@@ -413,6 +415,8 @@ public:
bool is_incompatible_when_granted(enum_mdl_type type) const;
bool is_incompatible_when_waiting(enum_mdl_type type) const;
+ /* A helper used to determine which lock request should be aborted. */
+ uint get_deadlock_weight() const;
private:
friend class MDL_context;
@@ -443,6 +447,37 @@ private:
};
+/**
+ A reliable way to wait on an MDL lock.
+*/
+
+class MDL_wait
+{
+public:
+ MDL_wait();
+ ~MDL_wait();
+
+ enum enum_wait_status { EMPTY = 0, GRANTED, VICTIM, TIMEOUT, KILLED };
+
+ bool set_status(enum_wait_status result_arg);
+ enum_wait_status get_status();
+ void reset_status();
+ enum_wait_status timed_wait(THD *thd, struct timespec *abs_timeout,
+ bool signal_timeout);
+private:
+ /**
+ Condvar which is used for waiting until this context's pending
+ request can be satisfied or this thread has to perform actions
+ to resolve a potential deadlock (we subscribe to such
+ notification by adding a ticket corresponding to the request
+ to an appropriate queue of waiters).
+ */
+ mysql_mutex_t m_LOCK_wait_status;
+ mysql_cond_t m_COND_wait_status;
+ enum_wait_status m_wait_status;
+};
+
+
typedef I_P_List<MDL_request, I_P_List_adapter<MDL_request,
&MDL_request::next_in_list,
&MDL_request::prev_in_list>,
@@ -460,16 +495,13 @@ public:
typedef I_P_List<MDL_ticket,
I_P_List_adapter<MDL_ticket,
&MDL_ticket::next_in_context,
- &MDL_ticket::prev_in_context> >
+ &MDL_ticket::prev_in_context>,
+ I_P_List_null_counter,
+ I_P_List_fast_push_back<MDL_ticket> >
Ticket_list;
typedef Ticket_list::Iterator Ticket_iterator;
- enum mdl_signal_type { NO_WAKE_UP = 0,
- NORMAL_WAKE_UP,
- VICTIM_WAKE_UP,
- TIMEOUT_WAKE_UP };
-
MDL_context();
void destroy();
@@ -481,8 +513,6 @@ public:
bool clone_ticket(MDL_request *mdl_request);
- bool wait_for_lock(MDL_request *mdl_request, ulong lock_wait_timeout);
-
void release_all_locks_for_name(MDL_ticket *ticket);
void release_lock(MDL_ticket *ticket);
@@ -524,17 +554,17 @@ public:
inline THD *get_thd() const { return m_thd; }
+ /** @pre Only valid if we started waiting for lock. */
+ inline uint get_deadlock_weight() const
+ { return m_waiting_for->get_deadlock_weight(); }
/**
- Wake up context which is waiting for a change of MDL_lock state.
- */
- void awake(mdl_signal_type signal)
- {
- mysql_mutex_lock(&m_signal_lock);
- m_signal= signal;
- mysql_cond_signal(&m_signal_cond);
- mysql_mutex_unlock(&m_signal_lock);
- }
+ Post signal to the context (and wake it up if necessary).
+ @retval FALSE - Success, signal was posted.
+ @retval TRUE - Failure, signal was not posted since context
+ already has received some signal or closed
+ signal slot.
+ */
void init(THD *thd_arg) { m_thd= thd_arg; }
void set_needs_thr_lock_abort(bool needs_thr_lock_abort)
@@ -554,7 +584,13 @@ public:
return m_needs_thr_lock_abort;
}
- bool find_deadlock(Deadlock_detection_context *deadlock_ctx);
+ bool find_deadlock(Deadlock_detection_visitor *dvisitor);
+public:
+ /**
+ If our request for a lock is scheduled, or aborted by the deadlock
+ detector, the result is recorded in this class.
+ */
+ MDL_wait m_wait;
private:
/**
All MDL tickets acquired by this connection.
@@ -636,71 +672,38 @@ private:
important as deadlock detector won't work correctly
otherwise. @sa Comment for MDL_lock::m_rwlock.
*/
- mysql_prlock_t m_waiting_for_lock;
- MDL_ticket *m_waiting_for;
- uint m_deadlock_weight;
+ mysql_prlock_t m_LOCK_waiting_for;
/**
- Condvar which is used for waiting until this context's pending
- request can be satisfied or this thread has to perform actions
- to resolve a potential deadlock (we subscribe to such
- notification by adding a ticket corresponding to the request
- to an appropriate queue of waiters).
- */
- mysql_mutex_t m_signal_lock;
- mysql_cond_t m_signal_cond;
- mdl_signal_type m_signal;
-
+ Tell the deadlock detector what lock this session is waiting for.
+ In principle, this is redundant, as information can be found
+ by inspecting waiting queues, but we'd very much like it to be
+ readily available to the wait-for graph iterator.
+ */
+ MDL_ticket *m_waiting_for;
private:
MDL_ticket *find_ticket(MDL_request *mdl_req,
bool *is_transactional);
void release_locks_stored_before(MDL_ticket *sentinel);
- bool acquire_lock_impl(MDL_request *mdl_request, ulong lock_wait_timeout);
+ bool try_acquire_lock_impl(MDL_request *mdl_request,
+ MDL_ticket **out_ticket);
- bool find_deadlock();
+ void find_deadlock();
+ /** Inform the deadlock detector there is an edge in the wait-for graph. */
void will_wait_for(MDL_ticket *pending_ticket)
{
- mysql_prlock_wrlock(&m_waiting_for_lock);
+ mysql_prlock_wrlock(&m_LOCK_waiting_for);
m_waiting_for= pending_ticket;
- mysql_prlock_unlock(&m_waiting_for_lock);
+ mysql_prlock_unlock(&m_LOCK_waiting_for);
}
- void set_deadlock_weight(uint weight)
+ /** Remove the wait-for edge from the graph after we're done waiting. */
+ void done_waiting_for()
{
- /*
- m_deadlock_weight should not be modified while m_waiting_for is
- non-NULL as in this case this context might participate in deadlock
- and so m_deadlock_weight can be accessed from other threads.
- */
- DBUG_ASSERT(m_waiting_for == NULL);
- m_deadlock_weight= weight;
- }
-
- void stop_waiting()
- {
- mysql_prlock_wrlock(&m_waiting_for_lock);
+ mysql_prlock_wrlock(&m_LOCK_waiting_for);
m_waiting_for= NULL;
- mysql_prlock_unlock(&m_waiting_for_lock);
+ mysql_prlock_unlock(&m_LOCK_waiting_for);
}
-
- void wait_reset()
- {
- mysql_mutex_lock(&m_signal_lock);
- m_signal= NO_WAKE_UP;
- mysql_mutex_unlock(&m_signal_lock);
- }
-
- mdl_signal_type timed_wait(struct timespec *abs_timeout);
-
- mdl_signal_type peek_signal()
- {
- mdl_signal_type result;
- mysql_mutex_lock(&m_signal_lock);
- result= m_signal;
- mysql_mutex_unlock(&m_signal_lock);
- return result;
- }
-
private:
MDL_context(const MDL_context &rhs); /* not implemented */
MDL_context &operator=(MDL_context &rhs); /* not implemented */
@@ -717,7 +720,6 @@ void mdl_destroy();
extern bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
bool needs_thr_lock_abort);
-extern void mysql_ha_flush(THD *thd);
extern "C" const char *set_thd_proc_info(void *thd_arg, const char *info,
const char *calling_function,
const char *calling_file,
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 68f9b582dd2..8a31cec6721 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -305,12 +305,12 @@ print_decimal(const my_decimal *dec)
int i, end;
char buff[512], *pos;
pos= buff;
- pos+= my_sprintf(buff, (buff, "Decimal: sign: %d intg: %d frac: %d { ",
- dec->sign(), dec->intg, dec->frac));
+ pos+= sprintf(buff, "Decimal: sign: %d intg: %d frac: %d { ",
+ dec->sign(), dec->intg, dec->frac);
end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1;
for (i=0; i < end; i++)
- pos+= my_sprintf(pos, (pos, "%09d, ", dec->buf[i]));
- pos+= my_sprintf(pos, (pos, "%09d }\n", dec->buf[i]));
+ pos+= sprintf(pos, "%09d, ", dec->buf[i]);
+ pos+= sprintf(pos, "%09d }\n", dec->buf[i]);
fputs(buff, DBUG_FILE);
}
diff --git a/sql/my_lock.c b/sql/my_lock.c
deleted file mode 100644
index f66d7282f72..00000000000
--- a/sql/my_lock.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 2000-2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#if defined(__NETWARE__)
-#include "../mysys/my_lock.c"
-#else
-
-#undef MAP_TO_USE_RAID /* Avoid RAID mappings */
-#include <my_global.h>
-#include <my_sys.h>
-#include <mysys_err.h>
-#include <my_pthread.h>
-#include <thr_alarm.h>
-#include <errno.h>
-
- /* Lock a part of a file */
-
-int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags)
-{
- thr_alarm_t alarmed;
- ALARM alarm_buff;
- uint wait_for_alarm;
- struct flock m_lock;
- DBUG_ENTER("my_lock");
- DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d",
- fd,locktype,(ulong) start,(ulong) length,MyFlags));
- if (my_disable_locking)
- DBUG_RETURN(0); /* purecov: inspected */
- m_lock.l_type=(short) locktype;
- m_lock.l_whence=0L;
- m_lock.l_start=(long) start;
- m_lock.l_len=(long) length;
- wait_for_alarm=(MyFlags & MY_DONT_WAIT ? MY_HOW_OFTEN_TO_ALARM :
- (uint) 12*60*60);
- if (fcntl(fd,F_SETLK,&m_lock) != -1) /* Check if we can lock */
- DBUG_RETURN(0); /* Ok, file locked */
- DBUG_PRINT("info",("Was locked, trying with alarm"));
- if (!thr_alarm(&alarmed,wait_for_alarm,&alarm_buff))
- {
- int value;
- while ((value=fcntl(fd,F_SETLKW,&m_lock)) && !thr_got_alarm(&alarmed) &&
- errno == EINTR) ;
- thr_end_alarm(&alarmed);
- if (value != -1)
- DBUG_RETURN(0);
- }
- else
- {
- errno=EINTR;
- }
- if (errno == EINTR || errno == EACCES)
- my_errno=EAGAIN; /* Easier to check for this */
- else
- my_errno=errno;
-
- if (MyFlags & MY_WME)
- {
- if (locktype == F_UNLCK)
- my_error(EE_CANTUNLOCK,MYF(ME_BELL+ME_WAITTANG),errno);
- else
- my_error(EE_CANTLOCK,MYF(ME_BELL+ME_WAITTANG),errno);
- }
- DBUG_PRINT("error",("errno: %d",errno));
- DBUG_RETURN(-1);
-}
-#endif
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7968d637223..1a44115d893 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1,4 +1,4 @@
-/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
+/* Copyright (c) 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
@@ -126,14 +126,12 @@ extern "C" { // Because of SCO 3.2V4.2
#include <my_net.h>
#if !defined(__WIN__)
-# ifndef __NETWARE__
#include <sys/resource.h>
-# endif /* __NETWARE__ */
#ifdef HAVE_SYS_UN_H
-# include <sys/un.h>
+#include <sys/un.h>
#endif
#ifdef HAVE_SELECT_H
-# include <select.h>
+#include <select.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
@@ -164,45 +162,6 @@ extern int memcntl(caddr_t, size_t, int, caddr_t, int, int);
#endif /* __sun__ ... */
#endif /* HAVE_SOLARIS_LARGE_PAGES */
-#ifdef __NETWARE__
-#define zVOLSTATE_ACTIVE 6
-#define zVOLSTATE_DEACTIVE 2
-#define zVOLSTATE_MAINTENANCE 3
-
-#undef __event_h__
-#include <../include/event.h>
-/*
- This #undef exists here because both libc of NetWare and MySQL have
- files named event.h which causes compilation errors.
-*/
-
-#include <nks/netware.h>
-#include <nks/vm.h>
-#include <library.h>
-#include <monitor.h>
-#include <zOmni.h> //For NEB
-#include <neb.h> //For NEB
-#include <nebpub.h> //For NEB
-#include <zEvent.h> //For NSS event structures
-#include <zPublics.h>
-
-static void *neb_consumer_id= NULL; //For storing NEB consumer id
-static char datavolname[256]= {0};
-static VolumeID_t datavolid;
-static event_handle_t eh;
-static Report_t ref;
-static void *refneb= NULL;
-my_bool event_flag= FALSE;
-static int volumeid= -1;
-
- /* NEB event callback */
-unsigned long neb_event_callback(struct EventBlock *eblock);
-static void registerwithneb();
-static void getvolumename();
-static void getvolumeID(BYTE *volumeName);
-#endif /* __NETWARE__ */
-
-
#ifdef _AIX41
int initgroups(const char *,unsigned int);
#endif
@@ -782,7 +741,15 @@ void Buffered_log::print()
sql_print_warning("Buffered warning: %s\n", m_message.c_ptr_safe());
break;
case INFORMATION_LEVEL:
- sql_print_information("Buffered information: %s\n", m_message.c_ptr_safe());
+ /*
+ Messages printed as "information" still end up in the mysqld *error* log,
+ but with a [Note] tag instead of an [ERROR] tag.
+ While this is probably fine for a human reading the log,
+ it is upsetting existing automated scripts used to parse logs,
+ because such scripts are likely to not already handle [Note] properly.
+ INFORMATION_LEVEL messages are simply silenced, on purpose,
+ to avoid un needed verbosity.
+ */
break;
}
}
@@ -1031,7 +998,7 @@ static void close_connections(void)
flush_thread_cache();
/* kill connection thread */
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
DBUG_PRINT("quit", ("waiting for select thread: 0x%lx",
(ulong) select_thread));
mysql_mutex_lock(&LOCK_thread_count);
@@ -1209,14 +1176,6 @@ static void close_server_sock()
ip_sock=INVALID_SOCKET;
DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
(void) shutdown(tmp_sock, SHUT_RDWR);
-#if defined(__NETWARE__)
- /*
- The following code is disabled for normal systems as it causes MySQL
- to hang on AIX 4.3 during shutdown
- */
- DBUG_PRINT("info",("calling closesocket on TCP/IP socket"));
- (void) closesocket(tmp_sock);
-#endif
}
tmp_sock=unix_sock;
if (tmp_sock != INVALID_SOCKET)
@@ -1224,14 +1183,6 @@ static void close_server_sock()
unix_sock=INVALID_SOCKET;
DBUG_PRINT("info",("calling shutdown on unix socket"));
(void) shutdown(tmp_sock, SHUT_RDWR);
-#if defined(__NETWARE__)
- /*
- The following code is disabled for normal systems as it may cause MySQL
- to hang on AIX 4.3 during shutdown
- */
- DBUG_PRINT("info",("calling closesocket on unix/IP socket"));
- (void) closesocket(tmp_sock);
-#endif
(void) unlink(mysqld_unix_port);
}
DBUG_VOID_RETURN;
@@ -1300,10 +1251,7 @@ void kill_mysql(void)
or stop, we just want to kill the server.
*/
-#if defined(__NETWARE__)
-extern "C" void kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER return
-#elif !defined(__WIN__)
+#if !defined(__WIN__)
static void *kill_server(void *sig_ptr)
#define RETURN_FROM_KILL_SERVER return 0
#else
@@ -1349,11 +1297,6 @@ static void __cdecl kill_server(int sig_ptr)
unireg_end();
/* purecov: begin deadcode */
-#ifdef __NETWARE__
- if (!event_flag)
- pthread_join(select_thread, NULL); // wait for main thread
-#endif /* __NETWARE__ */
-
DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
pthread_exit(0);
@@ -1370,7 +1313,7 @@ static void __cdecl kill_server(int sig_ptr)
}
-#if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ))
+#if defined(USE_ONE_SIGNAL_HAND)
pthread_handler_t kill_server_thread(void *arg __attribute__((unused)))
{
my_thread_init(); // Initialize new thread
@@ -1388,10 +1331,10 @@ extern "C" sig_handler print_signal_warning(int sig)
{
if (global_system_variables.log_warnings)
sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id());
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(sig,print_signal_warning); /* int. thread system calls */
#endif
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
if (sig == SIGALRM)
alarm(2); /* reschedule alarm */
#endif
@@ -1425,7 +1368,7 @@ void unireg_end(void)
{
clean_up(1);
my_thread_end();
-#if defined(SIGNALS_DONT_BREAK_READ) && !defined(__NETWARE__)
+#if defined(SIGNALS_DONT_BREAK_READ)
exit(0);
#else
pthread_exit(0); // Exit is in main thread
@@ -1523,7 +1466,7 @@ void clean_up(bool print_message)
if (defaults_argv)
free_defaults(defaults_argv);
free_tmpdir(&mysql_tmpdir_list);
- x_free(opt_bin_logname);
+ my_free(opt_bin_logname);
bitmap_free(&temp_pool);
free_max_user_conn();
#ifdef HAVE_REPLICATION
@@ -1579,7 +1522,6 @@ void clean_up(bool print_message)
*/
static void wait_for_signal_thread_to_end()
{
-#ifndef __NETWARE__
uint i;
/*
Wait up to 10 seconds for signal thread to die. We use this mainly to
@@ -1591,7 +1533,6 @@ static void wait_for_signal_thread_to_end()
break;
my_sleep(100); // Give it time to die
}
-#endif
}
@@ -1689,7 +1630,7 @@ static void set_ports()
static struct passwd *check_user(const char *user)
{
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
struct passwd *tmp_user_info;
uid_t user_id= geteuid();
@@ -1754,7 +1695,7 @@ err:
static void set_user(const char *user, struct passwd *user_info_arg)
{
/* purecov: begin tested */
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
DBUG_ASSERT(user_info_arg != 0);
#ifdef HAVE_INITGROUPS
/*
@@ -1784,7 +1725,7 @@ static void set_user(const char *user, struct passwd *user_info_arg)
static void set_effective_user(struct passwd *user_info_arg)
{
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
DBUG_ASSERT(user_info_arg != 0);
if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1)
{
@@ -1803,7 +1744,7 @@ static void set_effective_user(struct passwd *user_info_arg)
/** Change root user if started with @c --chroot . */
static void set_root(const char *path)
{
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
if (chroot(path) == -1)
{
sql_perror("chroot");
@@ -2135,6 +2076,16 @@ static bool cache_thread()
/* Don't kill the thread, just put it in cache for reuse */
DBUG_PRINT("info", ("Adding thread to cache"));
cached_thread_count++;
+
+#ifdef HAVE_PSI_INTERFACE
+ /*
+ Delete the instrumentation for the job that just completed,
+ before parking this pthread in the cache (blocked on COND_thread_cache).
+ */
+ if (likely(PSI_server != NULL))
+ PSI_server->delete_current_thread();
+#endif
+
while (!abort_loop && ! wake_thread && ! kill_cached_threads)
mysql_cond_wait(&COND_thread_cache, &LOCK_thread_count);
cached_thread_count--;
@@ -2147,6 +2098,21 @@ static bool cache_thread()
thd= thread_cache.get();
thd->thread_stack= (char*) &thd; // For store_globals
(void) thd->store_globals();
+
+#ifdef HAVE_PSI_INTERFACE
+ /*
+ Create new instrumentation for the new THD job,
+ and attach it to this running pthread.
+ */
+ if (likely(PSI_server != NULL))
+ {
+ PSI_thread *psi= PSI_server->new_thread(key_thread_one_connection,
+ thd, thd->thread_id);
+ if (likely(psi != NULL))
+ PSI_server->set_thread(psi);
+ }
+#endif
+
/*
THD::mysys_var::abort is associated with physical thread rather
than with THD object. So we need to reset this flag before using
@@ -2393,243 +2359,7 @@ static void start_signal_handler(void)
static void check_data_home(const char *path)
{}
-
-#elif defined(__NETWARE__)
-
-/// down server event callback.
-void mysql_down_server_cb(void *, void *)
-{
- event_flag= TRUE;
- kill_server(0);
-}
-
-
-/// destroy callback resources.
-void mysql_cb_destroy(void *)
-{
- UnRegisterEventNotification(eh); // cleanup down event notification
- NX_UNWRAP_INTERFACE(ref);
- /* Deregister NSS volume deactivation event */
- NX_UNWRAP_INTERFACE(refneb);
- if (neb_consumer_id)
- UnRegisterConsumer(neb_consumer_id, NULL);
-}
-
-
-/// initialize callbacks.
-void mysql_cb_init()
-{
- // register for down server event
- void *handle = getnlmhandle();
- rtag_t rt= AllocateResourceTag(handle, "MySQL Down Server Callback",
- EventSignature);
- NX_WRAP_INTERFACE((void *)mysql_down_server_cb, 2, (void **)&ref);
- eh= RegisterForEventNotification(rt, EVENT_PRE_DOWN_SERVER,
- EVENT_PRIORITY_APPLICATION,
- NULL, ref, NULL);
-
- /*
- Register for volume deactivation event
- Wrap the callback function, as it is called by non-LibC thread
- */
- (void *) NX_WRAP_INTERFACE(neb_event_callback, 1, &refneb);
- registerwithneb();
-
- NXVmRegisterExitHandler(mysql_cb_destroy, NULL); // clean-up
-}
-
-
-/** To get the name of the NetWare volume having MySQL data folder. */
-static void getvolumename()
-{
- char *p;
- /*
- We assume that data path is already set.
- If not it won't come here. Terminate after volume name
- */
- if ((p= strchr(mysql_real_data_home, ':')))
- strmake(datavolname, mysql_real_data_home,
- (uint) (p - mysql_real_data_home));
-}
-
-
-/**
- Registering with NEB for NSS Volume Deactivation event.
-*/
-
-static void registerwithneb()
-{
-
- ConsumerRegistrationInfo reg_info;
-
- /* Clear NEB registration structure */
- bzero((char*) &reg_info, sizeof(struct ConsumerRegistrationInfo));
-
- /* Fill the NEB consumer information structure */
- reg_info.CRIVersion= 1; // NEB version
- /* NEB Consumer name */
- reg_info.CRIConsumerName= (BYTE *) "MySQL Database Server";
- /* Event of interest */
- reg_info.CRIEventName= (BYTE *) "NSS.ChangeVolState.Enter";
- reg_info.CRIUserParameter= NULL; // Consumer Info
- reg_info.CRIEventFlags= 0; // Event flags
- /* Consumer NLM handle */
- reg_info.CRIOwnerID= (LoadDefinitionStructure *)getnlmhandle();
- reg_info.CRIConsumerESR= NULL; // No consumer ESR required
- reg_info.CRISecurityToken= 0; // No security token for the event
- reg_info.CRIConsumerFlags= 0; // SMP_ENABLED_BIT;
- reg_info.CRIFilterName= 0; // No event filtering
- reg_info.CRIFilterDataLength= 0; // No filtering data
- reg_info.CRIFilterData= 0; // No filtering data
- /* Callback function for the event */
- (void *)reg_info.CRIConsumerCallback= (void *) refneb;
- reg_info.CRIOrder= 0; // Event callback order
- reg_info.CRIConsumerType= CHECK_CONSUMER; // Consumer type
-
- /* Register for the event with NEB */
- if (RegisterConsumer(&reg_info))
- {
- consoleprintf("Failed to register for NSS Volume Deactivation event \n");
- return;
- }
- /* This ID is required for deregistration */
- neb_consumer_id= reg_info.CRIConsumerID;
-
- /* Get MySQL data volume name, stored in global variable datavolname */
- getvolumename();
-
- /*
- Get the NSS volume ID of the MySQL Data volume.
- Volume ID is stored in a global variable
- */
- getvolumeID((BYTE*) datavolname);
-}
-
-
-/**
- Callback for NSS Volume Deactivation event.
-*/
-
-ulong neb_event_callback(struct EventBlock *eblock)
-{
- EventChangeVolStateEnter_s *voldata;
- extern bool nw_panic;
-
- voldata= (EventChangeVolStateEnter_s *)eblock->EBEventData;
-
- /* Deactivation of a volume */
- if ((voldata->oldState == zVOLSTATE_ACTIVE &&
- voldata->newState == zVOLSTATE_DEACTIVE ||
- voldata->newState == zVOLSTATE_MAINTENANCE))
- {
- /*
- Ensure that we bring down MySQL server only for MySQL data
- volume deactivation
- */
- if (!memcmp(&voldata->volID, &datavolid, sizeof(VolumeID_t)))
- {
- consoleprintf("MySQL data volume is deactivated, shutting down MySQL Server \n");
- event_flag= TRUE;
- nw_panic = TRUE;
- event_flag= TRUE;
- kill_server(0);
- }
- }
- return 0;
-}
-
-
-#define ADMIN_VOL_PATH "_ADMIN:/Volumes/"
-
-/**
- Function to get NSS volume ID of the MySQL data.
-*/
-static void getvolumeID(BYTE *volumeName)
-{
- char path[zMAX_FULL_NAME];
- Key_t rootKey= 0, fileKey= 0;
- QUAD getInfoMask;
- zInfo_s info;
- STATUS status;
-
- /* Get the root key */
- if ((status= zRootKey(0, &rootKey)) != zOK)
- {
- consoleprintf("\nGetNSSVolumeProperties - Failed to get root key, status: %d\n.", (int) status);
- goto exit;
- }
-
- /*
- Get the file key. This is the key to the volume object in the
- NSS admin volumes directory.
- */
-
- strxmov(path, (const char *) ADMIN_VOL_PATH, (const char *) volumeName,
- NullS);
- if ((status= zOpen(rootKey, zNSS_TASK, zNSPACE_LONG|zMODE_UTF8,
- (BYTE *) path, zRR_READ_ACCESS, &fileKey)) != zOK)
- {
- consoleprintf("\nGetNSSVolumeProperties - Failed to get file, status: %d\n.", (int) status);
- goto exit;
- }
-
- getInfoMask= zGET_IDS | zGET_VOLUME_INFO ;
- if ((status= zGetInfo(fileKey, getInfoMask, sizeof(info),
- zINFO_VERSION_A, &info)) != zOK)
- {
- consoleprintf("\nGetNSSVolumeProperties - Failed in zGetInfo, status: %d\n.", (int) status);
- goto exit;
- }
-
- /* Copy the data to global variable */
- datavolid.timeLow= info.vol.volumeID.timeLow;
- datavolid.timeMid= info.vol.volumeID.timeMid;
- datavolid.timeHighAndVersion= info.vol.volumeID.timeHighAndVersion;
- datavolid.clockSeqHighAndReserved= info.vol.volumeID.clockSeqHighAndReserved;
- datavolid.clockSeqLow= info.vol.volumeID.clockSeqLow;
- /* This is guranteed to be 6-byte length (but sizeof() would be better) */
- memcpy(datavolid.node, info.vol.volumeID.node, (unsigned int) 6);
-
-exit:
- if (rootKey)
- zClose(rootKey);
- if (fileKey)
- zClose(fileKey);
-}
-
-
-static void init_signals(void)
-{
- int signals[] = {SIGINT,SIGILL,SIGFPE,SIGSEGV,SIGTERM,SIGABRT};
-
- for (uint i=0 ; i < sizeof(signals)/sizeof(int) ; i++)
- signal(signals[i], kill_server);
- mysql_cb_init(); // initialize callbacks
-
-}
-
-
-static void start_signal_handler(void)
-{
- // Save vm id of this process
- if (!opt_bootstrap)
- create_pid_file();
- // no signal handler
-}
-
-
-/**
- Warn if the data is on a Traditional volume.
-
- @note
- Already done by mysqld_safe
-*/
-
-static void check_data_home(const char *path)
-{
-}
-
-#endif /*__WIN__ || __NETWARE */
+#endif /* __WIN__ */
#ifdef HAVE_LINUXTHREADS
#define UNSAFE_DEFAULT_LINUX_THREADS 200
@@ -2649,7 +2379,6 @@ extern "C" sig_handler handle_segfault(int sig)
{
time_t curr_time;
struct tm tm;
- THD *thd=current_thd;
/*
Strictly speaking, one needs a mutex here
@@ -2709,13 +2438,15 @@ the thread stack. Please read http://dev.mysql.com/doc/mysql/en/linux.html\n\n",
#endif /* HAVE_LINUXTHREADS */
#ifdef HAVE_STACKTRACE
+ THD *thd=current_thd;
+
if (!(test_flags & TEST_NO_STACKTRACE))
{
- fprintf(stderr,"thd: 0x%lx\n",(long) thd);
- fprintf(stderr,"\
-Attempting backtrace. You can use the following information to find out\n\
-where mysqld died. If you see no messages after this, something went\n\
-terribly wrong...\n");
+ fprintf(stderr, "thd: 0x%lx\n",(long) thd);
+ fprintf(stderr, "Attempting backtrace. You can use the following "
+ "information to find out\nwhere mysqld died. If "
+ "you see no messages after this, something went\n"
+ "terribly wrong...\n");
my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL,
my_thread_stack_size);
}
@@ -2798,7 +2529,7 @@ bugs.\n");
#endif
}
-#if !defined(__WIN__) && !defined(__NETWARE__)
+#if !defined(__WIN__)
#ifndef SA_RESETHAND
#define SA_RESETHAND 0
#endif
@@ -3135,7 +2866,7 @@ void *my_str_malloc_mysqld(size_t size)
void my_str_free_mysqld(void *ptr)
{
- my_free(ptr, MYF(MY_FAE));
+ my_free(ptr);
}
#endif /* EMBEDDED_LIBRARY */
@@ -3435,8 +3166,16 @@ static int init_common_variables()
compiler error in the Sun Studio 12 compiler. As a work-around we
set the def_value member to 0 in my_long_options and initialize it
to the correct value here.
+
+ From MySQL 5.5 onwards, the default storage engine is InnoDB
+ (except in the embedded server, where the default continues to
+ be MyISAM)
*/
+#ifdef EMBEDDED_LIBRARY
default_storage_engine= const_cast<char *>("MyISAM");
+#else
+ default_storage_engine= const_cast<char *>("InnoDB");
+#endif
/*
Add server status variables to the dynamic list of
@@ -3700,7 +3439,7 @@ static int init_common_variables()
#define FIX_LOG_VAR(VAR, ALT) \
if (!VAR || !*VAR) \
{ \
- x_free(VAR); /* it could be an allocated empty string "" */ \
+ my_free(VAR); /* it could be an allocated empty string "" */ \
VAR= my_strdup(ALT, MYF(0)); \
}
@@ -4136,7 +3875,7 @@ a file name for --log-bin-index option", opt_binlog_index_name);
}
if (ln == buf)
{
- my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_bin_logname);
opt_bin_logname=my_strdup(buf, MYF(0));
}
if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln, TRUE))
@@ -4314,10 +4053,6 @@ a file name for --log-bin-index option", opt_binlog_index_name);
mysql_bin_log.purge_logs_before_date(purge_time);
}
#endif
-#ifdef __NETWARE__
- /* Increasing stacksize of threads on NetWare */
- pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE);
-#endif
if (opt_myisam_log)
(void) mi_log(1);
@@ -4551,16 +4286,6 @@ int mysqld_main(int argc, char **argv)
buffered_logs.buffer(WARNING_LEVEL,
"Performance schema disabled (reason: init failed).");
}
- else
- {
- buffered_logs.buffer(INFORMATION_LEVEL,
- "Performance schema enabled.");
- }
- }
- else
- {
- buffered_logs.buffer(INFORMATION_LEVEL,
- "Performance schema disabled (reason: start parameters).");
}
}
#else
@@ -4706,10 +4431,6 @@ int mysqld_main(int argc, char **argv)
}
}
#endif
-#ifdef __NETWARE__
- /* Increasing stacksize of threads on NetWare */
- pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE);
-#endif
(void) thr_setconcurrency(concurrency); // 10 by default
@@ -4787,9 +4508,9 @@ int mysqld_main(int argc, char **argv)
{
abort_loop=1;
select_thread_in_use=0;
-#ifndef __NETWARE__
+
(void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
-#endif /* __NETWARE__ */
+
if (!opt_bootstrap)
mysql_file_delete(key_file_pid, pidfile_name, MYF(MY_WME)); // Not needed anymore
@@ -4828,7 +4549,14 @@ int mysqld_main(int argc, char **argv)
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
initialize_performance_schema_acl(opt_bootstrap);
- check_performance_schema();
+ /*
+ Do not check the structure of the performance schema tables
+ during bootstrap:
+ - the tables are not supposed to exist yet, bootstrap will create them
+ - a check would print spurious error messages
+ */
+ if (! opt_bootstrap)
+ check_performance_schema();
#endif
initialize_information_schema_acl();
@@ -5335,15 +5063,12 @@ static void create_new_thread(THD *thd)
inline void kill_broken_server()
{
/* hack to get around signals ignored in syscalls for problem OS's */
- if (
-#if !defined(__NETWARE__)
- unix_sock == INVALID_SOCKET ||
-#endif
+ if (unix_sock == INVALID_SOCKET ||
(!opt_disable_networking && ip_sock == INVALID_SOCKET))
{
select_thread_in_use = 0;
/* The following call will never return */
- kill_server(IF_NETWARE(MYSQL_KILL_SIGNAL, (void*) MYSQL_KILL_SIGNAL));
+ kill_server((void*) MYSQL_KILL_SIGNAL);
}
}
#define MAYBE_BROKEN_SYSCALL kill_broken_server();
@@ -5477,13 +5202,6 @@ void handle_connections_sockets()
size_socket length= sizeof(struct sockaddr_storage);
new_sock= accept(sock, (struct sockaddr *)(&cAddr),
&length);
-#ifdef __NETWARE__
- // TODO: temporary fix, waiting for TCP/IP fix - DEFECT000303149
- if ((new_sock == INVALID_SOCKET) && (socket_errno == EINVAL))
- {
- kill_server(SIGTERM);
- }
-#endif
if (new_sock != INVALID_SOCKET ||
(socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
break;
@@ -5923,7 +5641,7 @@ errorconn:
/* End shared memory handling */
error:
if (tmp)
- my_free(tmp, MYF(0));
+ my_free(tmp);
if (errmsg)
{
@@ -6223,14 +5941,6 @@ struct my_option my_long_options[]=
"Don't allow new user creation by the user who has no write privileges to the mysql.user table.",
&opt_safe_user_create, &opt_safe_user_create, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
-#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
- {"safemalloc", 0, "Enable the memory allocation checking.",
- &sf_malloc_quick, &sf_malloc_quick, 0,
- GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
- {"safemalloc-mem-limit", 0, "Simulate memory shortage.",
- &sf_malloc_mem_limit, &sf_malloc_mem_limit, 0, GET_UINT,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"show-slave-auth-info", 0,
"Show user and password in SHOW SLAVE HOSTS on this master.",
&opt_show_slave_auth_info, &opt_show_slave_auth_info, 0,
@@ -6430,7 +6140,7 @@ static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_CHAR;
var->value= buff;
- my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period));
+ sprintf(buff, "%.3f", active_mi->heartbeat_period);
}
else
var->type= SHOW_UNDEF;
@@ -7147,23 +6857,21 @@ static int mysql_init_variables(void)
shared_memory_base_name= default_shared_memory_base_name;
#endif
-#if defined(__WIN__) || defined(__NETWARE__)
- /* Allow Win32 and NetWare users to move MySQL anywhere */
+#if defined(__WIN__)
+ /* Allow Win32 users to move MySQL anywhere */
{
char prg_dev[LIBLEN];
-#if defined __WIN__
- char executing_path_name[LIBLEN];
- if (!test_if_hard_path(my_progname))
- {
- // we don't want to use GetModuleFileName inside of my_path since
- // my_path is a generic path dereferencing function and here we care
- // only about the executing binary.
- GetModuleFileName(NULL, executing_path_name, sizeof(executing_path_name));
- my_path(prg_dev, executing_path_name, NULL);
- }
- else
-#endif
- my_path(prg_dev,my_progname,"mysql/bin");
+ char executing_path_name[LIBLEN];
+ if (!test_if_hard_path(my_progname))
+ {
+ // we don't want to use GetModuleFileName inside of my_path since
+ // my_path is a generic path dereferencing function and here we care
+ // only about the executing binary.
+ GetModuleFileName(NULL, executing_path_name, sizeof(executing_path_name));
+ my_path(prg_dev, executing_path_name, NULL);
+ }
+ else
+ my_path(prg_dev, my_progname, "mysql/bin");
strcat(prg_dev,"/../"); // Remove 'bin' to get base dir
cleanup_dirname(mysql_home,prg_dev);
}
@@ -7581,13 +7289,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
}
if (opt_disable_networking)
- {
-#if defined(__NETWARE__)
- sql_print_error("Can't start server: skip-networking option is currently not supported on NetWare");
- return 1;
-#endif
mysqld_port= 0;
- }
+
if (opt_skip_show_db)
opt_specialflag|= SPECIAL_SKIP_SHOW_DB;
@@ -7859,7 +7562,7 @@ static int fix_paths(void)
}
char *secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE));
convert_dirname(secure_file_real_path, buff, NullS);
- my_free(opt_secure_file_priv, MYF(0));
+ my_free(opt_secure_file_priv);
opt_secure_file_priv= secure_file_real_path;
}
}
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 918798529de..6f0b7a817ca 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -44,9 +44,6 @@
#include <signal.h>
#include <errno.h>
#include "probes_mysql.h"
-#ifdef __NETWARE__
-#include <sys/select.h>
-#endif
#ifdef EMBEDDED_LIBRARY
#undef MYSQL_SERVER
@@ -152,7 +149,7 @@ my_bool my_net_init(NET *net, Vio* vio)
void net_end(NET *net)
{
DBUG_ENTER("net_end");
- my_free(net->buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(net->buff);
net->buff=0;
DBUG_VOID_RETURN;
}
@@ -696,7 +693,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
#endif
#ifdef HAVE_COMPRESS
if (net->compress)
- my_free((char*) packet,MYF(0));
+ my_free((void*) packet);
#endif
if (thr_alarm_in_use(&alarmed))
{
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 9363b637862..af5b4b7c7d6 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1091,7 +1091,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables,
select->file= *head->sort.io_cache;
select->records=(ha_rows) (select->file.end_of_file/
head->file->ref_length);
- my_free(head->sort.io_cache, MYF(0));
+ my_free(head->sort.io_cache);
head->sort.io_cache=0;
}
DBUG_RETURN(select);
@@ -1216,18 +1216,18 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
}
delete_dynamic(&ranges); /* ranges are allocated in alloc */
free_root(&alloc,MYF(0));
- my_free((char*) column_bitmap.bitmap, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(column_bitmap.bitmap);
}
head->column_bitmaps_set(save_read_set, save_write_set);
- x_free(multi_range);
- x_free(multi_range_buff);
+ my_free(multi_range);
+ my_free(multi_range_buff);
DBUG_VOID_RETURN;
}
QUICK_INDEX_MERGE_SELECT::QUICK_INDEX_MERGE_SELECT(THD *thd_param,
TABLE *table)
- :pk_quick_select(NULL), thd(thd_param)
+ :unique(NULL), pk_quick_select(NULL), thd(thd_param)
{
DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::QUICK_INDEX_MERGE_SELECT");
index= MAX_KEY;
@@ -1269,6 +1269,7 @@ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT()
List_iterator_fast<QUICK_RANGE_SELECT> quick_it(quick_selects);
QUICK_RANGE_SELECT* quick;
DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT");
+ delete unique;
quick_it.rewind();
while ((quick= quick_it++))
quick->file= NULL;
@@ -1842,96 +1843,6 @@ SEL_ARG *SEL_ARG::clone_tree(RANGE_OPT_PARAM *param)
/*
- Find the best index to retrieve first N records in given order
-
- SYNOPSIS
- get_index_for_order()
- table Table to be accessed
- order Required ordering
- limit Number of records that will be retrieved
-
- DESCRIPTION
- Find the best index that allows to retrieve first #limit records in the
- given order cheaper then one would retrieve them using full table scan.
-
- IMPLEMENTATION
- Run through all table indexes and find the shortest index that allows
- records to be retrieved in given order. We look for the shortest index
- as we will have fewer index pages to read with it.
-
- This function is used only by UPDATE/DELETE, so we take into account how
- the UPDATE/DELETE code will work:
- * index can only be scanned in forward direction
- * HA_EXTRA_KEYREAD will not be used
- Perhaps these assumptions could be relaxed.
-
- RETURN
- Number of the index that produces the required ordering in the cheapest way
- MAX_KEY if no such index was found.
-*/
-
-uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit)
-{
- uint idx;
- uint match_key= MAX_KEY, match_key_len= MAX_KEY_LENGTH + 1;
- ORDER *ord;
-
- for (ord= order; ord; ord= ord->next)
- if (!ord->asc)
- return MAX_KEY;
-
- for (idx= 0; idx < table->s->keys; idx++)
- {
- if (!(table->keys_in_use_for_query.is_set(idx)))
- continue;
- KEY_PART_INFO *keyinfo= table->key_info[idx].key_part;
- uint n_parts= table->key_info[idx].key_parts;
- uint partno= 0;
-
- /*
- The below check is sufficient considering we now have either BTREE
- indexes (records are returned in order for any index prefix) or HASH
- indexes (records are not returned in order for any index prefix).
- */
- if (!(table->file->index_flags(idx, 0, 1) & HA_READ_ORDER))
- continue;
- for (ord= order; ord && partno < n_parts; ord= ord->next, partno++)
- {
- Item *item= order->item[0];
- if (!(item->type() == Item::FIELD_ITEM &&
- ((Item_field*)item)->field->eq(keyinfo[partno].field)))
- break;
- }
-
- if (!ord && table->key_info[idx].key_length < match_key_len)
- {
- /*
- Ok, the ordering is compatible and this key is shorter then
- previous match (we want shorter keys as we'll have to read fewer
- index pages for the same number of records)
- */
- match_key= idx;
- match_key_len= table->key_info[idx].key_length;
- }
- }
-
- if (match_key != MAX_KEY)
- {
- /*
- Found an index that allows records to be retrieved in the requested
- order. Now we'll check if using the index is cheaper then doing a table
- scan.
- */
- double full_scan_time= table->file->scan_time();
- double index_scan_time= table->file->read_time(match_key, 1, limit);
- if (index_scan_time > full_scan_time)
- match_key= MAX_KEY;
- }
- return match_key;
-}
-
-
-/*
Table rows retrieval plan. Range optimizer creates QUICK_SELECT_I-derived
objects from table read plans.
*/
@@ -7806,7 +7717,7 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree,
if (unlikely(param->thd->killed != 0))
return HA_POS_ERROR;
-
+
keynr=param->real_keynr[idx];
param->range_count++;
if (!tmp_min_flag && ! tmp_max_flag &&
@@ -8342,7 +8253,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
List_iterator_fast<QUICK_RANGE_SELECT> cur_quick_it(quick_selects);
QUICK_RANGE_SELECT* cur_quick;
int result;
- Unique *unique;
handler *file= head->file;
DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::read_keys_and_merge");
@@ -8361,9 +8271,22 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
if (cur_quick->init() || cur_quick->reset())
DBUG_RETURN(1);
- unique= new Unique(refpos_order_cmp, (void *)file,
- file->ref_length,
- thd->variables.sortbuff_size);
+ if (unique == NULL)
+ {
+ DBUG_EXECUTE_IF("index_merge_may_not_create_a_Unique", abort(); );
+ DBUG_EXECUTE_IF("only_one_Unique_may_be_created",
+ DBUG_SET("+d,index_merge_may_not_create_a_Unique"); );
+
+ unique= new Unique(refpos_order_cmp, (void *)file,
+ file->ref_length,
+ thd->variables.sortbuff_size);
+ }
+ else
+ unique->reset();
+
+ DBUG_ASSERT(file->ref_length == unique->get_size());
+ DBUG_ASSERT(thd->variables.sortbuff_size == unique->get_max_in_memory_size());
+
if (!unique)
DBUG_RETURN(1);
for (;;)
@@ -8378,10 +8301,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
if (cur_quick->file->inited != handler::NONE)
cur_quick->file->ha_index_end();
if (cur_quick->init() || cur_quick->reset())
- {
- delete unique;
DBUG_RETURN(1);
- }
}
if (result)
@@ -8389,17 +8309,13 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
if (result != HA_ERR_END_OF_FILE)
{
cur_quick->range_end();
- delete unique;
DBUG_RETURN(result);
}
break;
}
if (thd->killed)
- {
- delete unique;
DBUG_RETURN(1);
- }
/* skip row if it will be retrieved by clustered PK scan */
if (pk_quick_select && pk_quick_select->row_in_ranges())
@@ -8408,10 +8324,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
cur_quick->file->position(cur_quick->record);
result= unique->unique_add((char*)cur_quick->file->ref);
if (result)
- {
- delete unique;
DBUG_RETURN(1);
- }
}
/*
@@ -8420,7 +8333,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
sequence.
*/
result= unique->get(head);
- delete unique;
doing_pk_scan= FALSE;
/* index_merge currently doesn't support "using index" at all */
head->set_keyread(FALSE);
@@ -8538,6 +8450,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
if ((error= quick->get_next()))
DBUG_RETURN(error);
}
+ quick->file->position(quick->record);
}
memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1;
@@ -8679,7 +8592,7 @@ int QUICK_RANGE_SELECT::reset()
}
if (! multi_range_buff)
{
- my_free((char*) multi_range, MYF(0));
+ my_free(multi_range);
multi_range= NULL;
multi_range_length= 0;
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -8977,7 +8890,6 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q,
}
rev_it.rewind();
q->dont_free=1; // Don't free shared mem
- delete q;
}
@@ -9067,6 +8979,27 @@ int QUICK_SELECT_DESC::get_next()
}
+/**
+ Create a compatible quick select with the result ordered in an opposite way
+
+ @param used_key_parts_arg Number of used key parts
+
+ @retval NULL in case of errors (OOM etc)
+ @retval pointer to a newly created QUICK_SELECT_DESC if success
+*/
+
+QUICK_SELECT_I *QUICK_RANGE_SELECT::make_reverse(uint used_key_parts_arg)
+{
+ QUICK_SELECT_DESC *new_quick= new QUICK_SELECT_DESC(this, used_key_parts_arg);
+ if (new_quick == NULL || new_quick->error != 0)
+ {
+ delete new_quick;
+ return NULL;
+ }
+ return new_quick;
+}
+
+
/*
Compare if found key is over max-value
Returns 0 if key <= range->max_key
@@ -9640,8 +9573,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
first Item? If so, then why? What is the array for?
*/
/* Above we already checked that all group items are fields. */
- DBUG_ASSERT((*tmp_group->item)->type() == Item::FIELD_ITEM);
- Item_field *group_field= (Item_field *) (*tmp_group->item);
+ DBUG_ASSERT((*tmp_group->item)->real_item()->type() == Item::FIELD_ITEM);
+ Item_field *group_field= (Item_field *) (*tmp_group->item)->real_item();
if (group_field->field->eq(cur_part->field))
{
cur_group_prefix_len+= cur_part->store_length;
@@ -10495,7 +10428,7 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
ha_rows records_arg, uint key_infix_len_arg,
uchar *key_infix_arg, MEM_ROOT *parent_alloc,
bool is_index_scan_arg)
- :join(join_arg), index_info(index_info_arg),
+ :file(table->file), join(join_arg), index_info(index_info_arg),
group_prefix_len(group_prefix_len_arg),
group_key_parts(group_key_parts_arg), have_min(have_min_arg),
have_max(have_max_arg), have_agg_distinct(have_agg_distinct_arg),
@@ -10505,7 +10438,6 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
is_index_scan(is_index_scan_arg)
{
head= table;
- file= head->file;
index= use_index;
record= head->record[0];
tmp_record= head->record[1];
@@ -11673,6 +11605,7 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
/* purecov: end */
}
+
void QUICK_INDEX_MERGE_SELECT::dbug_dump(int indent, bool verbose)
{
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
@@ -11761,7 +11694,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::dbug_dump(int indent, bool verbose)
}
-#endif /* NOT_USED */
+#endif /* !DBUG_OFF */
/*****************************************************************************
** Instantiate templates
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 72f2eb4b51d..33b3d561ad8 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -352,6 +352,11 @@ public:
*/
virtual void dbug_dump(int indent, bool verbose)= 0;
#endif
+
+ /*
+ Returns a QUICK_SELECT with reverse order of to the index.
+ */
+ virtual QUICK_SELECT_I *make_reverse(uint used_key_parts_arg) { return NULL; }
};
@@ -437,6 +442,7 @@ public:
#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
+ QUICK_SELECT_I *make_reverse(uint used_key_parts_arg);
private:
/* Default copy ctor used by QUICK_SELECT_DESC */
};
@@ -514,6 +520,7 @@ public:
class QUICK_INDEX_MERGE_SELECT : public QUICK_SELECT_I
{
+ Unique *unique;
public:
QUICK_INDEX_MERGE_SELECT(THD *thd, TABLE *table);
~QUICK_INDEX_MERGE_SELECT();
@@ -697,7 +704,7 @@ private:
class QUICK_GROUP_MIN_MAX_SELECT : public QUICK_SELECT_I
{
private:
- handler *file; /* The handler used to get data. */
+ handler * const file; /* The handler used to get data. */
JOIN *join; /* Descriptor of the current query */
KEY *index_info; /* The index chosen for data access */
uchar *record; /* Buffer where the next record is returned. */
@@ -782,6 +789,10 @@ public:
int get_next();
bool reverse_sorted() { return 1; }
int get_type() { return QS_TYPE_RANGE_DESC; }
+ QUICK_SELECT_I *make_reverse(uint used_key_parts_arg)
+ {
+ return this; // is already reverse sorted
+ }
private:
bool range_reads_after_key(QUICK_RANGE *range);
int reset(void) { rev_it.rewind(); return QUICK_RANGE_SELECT::reset(); }
@@ -807,13 +818,18 @@ class SQL_SELECT :public Sql_alloc {
SQL_SELECT();
~SQL_SELECT();
void cleanup();
+ void set_quick(QUICK_SELECT_I *new_quick) { delete quick; quick= new_quick; }
bool check_quick(THD *thd, bool force_quick_range, ha_rows limit)
{
key_map tmp;
tmp.set_all();
return test_quick_select(thd, tmp, 0, limit, force_quick_range) < 0;
}
- inline bool skip_record() { return cond ? cond->val_int() == 0 : 0; }
+ inline bool skip_record(THD *thd, bool *skip_record)
+ {
+ *skip_record= cond ? cond->val_int() == FALSE : FALSE;
+ return thd->is_error();
+ }
int test_quick_select(THD *thd, key_map keys, table_map prev_tables,
ha_rows limit, bool force_quick_range);
};
@@ -833,7 +849,6 @@ public:
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
struct st_table_ref *ref,
ha_rows records);
-uint get_index_for_order(TABLE *table, ORDER *order, ha_rows limit);
SQL_SELECT *make_select(TABLE *head, table_map const_tables,
table_map read_tables, COND *conds,
bool allow_null_cond, int *error);
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 5b0b681c3a6..43934551016 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -109,8 +109,8 @@ char *partition_info::create_default_partition_names(uint part_no,
{
do
{
- my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i)));
- move_ptr+=MAX_PART_NAME_SIZE;
+ sprintf(move_ptr, "p%u", (start_no + i));
+ move_ptr+= MAX_PART_NAME_SIZE;
} while (++i < num_parts_arg);
}
else
@@ -177,7 +177,7 @@ char *partition_info::create_subpartition_name(uint subpart_no,
if (likely(ptr != NULL))
{
- my_sprintf(ptr, (ptr, "%ssp%u", part_name, subpart_no));
+ my_snprintf(ptr, size_alloc, "%ssp%u", part_name, subpart_no);
}
else
{
diff --git a/sql/protocol.cc b/sql/protocol.cc
index ac78ac88ec6..3f957dcc2de 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1166,16 +1166,12 @@ bool Protocol_text::store(MYSQL_TIME *tm)
#endif
char buff[40];
uint length;
- length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d",
- (int) tm->year,
- (int) tm->month,
- (int) tm->day,
- (int) tm->hour,
- (int) tm->minute,
- (int) tm->second));
+ length= sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d",
+ (int) tm->year, (int) tm->month,
+ (int) tm->day, (int) tm->hour,
+ (int) tm->minute, (int) tm->second);
if (tm->second_part)
- length+= my_sprintf(buff+length,(buff+length, ".%06d",
- (int)tm->second_part));
+ length+= sprintf(buff+length, ".%06d", (int) tm->second_part);
return net_store_data((uchar*) buff, length);
}
@@ -1209,13 +1205,11 @@ bool Protocol_text::store_time(MYSQL_TIME *tm)
char buff[40];
uint length;
uint day= (tm->year || tm->month) ? 0 : tm->day;
- length= my_sprintf(buff,(buff, "%s%02ld:%02d:%02d",
- tm->neg ? "-" : "",
- (long) day*24L+(long) tm->hour,
- (int) tm->minute,
- (int) tm->second));
+ length= sprintf(buff, "%s%02ld:%02d:%02d", tm->neg ? "-" : "",
+ (long) day*24L+(long) tm->hour, (int) tm->minute,
+ (int) tm->second);
if (tm->second_part)
- length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
+ length+= sprintf(buff+length, ".%06d", (int) tm->second_part);
return net_store_data((uchar*) buff, length);
}
diff --git a/sql/records.cc b/sql/records.cc
index d85cb49e013..ccacdc33b36 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -42,12 +42,14 @@ static int rr_from_cache(READ_RECORD *info);
static int init_rr_cache(THD *thd, READ_RECORD *info);
static int rr_cmp(uchar *a,uchar *b);
static int rr_index_first(READ_RECORD *info);
+static int rr_index_last(READ_RECORD *info);
static int rr_index(READ_RECORD *info);
+static int rr_index_desc(READ_RECORD *info);
/**
- Initialize READ_RECORD structure to perform full index scan (in forward
- direction) using read_record.read_record() interface.
+ Initialize READ_RECORD structure to perform full index scan in desired
+ direction using read_record.read_record() interface
This function has been added at late stage and is used only by
UPDATE/DELETE. Other statements perform index scans using
@@ -59,10 +61,11 @@ static int rr_index(READ_RECORD *info);
@param print_error If true, call table->file->print_error() if an error
occurs (except for end-of-records error)
@param idx index to scan
+ @param reverse Scan in the reverse direction
*/
void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
- bool print_error, uint idx)
+ bool print_error, uint idx, bool reverse)
{
empty_record(table);
bzero((char*) info,sizeof(*info));
@@ -77,7 +80,7 @@ void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
if (!table->file->inited)
table->file->ha_index_init(idx, 1);
/* read_record will be changed to rr_index in rr_index_first */
- info->read_record= rr_index_first;
+ info->read_record= reverse ? rr_index_last : rr_index_first;
}
@@ -290,7 +293,7 @@ void end_read_record(READ_RECORD *info)
{ /* free cache if used */
if (info->cache)
{
- my_free_lock((char*) info->cache,MYF(0));
+ my_free_lock(info->cache);
info->cache=0;
}
if (info->table)
@@ -365,6 +368,29 @@ static int rr_index_first(READ_RECORD *info)
/**
+ Reads last row in an index scan.
+
+ @param info Scan info
+
+ @retval
+ 0 Ok
+ @retval
+ -1 End of records
+ @retval
+ 1 Error
+*/
+
+static int rr_index_last(READ_RECORD *info)
+{
+ int tmp= info->file->index_last(info->record);
+ info->read_record= rr_index_desc;
+ if (tmp)
+ tmp= rr_handle_error(info, tmp);
+ return tmp;
+}
+
+
+/**
Reads index sequentially after first row.
Read the next index record (in forward direction) and translate return
@@ -389,6 +415,31 @@ static int rr_index(READ_RECORD *info)
}
+/**
+ Reads index sequentially from the last row to the first.
+
+ Read the prev index record (in backward direction) and translate return
+ value.
+
+ @param info Scan info
+
+ @retval
+ 0 Ok
+ @retval
+ -1 End of records
+ @retval
+ 1 Error
+*/
+
+static int rr_index_desc(READ_RECORD *info)
+{
+ int tmp= info->file->index_prev(info->record);
+ if (tmp)
+ tmp= rr_handle_error(info, tmp);
+ return tmp;
+}
+
+
int rr_sequential(READ_RECORD *info)
{
int tmp;
diff --git a/sql/records.h b/sql/records.h
index ae81a31ee1a..95464a11b4b 100644
--- a/sql/records.h
+++ b/sql/records.h
@@ -71,7 +71,7 @@ void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
SQL_SELECT *select, int use_record_cache,
bool print_errors, bool disable_rr_cache);
void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
- bool print_error, uint idx);
+ bool print_error, uint idx, bool reverse);
void end_read_record(READ_RECORD *info);
void rr_unlock_row(st_join_table *tab);
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index cddf798aac0..9a1f7fb826b 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -102,7 +102,6 @@ static int init_failsafe_rpl_thread(THD* thd)
thd->mem_root->free= thd->mem_root->used= 0;
thd_proc_info(thd, "Thread initialized");
- thd->version=refresh_version;
thd->set_time();
DBUG_RETURN(0);
}
@@ -206,7 +205,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
return res;
err:
- my_free(si, MYF(MY_WME));
+ my_free(si);
my_message(ER_UNKNOWN_ERROR, errmsg, MYF(0)); /* purecov: inspected */
err2:
return 1;
@@ -222,7 +221,7 @@ extern "C" uint32
extern "C" void slave_info_free(void *s)
{
- my_free(s, MYF(MY_WME));
+ my_free(s);
}
#ifdef HAVE_PSI_INTERFACE
diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc
index 63521c0398f..42a9a034efd 100644
--- a/sql/rpl_filter.cc
+++ b/sql/rpl_filter.cc
@@ -383,7 +383,7 @@ void free_table_ent(void* a)
{
TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a;
- my_free((uchar*) e, MYF(0));
+ my_free(e);
}
@@ -434,7 +434,7 @@ Rpl_filter::free_string_array(DYNAMIC_ARRAY *a)
{
char* p;
get_dynamic(a, (uchar*) &p, i);
- my_free(p, MYF(MY_WME));
+ my_free(p);
}
delete_dynamic(a);
}
diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc
index be0a61bcae2..5f16544d855 100644
--- a/sql/rpl_handler.cc
+++ b/sql/rpl_handler.cc
@@ -89,29 +89,44 @@ int get_user_var_str(const char *name, char *value,
int delegates_init()
{
- static Aligned_char_array<sizeof(Trans_delegate)> trans_mem;
- static Aligned_char_array<sizeof(Binlog_storage_delegate)> storage_mem;
+ static my_aligned_storage<sizeof(Trans_delegate), MY_ALIGNOF(long)> trans_mem;
+ static my_aligned_storage<sizeof(Binlog_storage_delegate),
+ MY_ALIGNOF(long)> storage_mem;
#ifdef HAVE_REPLICATION
- static Aligned_char_array<sizeof(Binlog_transmit_delegate)> transmit_mem;
- static Aligned_char_array<sizeof(Binlog_relay_IO_delegate)> relay_io_mem;
+ static my_aligned_storage<sizeof(Binlog_transmit_delegate),
+ MY_ALIGNOF(long)> transmit_mem;
+ static my_aligned_storage<sizeof(Binlog_relay_IO_delegate),
+ MY_ALIGNOF(long)> relay_io_mem;
#endif
- if (!(transaction_delegate= new (trans_mem.arr()) Trans_delegate)
- || (!transaction_delegate->is_inited())
- || !(binlog_storage_delegate=
- new (storage_mem.arr()) Binlog_storage_delegate)
- || (!binlog_storage_delegate->is_inited())
+ void *place_trans_mem= trans_mem.data;
+ void *place_storage_mem= storage_mem.data;
+
+ transaction_delegate= new (place_trans_mem) Trans_delegate;
+
+ if (!transaction_delegate->is_inited())
+ return 1;
+
+ binlog_storage_delegate= new (place_storage_mem) Binlog_storage_delegate;
+
+ if (!binlog_storage_delegate->is_inited())
+ return 1;
+
#ifdef HAVE_REPLICATION
- || !(binlog_transmit_delegate=
- new (transmit_mem.arr()) Binlog_transmit_delegate)
- || (!binlog_transmit_delegate->is_inited())
- || !(binlog_relay_io_delegate=
- new (relay_io_mem.arr()) Binlog_relay_IO_delegate)
- || (!binlog_relay_io_delegate->is_inited())
-#endif /* HAVE_REPLICATION */
- )
+ void *place_transmit_mem= transmit_mem.data;
+ void *place_relay_io_mem= relay_io_mem.data;
+
+ binlog_transmit_delegate= new (place_transmit_mem) Binlog_transmit_delegate;
+
+ if (!binlog_transmit_delegate->is_inited())
return 1;
+ binlog_relay_io_delegate= new (place_relay_io_mem) Binlog_relay_IO_delegate;
+
+ if (!binlog_relay_io_delegate->is_inited())
+ return 1;
+#endif
+
if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL))
return 1;
return 0;
@@ -213,7 +228,7 @@ int Trans_delegate::after_commit(THD *thd, bool all)
if (is_real_trans && log_info)
{
my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL);
- my_free(log_info, MYF(0));
+ my_free(log_info);
}
return ret;
}
@@ -241,7 +256,7 @@ int Trans_delegate::after_rollback(THD *thd, bool all)
if (is_real_trans && log_info)
{
my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL);
- my_free(log_info, MYF(0));
+ my_free(log_info);
}
return ret;
}
diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc
index 0f636f5b2ab..75ccb617e9e 100644
--- a/sql/rpl_injector.cc
+++ b/sql/rpl_injector.cc
@@ -58,7 +58,7 @@ injector::transaction::~transaction()
*/
*the_memory= '\0';
- my_free(the_memory, MYF(0));
+ my_free(the_memory);
}
/**
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 9b0450b3f02..cda876ee764 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -164,7 +164,29 @@ int init_master_info(Master_info* mi, const char* master_info_fname,
*/
if (thread_mask & SLAVE_SQL)
{
+ bool hot_log= FALSE;
+ /*
+ my_b_seek does an implicit flush_io_cache, so we need to:
+
+ 1. check if this log is active (hot)
+ 2. if it is we keep log_lock until the seek ends, otherwise
+ release it right away.
+
+ If we did not take log_lock, SQL thread might race with IO
+ thread for the IO_CACHE mutex.
+
+ */
+ mysql_mutex_t *log_lock= mi->rli.relay_log.get_log_lock();
+ mysql_mutex_lock(log_lock);
+ hot_log= mi->rli.relay_log.is_active(mi->rli.linfo.log_file_name);
+
+ if (!hot_log)
+ mysql_mutex_unlock(log_lock);
+
my_b_seek(mi->rli.cur_log, (my_off_t) 0);
+
+ if (hot_log)
+ mysql_mutex_unlock(log_lock);
}
DBUG_RETURN(0);
}
@@ -457,16 +479,13 @@ int flush_master_info(Master_info* mi,
(1 + mi->ignore_server_ids.elements), MYF(MY_WME));
if (!ignore_server_ids_buf)
DBUG_RETURN(1);
- for (ulong i= 0, cur_len= my_sprintf(ignore_server_ids_buf,
- (ignore_server_ids_buf, "%u",
- mi->ignore_server_ids.elements));
- i < mi->ignore_server_ids.elements; i++)
+ ulong cur_len= sprintf(ignore_server_ids_buf, "%u",
+ mi->ignore_server_ids.elements);
+ for (ulong i= 0; i < mi->ignore_server_ids.elements; i++)
{
ulong s_id;
get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i);
- cur_len +=my_sprintf(ignore_server_ids_buf + cur_len,
- (ignore_server_ids_buf + cur_len,
- " %lu", s_id));
+ cur_len+= sprintf(ignore_server_ids_buf + cur_len, " %lu", s_id);
}
}
@@ -487,7 +506,7 @@ int flush_master_info(Master_info* mi,
of file we don't care about this garbage.
*/
char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always
- my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period));
+ sprintf(heartbeat_buf, "%.3f", mi->heartbeat_period);
my_b_seek(file, 0L);
my_b_printf(file,
"%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n",
@@ -498,7 +517,7 @@ int flush_master_info(Master_info* mi,
(int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert,
heartbeat_buf, "", ignore_server_ids_buf);
- my_free(ignore_server_ids_buf, MYF(0));
+ my_free(ignore_server_ids_buf);
err= flush_io_cache(file);
if (sync_masterinfo_period && !err &&
++(mi->sync_counter) >= sync_masterinfo_period)
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 8f070c51410..03c369394bf 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1138,8 +1138,7 @@ bool Relay_log_info::cached_charset_compare(char *charset) const
{
DBUG_ENTER("Relay_log_info::cached_charset_compare");
- if (bcmp((uchar*) cached_charset, (uchar*) charset,
- sizeof(cached_charset)))
+ if (memcmp(cached_charset, charset, sizeof(cached_charset)))
{
memcpy(const_cast<char*>(cached_charset), charset, sizeof(cached_charset));
DBUG_RETURN(1);
@@ -1251,7 +1250,7 @@ void Relay_log_info::clear_tables_to_lock()
tables_to_lock=
static_cast<RPL_TABLE_LIST*>(tables_to_lock->next_global);
tables_to_lock_count--;
- my_free(to_free, MYF(MY_WME));
+ my_free(to_free);
}
DBUG_ASSERT(tables_to_lock == NULL && tables_to_lock_count == 0);
}
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 0675e9b51ad..6f66905eb5d 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -517,10 +517,12 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_
bool is_conversion_ok(int order, Relay_log_info *rli)
{
DBUG_ENTER("is_conversion_ok");
- bool allow_non_lossy=
- bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
- bool allow_lossy=
- bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
+ bool allow_non_lossy, allow_lossy;
+
+ allow_non_lossy = slave_type_conversions_options &
+ (ULL(1) << SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
+ allow_lossy= slave_type_conversions_options &
+ (ULL(1) << SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
DBUG_PRINT("enter", ("order: %d, flags:%s%s", order,
allow_non_lossy ? " ALL_NON_LOSSY" : "",
@@ -1047,7 +1049,7 @@ table_def::table_def(unsigned char *types, ulong size,
table_def::~table_def()
{
- my_free(m_memory, MYF(0));
+ my_free(m_memory);
#ifndef DBUG_OFF
m_type= 0;
m_size= 0;
diff --git a/sql/share/CMakeLists.txt b/sql/share/CMakeLists.txt
index 1868200f038..14de851aaa2 100644
--- a/sql/share/CMakeLists.txt
+++ b/sql/share/CMakeLists.txt
@@ -45,10 +45,10 @@ SET(files
FOREACH (dir ${dirs})
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dir}
- DESTINATION ${INSTALL_MYSQLSHAREDIR})
+ DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server)
ENDFOREACH()
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION ${INSTALL_MYSQLSHAREDIR}
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server
PATTERN "languages.html" EXCLUDE
)
-INSTALL(FILES ${files} DESTINATION ${INSTALL_MYSQLSHAREDIR})
+INSTALL(FILES ${files} DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server)
diff --git a/sql/slave.cc b/sql/slave.cc
index 6ebdea4a42a..d41d0479dde 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1154,7 +1154,7 @@ int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f)
}
err:
if (buf_act != buf)
- my_free(buf_act, MYF(0));
+ my_free(buf_act);
DBUG_RETURN(ret);
}
@@ -1528,7 +1528,7 @@ when it try to get the value of TIME_ZONE global variable from master.";
the period is an ulonglong of nano-secs.
*/
llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf);
- my_sprintf(query, (query, query_format, llbuf));
+ sprintf(query, query_format, llbuf);
if (mysql_real_query(mysql, query, strlen(query))
&& !check_io_slave_killed(mi->io_thd, mi, NULL))
@@ -1934,17 +1934,17 @@ bool show_master_info(THD* thd, Master_info* mi)
ulong s_id, slen;
char sbuff[FN_REFLEN];
get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i);
- slen= my_sprintf(sbuff, (sbuff, (i==0? "%lu" : ", %lu"), s_id));
+ slen= sprintf(sbuff, (i==0? "%lu" : ", %lu"), s_id);
if (cur_len + slen + 4 > FN_REFLEN)
{
/*
break the loop whenever remained space could not fit
ellipses on the next cycle
*/
- my_sprintf(buff + cur_len, (buff + cur_len, "..."));
+ sprintf(buff + cur_len, "...");
break;
}
- cur_len += my_sprintf(buff + cur_len, (buff + cur_len, "%s", sbuff));
+ cur_len += sprintf(buff + cur_len, "%s", sbuff);
}
protocol->store(buff, &my_charset_bin);
}
@@ -2055,7 +2055,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
thd_proc_info(thd, "Waiting for the next event in relay log");
else
thd_proc_info(thd, "Waiting for master update");
- thd->version=refresh_version;
thd->set_time();
/* Do not use user-supplied timeout value for system threads. */
thd->variables.lock_wait_timeout= LONG_TIMEOUT;
@@ -2296,7 +2295,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli)
DBUG_PRINT("info", ("thd->options: %s%s; rli->last_event_start_time: %lu",
FLAGSTR(thd->variables.option_bits, OPTION_NOT_AUTOCOMMIT),
FLAGSTR(thd->variables.option_bits, OPTION_BEGIN),
- rli->last_event_start_time));
+ (ulong) rli->last_event_start_time));
/*
Execute the event to change the database and update the binary
@@ -3126,8 +3125,8 @@ pthread_handler_t handle_slave_sql(void *arg)
char llbuff[22],llbuff1[22];
char saved_log_name[FN_REFLEN];
char saved_master_log_name[FN_REFLEN];
- my_off_t saved_log_pos;
- my_off_t saved_master_log_pos;
+ my_off_t UNINIT_VAR(saved_log_pos);
+ my_off_t UNINIT_VAR(saved_master_log_pos);
my_off_t saved_skip= 0;
Relay_log_info* rli = &((Master_info*)arg)->rli;
@@ -3687,7 +3686,7 @@ static int queue_binlog_ver_1_event(Master_info *mi, const char *buf,
sql_print_error("Read invalid event from master: '%s',\
master could be corrupt but a more likely cause of this is a bug",
errmsg);
- my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(tmp_buf);
DBUG_RETURN(1);
}
@@ -3724,7 +3723,7 @@ static int queue_binlog_ver_1_event(Master_info *mi, const char *buf,
mi->master_log_pos += inc_pos;
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos));
mysql_mutex_unlock(&mi->data_lock);
- my_free((char*)tmp_buf, MYF(0));
+ my_free(tmp_buf);
DBUG_RETURN(error);
}
default:
@@ -3775,7 +3774,7 @@ static int queue_binlog_ver_3_event(Master_info *mi, const char *buf,
sql_print_error("Read invalid event from master: '%s',\
master could be corrupt but a more likely cause of this is a bug",
errmsg);
- my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(tmp_buf);
DBUG_RETURN(1);
}
mysql_mutex_lock(&mi->data_lock);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 1e708bcb083..f75acf11984 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -4028,6 +4028,11 @@ sp_head::add_used_tables_to_table_list(THD *thd,
table->prelocking_placeholder= 1;
table->belong_to_view= belong_to_view;
table->trg_event_map= stab->trg_event_map;
+ /*
+ Since we don't allow DDL on base tables in prelocked mode it
+ is safe to infer the type of metadata lock from the type of
+ table lock.
+ */
table->mdl_request.init(MDL_key::TABLE, table->db, table->table_name,
table->lock_type >= TL_WRITE_ALLOW_WRITE ?
MDL_SHARED_WRITE : MDL_SHARED_READ);
@@ -4057,8 +4062,9 @@ sp_head::add_used_tables_to_table_list(THD *thd,
TABLE_LIST *
sp_add_to_query_tables(THD *thd, LEX *lex,
- const char *db, const char *name,
- thr_lock_type locktype)
+ const char *db, const char *name,
+ thr_lock_type locktype,
+ enum_mdl_type mdl_type)
{
TABLE_LIST *table;
@@ -4073,8 +4079,7 @@ sp_add_to_query_tables(THD *thd, LEX *lex,
table->select_lex= lex->current_select;
table->cacheable_table= 1;
table->mdl_request.init(MDL_key::TABLE, table->db, table->table_name,
- table->lock_type >= TL_WRITE_ALLOW_WRITE ?
- MDL_SHARED_WRITE : MDL_SHARED_READ);
+ mdl_type);
lex->add_to_query_tables(table);
return table;
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 539a2da5f8c..9796c49fdfb 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -1342,7 +1342,9 @@ set_routine_security_ctx(THD *thd, sp_head *sp, bool is_proc,
TABLE_LIST *
sp_add_to_query_tables(THD *thd, LEX *lex,
const char *db, const char *name,
- thr_lock_type locktype);
+ thr_lock_type locktype,
+ enum_mdl_type mdl_type);
+
Item *
sp_prepare_func_item(THD* thd, Item **it_addr);
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index 74dda9f456b..bbf38f52efb 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -19,10 +19,6 @@
#pragma implementation
#endif
-#if defined(WIN32) || defined(__WIN__)
-#undef SAFEMALLOC /* Problems with threads */
-#endif
-
#include "sp_pcontext.h"
#include "sp_head.h"
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index e3cdf328659..047cec76486 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -19,10 +19,6 @@
#pragma implementation
#endif
-#if defined(WIN32) || defined(__WIN__)
-#undef SAFEMALLOC /* Problems with threads */
-#endif
-
#include "mysql.h"
#include "sp_head.h"
#include "sql_cursor.h"
diff --git a/sql/spatial.cc b/sql/spatial.cc
index fcf06119db9..f96196cb836 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -36,7 +36,7 @@ static Geometry::Class_info **ci_collection_end=
Geometry::ci_collection+Geometry::wkb_last + 1;
Geometry::Class_info::Class_info(const char *name, int type_id,
- void(*create_func)(void *)):
+ create_geom_t create_func):
m_type_id(type_id), m_create_func(create_func)
{
m_name.str= (char *) name;
@@ -45,39 +45,39 @@ Geometry::Class_info::Class_info(const char *name, int type_id,
ci_collection[type_id]= this;
}
-static void create_point(void *buffer)
+static Geometry *create_point(char *buffer)
{
- new(buffer) Gis_point;
+ return new (buffer) Gis_point;
}
-static void create_linestring(void *buffer)
+static Geometry *create_linestring(char *buffer)
{
- new(buffer) Gis_line_string;
+ return new (buffer) Gis_line_string;
}
-static void create_polygon(void *buffer)
+static Geometry *create_polygon(char *buffer)
{
- new(buffer) Gis_polygon;
+ return new (buffer) Gis_polygon;
}
-static void create_multipoint(void *buffer)
+static Geometry *create_multipoint(char *buffer)
{
- new(buffer) Gis_multi_point;
+ return new (buffer) Gis_multi_point;
}
-static void create_multipolygon(void *buffer)
+static Geometry *create_multipolygon(char *buffer)
{
- new(buffer) Gis_multi_polygon;
+ return new (buffer) Gis_multi_polygon;
}
-static void create_multilinestring(void *buffer)
+static Geometry *create_multilinestring(char *buffer)
{
- new(buffer) Gis_multi_line_string;
+ return new (buffer) Gis_multi_line_string;
}
-static void create_geometrycollection(void *buffer)
+static Geometry *create_geometrycollection(char *buffer)
{
- new(buffer) Gis_geometry_collection;
+ return new (buffer) Gis_geometry_collection;
}
@@ -131,10 +131,9 @@ Geometry::Class_info *Geometry::find_class(const char *name, uint32 len)
Geometry *Geometry::create_by_typeid(Geometry_buffer *buffer, int type_id)
{
Class_info *ci;
- if (!(ci= find_class((int) type_id)))
+ if (!(ci= find_class(type_id)))
return NULL;
- (*ci->m_create_func)(buffer->buf.arr());
- return my_reinterpret_cast(Geometry *)(buffer->buf.arr());
+ return (*ci->m_create_func)(buffer->data);
}
@@ -172,9 +171,7 @@ Geometry *Geometry::create_from_wkt(Geometry_buffer *buffer,
if (!(ci= find_class(name.str, name.length)) ||
wkt->reserve(1 + 4, 512))
return NULL;
- (*ci->m_create_func)((void *)buffer);
- Geometry *result= (Geometry *)buffer;
-
+ Geometry *result= (*ci->m_create_func)(buffer->data);
wkt->q_append((char) wkb_ndr);
wkt->q_append((uint32) result->get_class_info()->m_type_id);
if (trs->check_next_symbol('(') ||
diff --git a/sql/spatial.h b/sql/spatial.h
index aabbb7a1b97..b0c609ceeef 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -17,6 +17,7 @@
#define _spatial_h
#include "sql_string.h" /* String, LEX_STRING */
+#include <my_compiler.h>
#ifdef HAVE_SPATIAL
@@ -229,15 +230,18 @@ public:
{
wkb_xdr= 0, /* Big Endian */
wkb_ndr= 1 /* Little Endian */
- };
+ };
+
+ /** Callback which creates Geometry objects on top of a given placement. */
+ typedef Geometry *(*create_geom_t)(char *);
class Class_info
{
public:
LEX_STRING m_name;
int m_type_id;
- void (*m_create_func)(void *);
- Class_info(const char *name, int type_id, void(*create_func)(void *));
+ create_geom_t m_create_func;
+ Class_info(const char *name, int type_id, create_geom_t create_func);
};
virtual const Class_info *get_class_info() const=0;
@@ -525,10 +529,8 @@ public:
const Class_info *get_class_info() const;
};
-struct Geometry_buffer
-{
- Aligned_char_array<sizeof(Gis_point)> buf;
-};
+struct Geometry_buffer : public
+ my_aligned_storage<sizeof(Gis_point), MY_ALIGNOF(Gis_point)> {};
#endif /*HAVE_SPATAIAL*/
#endif
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ec25e4cb68b..074f1047d67 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -210,6 +210,7 @@ static bool compare_hostname(const acl_host_and_ip *host,const char *hostname,
const char *ip);
static my_bool acl_load(THD *thd, TABLE_LIST *tables);
static my_bool grant_load(THD *thd, TABLE_LIST *tables);
+static inline void get_grantor(THD *thd, char* grantor);
/*
Convert scrambled password to binary form, according to scramble type,
@@ -1643,12 +1644,10 @@ bool change_password(THD *thd, const char *host, const char *user,
result= 0;
if (mysql_bin_log.is_open())
{
- query_length=
- my_sprintf(buff,
- (buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
- acl_user->user ? acl_user->user : "",
- acl_user->host.hostname ? acl_user->host.hostname : "",
- new_password));
+ query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
+ acl_user->user ? acl_user->user : "",
+ acl_user->host.hostname ? acl_user->host.hostname : "",
+ new_password);
thd->clear_error();
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
FALSE, FALSE, FALSE, 0);
@@ -2755,6 +2754,20 @@ end:
DBUG_RETURN(result);
}
+static inline void get_grantor(THD *thd, char *grantor)
+{
+ const char *user= thd->security_ctx->user;
+ const char *host= thd->security_ctx->host_or_ip;
+
+#if defined(HAVE_REPLICATION)
+ if (thd->slave_thread && thd->has_invoker())
+ {
+ user= thd->get_invoker_user().str;
+ host= thd->get_invoker_host().str;
+ }
+#endif
+ strxmov(grantor, user, "@", host, NullS);
+}
static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
TABLE *table, const LEX_USER &combo,
@@ -2769,9 +2782,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
uchar user_key[MAX_KEY_LENGTH];
DBUG_ENTER("replace_table_table");
- strxmov(grantor, thd->security_ctx->user, "@",
- thd->security_ctx->host_or_ip, NullS);
-
+ get_grantor(thd, grantor);
/*
The following should always succeed as new users are created before
this function is called!
@@ -2901,9 +2912,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
DBUG_RETURN(-1);
}
- strxmov(grantor, thd->security_ctx->user, "@",
- thd->security_ctx->host_or_ip, NullS);
-
+ get_grantor(thd, grantor);
/*
New users are created before this function is called.
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 0b3e5117c97..4b6756188dd 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -408,7 +408,7 @@ void field_real::add()
if ((decs = decimals()) == NOT_FIXED_DEC)
{
- length= my_sprintf(buff, (buff, "%g", num));
+ length= sprintf(buff, "%g", num);
if (rint(num) != num)
max_notzero_dec_len = 1;
}
@@ -419,7 +419,7 @@ void field_real::add()
snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num);
length = (uint) strlen(buff);
#else
- length= my_sprintf(buff, (buff, "%-.*f", (int) decs, num));
+ length= sprintf(buff, "%-.*f", (int) decs, num);
#endif
// We never need to check further than this
@@ -1006,9 +1006,9 @@ void field_decimal::get_opt_type(String *answer,
my_decimal_set_zero(&zero);
my_bool is_unsigned= (my_decimal_cmp(&zero, &min_arg) >= 0);
- length= my_sprintf(buff, (buff, "DECIMAL(%d, %d)",
- (int) (max_length - (item->decimals ? 1 : 0)),
- item->decimals));
+ length= my_snprintf(buff, sizeof(buff), "DECIMAL(%d, %d)",
+ (int) (max_length - (item->decimals ? 1 : 0)),
+ item->decimals);
if (is_unsigned)
length= (uint) (strmov(buff+length, " UNSIGNED")- buff);
answer->append(buff, length);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 325f054db02..f746edef83f 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -16,18 +16,18 @@
/* Basic functions needed by many modules */
+#include "sql_base.h" // setup_table_map
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "debug_sync.h"
-#include "sql_base.h" // setup_table_map
#include "lock.h" // broadcast_refresh, mysql_lock_remove,
// mysql_unlock_tables,
// mysql_lock_have_duplicate
#include "sql_show.h" // append_identifier
#include "strfunc.h" // find_type
#include "parse_file.h" // sql_parse_prepare, File_parser
-#include "sql_view.h" // mysql_frm_type, mysql_make_view, VIEW_ANY_ACL
+#include "sql_view.h" // mysql_make_view, VIEW_ANY_ACL
#include "sql_parse.h" // check_table_access
#include "sql_insert.h" // kill_delayed_threads
#include "sql_acl.h" // *_ACL, check_grant_all_columns,
@@ -52,6 +52,7 @@
#include <hash.h>
#include "rpl_filter.h"
#include "sql_table.h" // build_table_filename
+#include "datadict.h" // dd_frm_type()
#ifdef __WIN__
#include <io.h>
#endif
@@ -438,6 +439,9 @@ static void table_def_unuse_table(TABLE *table)
{
DBUG_ASSERT(table->in_use);
+ /* We shouldn't put the table to 'unused' list if the share is old. */
+ DBUG_ASSERT(! table->s->needs_reopen());
+
table->in_use= 0;
/* Remove table from the list of tables used in this share. */
table->s->used_tables.remove(table);
@@ -558,7 +562,9 @@ found:
DBUG_RETURN(0);
}
- if (!share->ref_count++ && share->prev)
+ ++share->ref_count;
+
+ if (share->ref_count == 1 && share->prev)
{
/*
Share was not used before and it was in the old_unused_share list
@@ -685,7 +691,6 @@ static TABLE_SHARE
void release_table_share(TABLE_SHARE *share)
{
- bool to_be_deleted= 0;
DBUG_ENTER("release_table_share");
DBUG_PRINT("enter",
("share: 0x%lx table: %s.%s ref_count: %u version: %lu",
@@ -697,9 +702,8 @@ void release_table_share(TABLE_SHARE *share)
DBUG_ASSERT(share->ref_count);
if (!--share->ref_count)
{
- if (share->version != refresh_version ||
- table_def_shutdown_in_progress)
- to_be_deleted=1;
+ if (share->needs_reopen() || table_def_shutdown_in_progress)
+ my_hash_delete(&table_def_cache, (uchar*) share);
else
{
/* Link share last in used_table_share list */
@@ -711,15 +715,14 @@ void release_table_share(TABLE_SHARE *share)
end_of_unused_share.prev= &share->next;
share->next= &end_of_unused_share;
- to_be_deleted= (table_def_cache.records > table_def_size);
+ if (table_def_cache.records > table_def_size)
+ {
+ /* Delete the least used share to preserve LRU order. */
+ my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share);
+ }
}
}
- if (to_be_deleted)
- {
- DBUG_PRINT("info", ("Deleting share"));
- my_hash_delete(&table_def_cache, (uchar*) share);
- }
DBUG_VOID_RETURN;
}
@@ -834,7 +837,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
I_P_List_iterator<TABLE, TABLE_share> it(share->used_tables);
while (it++)
++(*start_list)->in_use;
- (*start_list)->locked= (share->version == 0) ? 1 : 0;
+ (*start_list)->locked= 0; /* Obsolete. */
start_list= &(*start_list)->next;
*start_list=0;
}
@@ -882,7 +885,7 @@ static void free_cache_entry(TABLE *table)
intern_close_table(table);
- my_free((uchar*) table,MYF(0));
+ my_free(table);
DBUG_VOID_RETURN;
}
@@ -894,7 +897,7 @@ void free_io_cache(TABLE *table)
if (table->sort.io_cache)
{
close_cached_file(table->sort.io_cache);
- my_free((uchar*) table->sort.io_cache,MYF(0));
+ my_free(table->sort.io_cache);
table->sort.io_cache=0;
}
DBUG_VOID_RETURN;
@@ -1023,6 +1026,9 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
TABLE_LIST *tables_to_reopen= (tables ? tables :
thd->locked_tables_list.locked_tables());
+ /* Close open HANLER instances to avoid self-deadlock. */
+ mysql_ha_flush_tables(thd, tables_to_reopen);
+
for (TABLE_LIST *table_list= tables_to_reopen; table_list;
table_list= table_list->next_global)
{
@@ -1050,7 +1056,8 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
{
found= FALSE;
/*
- To avoid self and other kinds of deadlock we have to flush open HANDLERs.
+ To a self-deadlock or deadlocks with other FLUSH threads
+ waiting on our open HANDLERs, we have to flush them.
*/
mysql_ha_flush(thd);
DEBUG_SYNC(thd, "after_flush_unlock");
@@ -1065,7 +1072,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
{
TABLE_SHARE *share=(TABLE_SHARE*) my_hash_element(&table_def_cache,
idx);
- if (share->version != refresh_version)
+ if (share->needs_reopen())
{
found= TRUE;
break;
@@ -1077,7 +1084,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
for (TABLE_LIST *table= tables; table; table= table->next_local)
{
TABLE_SHARE *share= get_cached_table_share(table->db, table->table_name);
- if (share && share->version != refresh_version)
+ if (share && share->needs_reopen())
{
found= TRUE;
break;
@@ -1295,29 +1302,21 @@ static void close_open_tables(THD *thd)
mysql_mutex_assert_not_owner(&LOCK_open);
- mysql_mutex_lock(&LOCK_open);
-
DBUG_PRINT("info", ("thd->open_tables: 0x%lx", (long) thd->open_tables));
while (thd->open_tables)
found_old_table|= close_thread_table(thd, &thd->open_tables);
- /* Free tables to hold down open files */
- while (table_cache_count > table_cache_size && unused_tables)
- free_cache_entry(unused_tables);
if (found_old_table)
{
/* Tell threads waiting for refresh that something has happened */
broadcast_refresh();
}
-
- mysql_mutex_unlock(&LOCK_open);
}
/**
- Close all open instances of the table but keep the MDL lock,
- if any.
+ Close all open instances of the table but keep the MDL lock.
Works both under LOCK TABLES and in the normal mode.
Removes all closed instances of the table from the table cache.
@@ -1331,6 +1330,8 @@ static void close_open_tables(THD *thd)
In that case the documented behaviour is to
implicitly remove the table from LOCK TABLES
list.
+
+ @pre Must be called with an X MDL lock on the table.
*/
void
@@ -1339,17 +1340,12 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
{
char key[MAX_DBKEY_LENGTH];
uint key_length= share->table_cache_key.length;
+ const char *db= key;
+ const char *table_name= db + share->db.length + 1;
memcpy(key, share->table_cache_key.str, key_length);
mysql_mutex_assert_not_owner(&LOCK_open);
- /*
- We need to hold LOCK_open while changing the open_tables
- list, since another thread may work on it.
- @sa mysql_notify_thread_having_shared_lock()
- */
- mysql_mutex_lock(&LOCK_open);
-
for (TABLE **prev= &thd->open_tables; *prev; )
{
TABLE *table= *prev;
@@ -1357,10 +1353,9 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
if (table->s->table_cache_key.length == key_length &&
!memcmp(table->s->table_cache_key.str, key, key_length))
{
- /* Inform handler that table will be dropped after close */
- if (table->db_stat)
- table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
-
+ thd->locked_tables_list.unlink_from_list(thd,
+ table->pos_in_locked_tables,
+ remove_from_locked_tables);
/*
Does nothing if the table is not locked.
This allows one to use this function after a table
@@ -1368,12 +1363,9 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
*/
mysql_lock_remove(thd, thd->lock, table);
- thd->locked_tables_list.unlink_from_list(thd,
- table->pos_in_locked_tables,
- remove_from_locked_tables);
-
- /* Make sure the table is removed from the cache */
- table->s->version= 0;
+ /* Inform handler that table will be dropped after close */
+ if (table->db_stat) /* Not true for partitioned tables. */
+ table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
close_thread_table(thd, prev);
}
else
@@ -1382,9 +1374,15 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
prev= &table->next;
}
}
- /* We have been removing tables from the table cache. */
- broadcast_refresh();
+ /* Remove the table share from the cache. */
+ mysql_mutex_lock(&LOCK_open);
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db, table_name);
mysql_mutex_unlock(&LOCK_open);
+ /*
+ There could be a FLUSH thread waiting
+ on the table to go away. Wake it up.
+ */
+ broadcast_refresh();
}
@@ -1583,30 +1581,43 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
DBUG_ENTER("close_thread_table");
DBUG_ASSERT(table->key_read == 0);
DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
- mysql_mutex_assert_owner(&LOCK_open);
+ mysql_mutex_assert_not_owner(&LOCK_open);
+
+ table->mdl_ticket= NULL;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
*table_ptr=table->next;
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
- table->mdl_ticket= NULL;
- if (table->s->needs_reopen() ||
- thd->version != refresh_version || table->needs_reopen() ||
+ if (! table->needs_reopen())
+ {
+ /* Avoid having MERGE tables with attached children in unused_tables. */
+ table->file->extra(HA_EXTRA_DETACH_CHILDREN);
+ /* Free memory and reset for next loop. */
+ free_field_buffers_larger_than(table, MAX_TDC_BLOB_SIZE);
+ table->file->ha_reset();
+ }
+
+ mysql_mutex_lock(&LOCK_open);
+
+ if (table->s->needs_reopen() || table->needs_reopen() ||
table_def_shutdown_in_progress)
{
free_cache_entry(table);
- found_old_table=1;
+ found_old_table= 1;
}
else
{
- /* Avoid to have MERGE tables with attached children in unused_tables. */
DBUG_ASSERT(table->file);
- table->file->extra(HA_EXTRA_DETACH_CHILDREN);
-
- /* Free memory and reset for next loop */
- free_field_buffers_larger_than(table,MAX_TDC_BLOB_SIZE);
-
- table->file->ha_reset();
table_def_unuse_table(table);
+ /*
+ We free the least used table, not the subject table,
+ to keep the LRU order.
+ */
+ if (table_cache_count > table_cache_size)
+ free_cache_entry(unused_tables);
}
+ mysql_mutex_unlock(&LOCK_open);
DBUG_RETURN(found_old_table);
}
@@ -1625,6 +1636,7 @@ static inline uint tmpkeyval(THD *thd, TABLE *table)
void close_temporary_tables(THD *thd)
{
+ DBUG_ENTER("close_temporary_tables");
TABLE *table;
TABLE *next= NULL;
TABLE *prev_table;
@@ -1632,10 +1644,9 @@ void close_temporary_tables(THD *thd)
bool was_quote_show= TRUE;
if (!thd->temporary_tables)
- return;
+ DBUG_VOID_RETURN;
- if (!mysql_bin_log.is_open() ||
- (thd->is_current_stmt_binlog_format_row() && thd->variables.binlog_format == BINLOG_FORMAT_ROW))
+ if (!mysql_bin_log.is_open())
{
TABLE *tmp_next;
for (table= thd->temporary_tables; table; table= tmp_next)
@@ -1644,7 +1655,7 @@ void close_temporary_tables(THD *thd)
close_temporary(table, 1, 1);
}
thd->temporary_tables= 0;
- return;
+ DBUG_VOID_RETURN;
}
/* Better add "if exists", in case a RESET MASTER has been done */
@@ -1760,6 +1771,7 @@ void close_temporary_tables(THD *thd)
if (!was_quote_show)
thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE; /* restore option */
thd->temporary_tables=0;
+ DBUG_VOID_RETURN;
}
/*
@@ -2124,7 +2136,7 @@ void close_temporary(TABLE *table, bool free_share, bool delete_table)
if (free_share)
{
free_table_share(table->s);
- my_free((char*) table,MYF(0));
+ my_free(table);
}
DBUG_VOID_RETURN;
}
@@ -2227,14 +2239,15 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
DBUG_ASSERT(table == thd->open_tables);
handlerton *table_type= table->s->db_type();
- /* Ensure the table is removed from the cache. */
- table->s->version= 0;
- mysql_mutex_lock(&LOCK_open);
table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
close_thread_table(thd, &thd->open_tables);
- quick_rm_table(table_type, db_name, table_name, 0);
+ /* Remove the table share from the table cache. */
+ mysql_mutex_lock(&LOCK_open);
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db_name, table_name);
mysql_mutex_unlock(&LOCK_open);
+ /* Remove the table from the storage engine and rm the .frm. */
+ quick_rm_table(table_type, db_name, table_name, 0);
}
DBUG_VOID_RETURN;
}
@@ -2294,7 +2307,7 @@ void wait_for_condition(THD *thd, mysql_mutex_t *mutex, mysql_cond_t *cond)
@param[out] exists Out parameter which is set to TRUE if table
exists and to FALSE otherwise.
- @note This function assumes that caller owns LOCK_open mutex.
+ @note This function acquires LOCK_open internally.
It also assumes that the fact that there are no exclusive
metadata locks on the table was checked beforehand.
@@ -2302,28 +2315,30 @@ void wait_for_condition(THD *thd, mysql_mutex_t *mutex, mysql_cond_t *cond)
of engines (e.g. it was created on another node of NDB cluster)
this function will fetch and create proper .FRM file for it.
- @retval TRUE Some error occured
+ @retval TRUE Some error occurred
@retval FALSE No error. 'exists' out parameter set accordingly.
*/
bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists)
{
char path[FN_REFLEN + 1];
- int rc;
+ int rc= 0;
DBUG_ENTER("check_if_table_exists");
- mysql_mutex_assert_owner(&LOCK_open);
+ mysql_mutex_assert_not_owner(&LOCK_open);
*exists= TRUE;
+ mysql_mutex_lock(&LOCK_open);
+
if (get_cached_table_share(table->db, table->table_name))
- DBUG_RETURN(FALSE);
+ goto end;
build_table_filename(path, sizeof(path) - 1, table->db, table->table_name,
reg_ext, 0);
if (!access(path, F_OK))
- DBUG_RETURN(FALSE);
+ goto end;
/* .FRM file doesn't exist. Check if some engine can provide it. */
@@ -2333,19 +2348,17 @@ bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists)
{
/* Table does not exists in engines as well. */
*exists= FALSE;
- DBUG_RETURN(FALSE);
- }
- else if (!rc)
- {
- /* Table exists in some engine and .FRM for it was created. */
- DBUG_RETURN(FALSE);
+ rc= 0;
}
- else /* (rc > 0) */
+ else if (rc)
{
my_printf_error(ER_UNKNOWN_ERROR, "Failed to open '%-.64s', error while "
"unpacking from engine", MYF(0), table->table_name);
- DBUG_RETURN(TRUE);
}
+
+end:
+ mysql_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(test(rc));
}
@@ -2364,82 +2377,192 @@ void table_share_release_hook(void *share)
/**
- A helper function that acquires an MDL lock for a table
- being opened.
+ 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.
*/
-static bool
-open_table_get_mdl_lock(THD *thd, TABLE_LIST *table_list,
- MDL_request *mdl_request,
- Open_table_context *ot_ctx,
- uint flags)
+class MDL_deadlock_handler : public Internal_error_handler
{
- if (table_list->lock_strategy)
+public:
+ MDL_deadlock_handler(Open_table_context *ot_ctx_arg)
+ : m_ot_ctx(ot_ctx_arg), m_is_active(FALSE)
+ {}
+
+ virtual ~MDL_deadlock_handler() {}
+
+ virtual bool handle_condition(THD *thd,
+ uint sql_errno,
+ const char* sqlstate,
+ MYSQL_ERROR::enum_warning_level level,
+ const char* msg,
+ MYSQL_ERROR ** cond_hdl);
+
+private:
+ /** Open table context to be used for back-off request. */
+ Open_table_context *m_ot_ctx;
+ /**
+ Indicates that we are already in the process of handling
+ ER_LOCK_DEADLOCK error. Allows to re-emit the error from
+ the error handler without falling into infinite recursion.
+ */
+ bool m_is_active;
+};
+
+
+bool MDL_deadlock_handler::handle_condition(THD *,
+ uint sql_errno,
+ const char*,
+ MYSQL_ERROR::enum_warning_level,
+ const char*,
+ MYSQL_ERROR ** cond_hdl)
+{
+ *cond_hdl= NULL;
+ if (! m_is_active && sql_errno == ER_LOCK_DEADLOCK)
{
- MDL_request_list mdl_requests;
- MDL_request *global_request;
+ /* Disable the handler to avoid infinite recursion. */
+ m_is_active= TRUE;
+ (void) m_ot_ctx->request_backoff_action(Open_table_context::OT_MDL_CONFLICT,
+ NULL);
+ m_is_active= FALSE;
/*
- In case of CREATE TABLE .. If NOT EXISTS .. SELECT, the table
- may not yet exist. Let's acquire an exclusive lock for that
- case. If later it turns out the table existsed, we will
- downgrade the lock to shared. Note that, according to the
- locking protocol, all exclusive locks must be acquired before
- shared locks. This invariant is preserved here and is also
- enforced by asserts in metadata locking subsystem.
+ If the above back-off request failed, a new instance of
+ ER_LOCK_DEADLOCK error was emitted. Thus the current
+ instance of error condition can be treated as handled.
*/
+ return TRUE;
+ }
+ return FALSE;
+}
- mdl_request->set_type(MDL_EXCLUSIVE);
- DBUG_ASSERT(! thd->mdl_context.has_locks() ||
- thd->handler_tables_hash.records ||
- thd->global_read_lock.is_acquired());
-
- if (!(global_request= ot_ctx->get_global_mdl_request(thd)))
- return 1;
- mdl_requests.push_front(mdl_request);
- mdl_requests.push_front(global_request);
+/**
+ Try to acquire an MDL lock for a table being opened.
+
+ @param[in,out] thd Session context, to report errors.
+ @param[out] ot_ctx Open table context, to hold the back off
+ state. If we failed to acquire a lock
+ due to a lock conflict, we add the
+ failed request to the open table context.
+ @param[in,out] mdl_request A request for an MDL lock.
+ If we managed to acquire a ticket
+ (no errors or lock conflicts occurred),
+ contains a reference to it on
+ return. However, is not modified if MDL
+ lock type- modifying flags were provided.
+ @param[in] flags flags MYSQL_OPEN_FORCE_SHARED_MDL,
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL or
+ MYSQL_OPEN_FAIL_ON_MDL_CONFLICT
+ @sa open_table().
+ @param[out] mdl_ticket Only modified if there was no error.
+ If we managed to acquire an MDL
+ lock, contains a reference to the
+ ticket, otherwise is set to NULL.
+
+ @retval TRUE An error occurred.
+ @retval FALSE No error, but perhaps a lock conflict, check mdl_ticket.
+*/
- if (thd->mdl_context.acquire_locks(&mdl_requests, ot_ctx->get_timeout()))
- return 1;
- }
- else
+static bool
+open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
+ MDL_request *mdl_request,
+ uint flags,
+ MDL_ticket **mdl_ticket)
+{
+ if (flags & (MYSQL_OPEN_FORCE_SHARED_MDL |
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL))
{
- if (flags & MYSQL_OPEN_FORCE_SHARED_MDL)
- {
- /*
- While executing PREPARE for prepared statement we override
- type-of-operation aware type of shared metadata lock which
- was set in the parser with simple shared metadata lock.
- This is necessary to allow concurrent execution of PREPARE
- and LOCK TABLES WRITE statement which locks one of the tables
- used in the statement being prepared.
- */
- DBUG_ASSERT(!(flags & (MYSQL_OPEN_TAKE_UPGRADABLE_MDL |
- MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL)));
+ /*
+ MYSQL_OPEN_FORCE_SHARED_MDL flag means that we are executing
+ PREPARE for a prepared statement and want to override
+ the type-of-operation aware metadata lock which was set
+ in the parser/during view opening with a simple shared
+ metadata lock.
+ This is necessary to allow concurrent execution of PREPARE
+ and LOCK TABLES WRITE statement against the same table.
+
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL flag means that we open
+ the table in order to get information about it for one of I_S
+ queries and also want to override the type-of-operation aware
+ shared metadata lock which was set earlier (e.g. during view
+ opening) with a high-priority shared metadata lock.
+ This is necessary to avoid unnecessary waiting and extra
+ ER_WARN_I_S_SKIPPED_TABLE warnings when accessing I_S tables.
+
+ These two flags are mutually exclusive.
+ */
+ DBUG_ASSERT(!(flags & MYSQL_OPEN_FORCE_SHARED_MDL) ||
+ !(flags & MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL));
- mdl_request->set_type(MDL_SHARED);
- }
- else if (flags & MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL)
- {
- DBUG_ASSERT(!(flags & MYSQL_OPEN_TAKE_UPGRADABLE_MDL));
- mdl_request->set_type(MDL_SHARED_HIGH_PRIO);
- }
+ mdl_request= new (thd->mem_root) MDL_request(mdl_request);
+ if (mdl_request == NULL)
+ return TRUE;
- ot_ctx->add_request(mdl_request);
+ mdl_request->set_type((flags & MYSQL_OPEN_FORCE_SHARED_MDL) ?
+ MDL_SHARED : MDL_SHARED_HIGH_PRIO);
+ }
- if (thd->mdl_context.try_acquire_lock(mdl_request))
- return 1;
+ ot_ctx->add_request(mdl_request);
+ if (flags & MYSQL_OPEN_FAIL_ON_MDL_CONFLICT)
+ {
+ /*
+ When table is being open in order to get data for I_S table,
+ we might have some tables not only open but also locked (e.g. when
+ this happens under LOCK TABLES or in a stored function).
+ As a result by waiting on a conflicting metadata lock to go away
+ we may create a deadlock which won't entirely belong to the
+ MDL subsystem and thus won't be detectable by this subsystem's
+ deadlock detector.
+ To avoid such situation we skip the trouble-making table if
+ there is a conflicting lock.
+ */
+ if (thd->mdl_context.try_acquire_lock(mdl_request))
+ return TRUE;
if (mdl_request->ticket == NULL)
{
- if (flags & MYSQL_OPEN_FAIL_ON_MDL_CONFLICT)
- my_error(ER_WARN_I_S_SKIPPED_TABLE, MYF(0), table_list->db, table_list->table_name);
- else
- ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_MDL_LOCK);
- return 1;
+ my_error(ER_WARN_I_S_SKIPPED_TABLE, MYF(0),
+ mdl_request->key.db_name(), mdl_request->key.name());
+ return TRUE;
}
}
- return 0;
+ else
+ {
+ /*
+ We are doing a normal table open. Let us try to acquire a metadata
+ lock on the table. If there is a conflicting lock, acquire_lock()
+ will wait for it to go away. Sometimes this waiting may lead to a
+ deadlock, with the following results:
+ 1) If a deadlock is entirely within MDL subsystem, it is
+ detected by the deadlock detector of this subsystem.
+ ER_LOCK_DEADLOCK error is produced. Then, the error handler
+ that is installed prior to the call to acquire_lock() attempts
+ to request a back-off and retry. Upon success, ER_LOCK_DEADLOCK
+ error is suppressed, otherwise propagated up the calling stack.
+ 2) Otherwise, a deadlock may occur when the wait-for graph
+ includes edges not visible to the MDL deadlock detector.
+ One such example is a wait on an InnoDB row lock, e.g. when:
+ conn C1 gets SR MDL lock on t1 with SELECT * FROM t1
+ conn C2 gets a row lock on t2 with SELECT * FROM t2 FOR UPDATE
+ conn C3 gets in and waits on C1 with DROP TABLE t0, t1
+ conn C2 continues and blocks on C3 with SELECT * FROM t0
+ conn C1 deadlocks by waiting on C2 by issuing SELECT * FROM
+ t2 LOCK IN SHARE MODE.
+ Such circular waits are currently only resolved by timeouts,
+ e.g. @@innodb_lock_wait_timeout or @@lock_wait_timeout.
+ */
+ MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
+
+ thd->push_internal_handler(&mdl_deadlock_handler);
+ bool result= thd->mdl_context.acquire_lock(mdl_request,
+ ot_ctx->get_timeout());
+ thd->pop_internal_handler();
+
+ if (result && !ot_ctx->can_recover_from_failed_open())
+ return TRUE;
+ }
+ *mdl_ticket= mdl_request->ticket;
+ return FALSE;
}
@@ -2474,11 +2597,9 @@ open_table_get_mdl_lock(THD *thd, TABLE_LIST *table_list,
is never opened. In both cases, metadata locks are always taken according
to the lock strategy.
- This function will take a exclusive metadata lock on the table if
- TABLE_LIST::lock_strategy is EXCLUSIVE_DOWNGRADABLE_MDL or EXCLUSIVE_MDL.
- If the lock strategy is EXCLUSIVE_DOWNGRADABLE_MDL and opening the table
- is successful, the exclusive metadata lock is downgraded to a shared
- lock.
+ If the lock strategy is OTLS_DOWNGRADE_IF_EXISTS and opening the table
+ is successful, the exclusive metadata lock acquired by the caller
+ is downgraded to a shared lock.
RETURN
TRUE Open failed. "action" parameter may contain type of action
@@ -2490,13 +2611,13 @@ open_table_get_mdl_lock(THD *thd, TABLE_LIST *table_list,
bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
- Open_table_context *ot_ctx, uint flags)
+ Open_table_context *ot_ctx)
{
reg1 TABLE *table;
char key[MAX_DBKEY_LENGTH];
uint key_length;
char *alias= table_list->alias;
- MDL_request *mdl_request;
+ uint flags= ot_ctx->get_flags();
MDL_ticket *mdl_ticket;
int error;
TABLE_SHARE *share;
@@ -2532,9 +2653,10 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (thd->global_read_lock.wait_if_global_read_lock(thd, 1, 1))
DBUG_RETURN(TRUE);
- if (thd->version != refresh_version)
+ if (thd->open_tables && thd->open_tables->s->version != refresh_version)
{
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_TDC);
+ (void) ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_TDC,
+ NULL);
DBUG_RETURN(TRUE);
}
}
@@ -2678,7 +2800,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
during prelocking process (in this case in theory we still
should hold shared metadata lock on it).
*/
- if (mysql_frm_type(thd, path, &not_used) == FRMTYPE_VIEW)
+ if (dd_frm_type(thd, path, &not_used) == FRMTYPE_VIEW)
{
if (!tdc_open_view(thd, table_list, alias, key, key_length,
mem_root, 0))
@@ -2707,66 +2829,45 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
This is the normal use case.
*/
- mdl_request= &table_list->mdl_request;
if (! (flags & MYSQL_OPEN_HAS_MDL_LOCK))
{
- if (open_table_get_mdl_lock(thd, table_list, mdl_request, ot_ctx, flags))
+ if (open_table_get_mdl_lock(thd, ot_ctx, &table_list->mdl_request,
+ flags, &mdl_ticket) ||
+ mdl_ticket == NULL)
{
DEBUG_SYNC(thd, "before_open_table_wait_refresh");
DBUG_RETURN(TRUE);
}
DEBUG_SYNC(thd, "after_open_table_mdl_shared");
}
-
- /*
- Grab reference to the granted MDL lock ticket. Must be done after
- open_table_get_mdl_lock as the lock on the table might have been
- acquired previously (MYSQL_OPEN_HAS_MDL_LOCK).
- */
- mdl_ticket= mdl_request->ticket;
+ else
+ {
+ /*
+ Grab reference to the MDL lock ticket that was acquired
+ by the caller.
+ */
+ mdl_ticket= table_list->mdl_request.ticket;
+ }
hash_value= my_calc_hash(&table_def_cache, (uchar*) key, key_length);
- mysql_mutex_lock(&LOCK_open);
- /*
- If it's the first table from a list of tables used in a query,
- remember refresh_version (the version of open_cache state).
- If the version changes while we're opening the remaining tables,
- we will have to back off, close all the tables opened-so-far,
- and try to reopen them.
- Note: refresh_version is currently changed only during FLUSH TABLES.
- */
- if (!thd->open_tables)
- thd->version=refresh_version;
- else if ((thd->version != refresh_version) &&
- ! (flags & MYSQL_OPEN_IGNORE_FLUSH))
- {
- /* Someone did a refresh while thread was opening tables */
- mysql_mutex_unlock(&LOCK_open);
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_TDC);
- DBUG_RETURN(TRUE);
- }
if (table_list->open_strategy == TABLE_LIST::OPEN_IF_EXISTS)
{
bool exists;
if (check_if_table_exists(thd, table_list, &exists))
- goto err_unlock2;
+ DBUG_RETURN(TRUE);
if (!exists)
- {
- mysql_mutex_unlock(&LOCK_open);
DBUG_RETURN(FALSE);
- }
+
/* Table exists. Let us try to open it. */
}
else if (table_list->open_strategy == TABLE_LIST::OPEN_STUB)
- {
- mysql_mutex_unlock(&LOCK_open);
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
@@ -2788,7 +2889,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
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.
@@ -2802,26 +2903,15 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
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 |
- (flags & OPEN_VIEW_NO_PARSE), thd->open_options,
+ 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);
- if (flags & OPEN_VIEW_NO_PARSE)
- {
- /*
- VIEW not really opened, only frm were read.
- Set 1 as a flag here
- */
- table_list->view= (LEX*)1;
- }
- else
- {
- DBUG_ASSERT(table_list->view);
- }
+ DBUG_ASSERT(table_list->view);
mysql_mutex_unlock(&LOCK_open);
DBUG_RETURN(FALSE);
@@ -2868,7 +2958,15 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
}
#endif
- if (share->version != refresh_version)
+
+ /*
+ If the version changes while we're opening the tables,
+ we have to back off, close all the tables opened-so-far,
+ and try to reopen them. Note: refresh_version is currently
+ changed only during FLUSH TABLES.
+ */
+ if (share->needs_reopen() ||
+ (thd->open_tables && thd->open_tables->s->version != share->version))
{
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
{
@@ -2884,11 +2982,10 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
*/
release_table_share(share);
mysql_mutex_unlock(&LOCK_open);
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_TDC);
+ (void) ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_TDC,
+ NULL);
DBUG_RETURN(TRUE);
}
- /* Force close at once after usage */
- thd->version= share->version;
}
if (!share->free_tables.is_empty())
@@ -2904,9 +3001,11 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
while (table_cache_count > table_cache_size && unused_tables)
free_cache_entry(unused_tables);
+ mysql_mutex_unlock(&LOCK_open);
+
/* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
- goto err_unlock;
+ goto err_lock;
error= open_table_from_share(thd, share, alias,
(uint) (HA_OPEN_KEYFILE |
@@ -2919,29 +3018,26 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (error)
{
- my_free(table, MYF(0));
+ my_free(table);
if (error == 7)
- {
- share->version= 0;
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER);
- }
+ (void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER,
+ table_list);
else if (share->crashed)
- {
- share->version= 0;
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_REPAIR);
- }
+ (void) ot_ctx->request_backoff_action(Open_table_context::OT_REPAIR,
+ table_list);
- goto err_unlock;
+ goto err_lock;
}
if (open_table_entry_fini(thd, share, table))
{
closefrm(table, 0);
- my_free((uchar*)table, MYF(0));
- goto err_unlock;
+ my_free(table);
+ goto err_lock;
}
+ mysql_mutex_lock(&LOCK_open);
/* Add table to the share's used tables list. */
table_def_add_used_table(thd, table);
}
@@ -2953,14 +3049,14 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table exists now we should downgrade our exclusive metadata
lock on this table to SW metadata lock.
*/
- if (table_list->lock_strategy == TABLE_LIST::EXCLUSIVE_DOWNGRADABLE_MDL &&
+ if (table_list->lock_strategy == TABLE_LIST::OTLS_DOWNGRADE_IF_EXISTS &&
!(flags & MYSQL_OPEN_HAS_MDL_LOCK))
mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_WRITE);
table->mdl_ticket= mdl_ticket;
- table->next=thd->open_tables; /* Link into simple list */
- thd->open_tables=table;
+ table->next= thd->open_tables; /* Link into simple list */
+ thd->set_open_tables(table);
table->reginfo.lock_type=TL_READ; /* Assume read */
@@ -3003,6 +3099,8 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table->file->extra(HA_EXTRA_DETACH_CHILDREN);
DBUG_RETURN(FALSE);
+err_lock:
+ mysql_mutex_lock(&LOCK_open);
err_unlock:
release_table_share(share);
err_unlock2:
@@ -3300,7 +3398,6 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
*/
if (reopen_count)
{
- mysql_mutex_lock(&LOCK_open);
while (reopen_count--)
{
/*
@@ -3317,7 +3414,6 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
close_thread_table(thd, &thd->open_tables);
}
broadcast_refresh();
- mysql_mutex_unlock(&LOCK_open);
}
/* Exclude all closed tables from the LOCK TABLES list. */
for (TABLE_LIST *table_list= m_locked_tables; table_list; table_list=
@@ -3351,7 +3447,7 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
bool
Locked_tables_list::reopen_tables(THD *thd)
{
- Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+ Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
size_t reopen_count= 0;
MYSQL_LOCK *lock;
MYSQL_LOCK *merged_lock;
@@ -3363,8 +3459,7 @@ Locked_tables_list::reopen_tables(THD *thd)
continue;
/* Links into thd->open_tables upon success */
- if (open_table(thd, table_list, thd->mem_root, &ot_ctx_unused,
- MYSQL_OPEN_REOPEN))
+ if (open_table(thd, table_list, thd->mem_root, &ot_ctx))
{
unlink_all_closed_tables(thd, 0, reopen_count);
return TRUE;
@@ -3684,10 +3779,10 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry)
query, (ulong)(end-query),
FALSE, FALSE, FALSE, errcode))
{
- my_free(query, MYF(0));
+ my_free(query);
return TRUE;
}
- my_free(query, MYF(0));
+ my_free(query);
}
else
{
@@ -3719,7 +3814,7 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
TABLE_SHARE *share;
TABLE *entry;
int not_used;
- bool result= FALSE;
+ bool result= TRUE;
my_hash_value_type hash_value;
cache_key_length= create_table_def_key(thd, cache_key, table_list, 0);
@@ -3734,20 +3829,19 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
cache_key_length,
OPEN_VIEW, &not_used,
hash_value)))
- {
- mysql_mutex_unlock(&LOCK_open);
- return TRUE;
- }
+ goto end_unlock;
if (share->is_view)
- goto end_with_lock_open;
+ {
+ release_table_share(share);
+ goto end_unlock;
+ }
if (!(entry= (TABLE*)my_malloc(sizeof(TABLE), MYF(MY_WME))))
{
- result= TRUE;
- goto end_with_lock_open;
+ release_table_share(share);
+ goto end_unlock;
}
- share->version= 0;
mysql_mutex_unlock(&LOCK_open);
if (open_table_from_share(thd, share, table_list->alias,
@@ -3766,19 +3860,21 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
share->table_name.str);
if (entry->file)
closefrm(entry, 0);
- result= TRUE;
}
else
{
thd->clear_error(); // Clear error message
closefrm(entry, 0);
+ result= FALSE;
}
- my_free(entry, MYF(0));
+ my_free(entry);
mysql_mutex_lock(&LOCK_open);
-
-end_with_lock_open:
release_table_share(share);
+ /* Remove the repaired share from the table cache. */
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
+ table_list->db, table_list->table_name);
+end_unlock:
mysql_mutex_unlock(&LOCK_open);
return result;
}
@@ -3786,14 +3882,17 @@ end_with_lock_open:
/** Open_table_context */
-Open_table_context::Open_table_context(THD *thd, ulong timeout)
- :m_action(OT_NO_ACTION),
+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_global_mdl_request(NULL),
- m_timeout(timeout)
+ thd->mdl_context.trans_sentinel())
{}
@@ -3807,10 +3906,8 @@ MDL_request *Open_table_context::get_global_mdl_request(THD *thd)
{
if (! m_global_mdl_request)
{
- char *buff;
- if ((buff= (char*)thd->alloc(sizeof(MDL_request))))
+ if ((m_global_mdl_request= new (thd->mem_root) MDL_request()))
{
- m_global_mdl_request= new (buff) MDL_request();
m_global_mdl_request->init(MDL_key::GLOBAL, "", "",
MDL_INTENTION_EXCLUSIVE);
}
@@ -3829,30 +3926,51 @@ MDL_request *Open_table_context::get_global_mdl_request(THD *thd)
bool
Open_table_context::
-request_backoff_action(enum_open_table_action action_arg)
+request_backoff_action(enum_open_table_action action_arg,
+ TABLE_LIST *table)
{
/*
- We are inside a transaction that already holds locks and have
- met a broken table or a table which needs re-discovery.
- Performing any recovery action requires acquiring an exclusive
- metadata lock on this table. Doing that with locks breaks the
- metadata locking protocol and might lead to deadlocks,
- so we report an error.
-
- However, if we have only met a conflicting lock or an old
- TABLE version, and just need to wait for the conflict to
- disappear/old version to go away, allow waiting.
- While waiting, we use a simple empiric to detect
- deadlocks: we never wait on someone who's waiting too.
- Waiting will be done after releasing metadata locks acquired
- by this statement.
+ A back off action may be one of the three kinds:
+
+ * We met a broken table that needs repair, or a table that
+ is not present on this MySQL server and needs re-discovery.
+ To perform the action, we need an exclusive metadata lock on
+ the table. Acquiring an X lock while holding other shared
+ locks is very deadlock-prone. If this is a multi- statement
+ transaction that holds metadata locks for completed
+ statements, we don't do it, and report an error instead.
+ * Our attempt to acquire an MDL lock lead to a deadlock,
+ detected by the MDL deadlock detector. The current
+ session was chosen a victim. If this is a multi-statement
+ transaction that holds metadata locks for completed statements,
+ restarting locking for the current statement may lead
+ to a livelock. Thus, again, if m_has_locks is set,
+ we report an error. Otherwise, when there are no metadata
+ locks other than which belong to this statement, we can
+ try to recover from error by releasing all locks and
+ restarting the pre-locking.
+ * Finally, we could have met a TABLE_SHARE with old version.
+ Again, if this is a first statement in a transaction we can
+ close all tables, release all metadata locks and wait for
+ the old version to go away. Otherwise, waiting with MDL locks
+ may lead to criss-cross wait between this connection and a
+ connection that has an open table and waits on a metadata lock,
+ i.e. to a deadlock.
+ Since there is no way to detect such a deadlock, we prevent
+ it by reporting an error.
*/
- if (m_has_locks && action_arg != OT_WAIT_MDL_LOCK)
+ if (m_has_locks)
{
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;
return FALSE;
}
@@ -3861,10 +3979,6 @@ request_backoff_action(enum_open_table_action action_arg)
Recover from failed attempt of open table by performing requested action.
@param thd Thread context
- @param mdl_request MDL_request of the object that caused the problem.
- @param table Optional (can be NULL). Used only if action is OT_REPAIR.
- In that case a TABLE_LIST for the table to be repaired.
- @todo: It's unnecessary and should be removed.
@pre This function should be called only with "action" != OT_NO_ACTION
and after having called @sa close_tables_for_reopen().
@@ -3875,8 +3989,7 @@ request_backoff_action(enum_open_table_action action_arg)
bool
Open_table_context::
-recover_from_failed_open(THD *thd, MDL_request *mdl_request,
- TABLE_LIST *table)
+recover_from_failed_open(THD *thd)
{
bool result= FALSE;
/*
@@ -3887,8 +4000,7 @@ recover_from_failed_open(THD *thd, MDL_request *mdl_request,
/* Execute the action. */
switch (m_action)
{
- case OT_WAIT_MDL_LOCK:
- result= thd->mdl_context.wait_for_lock(mdl_request, get_timeout());
+ case OT_MDL_CONFLICT:
break;
case OT_WAIT_TDC:
result= tdc_wait_for_old_versions(thd, &m_mdl_requests, get_timeout());
@@ -3897,7 +4009,7 @@ recover_from_failed_open(THD *thd, MDL_request *mdl_request,
case OT_DISCOVER:
{
MDL_request mdl_global_request;
- MDL_request mdl_xlock_request(mdl_request);
+ MDL_request mdl_xlock_request(&m_failed_table->mdl_request);
MDL_request_list mdl_requests;
mdl_global_request.init(MDL_key::GLOBAL, "", "",
@@ -3911,14 +4023,11 @@ recover_from_failed_open(THD *thd, MDL_request *mdl_request,
thd->mdl_context.acquire_locks(&mdl_requests, get_timeout())))
break;
- DBUG_ASSERT(mdl_request->key.mdl_namespace() == MDL_key::TABLE);
mysql_mutex_lock(&LOCK_open);
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
- mdl_request->key.db_name(),
- mdl_request->key.name());
- ha_create_table_from_engine(thd,
- mdl_request->key.db_name(),
- mdl_request->key.name());
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, m_failed_table->db,
+ m_failed_table->table_name);
+ ha_create_table_from_engine(thd, m_failed_table->db,
+ m_failed_table->table_name);
mysql_mutex_unlock(&LOCK_open);
thd->warning_info->clear_warning_info(thd->query_id);
@@ -3929,7 +4038,7 @@ recover_from_failed_open(THD *thd, MDL_request *mdl_request,
case OT_REPAIR:
{
MDL_request mdl_global_request;
- MDL_request mdl_xlock_request(mdl_request);
+ MDL_request mdl_xlock_request(&m_failed_table->mdl_request);
MDL_request_list mdl_requests;
mdl_global_request.init(MDL_key::GLOBAL, "", "",
@@ -3943,14 +4052,12 @@ recover_from_failed_open(THD *thd, MDL_request *mdl_request,
thd->mdl_context.acquire_locks(&mdl_requests, get_timeout())))
break;
- DBUG_ASSERT(mdl_request->key.mdl_namespace() == MDL_key::TABLE);
mysql_mutex_lock(&LOCK_open);
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
- mdl_request->key.db_name(),
- mdl_request->key.name());
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, m_failed_table->db,
+ m_failed_table->table_name);
mysql_mutex_unlock(&LOCK_open);
- result= auto_repair_table(thd, table);
+ result= auto_repair_table(thd, m_failed_table);
thd->mdl_context.release_transactional_locks();
break;
}
@@ -3959,6 +4066,12 @@ recover_from_failed_open(THD *thd, MDL_request *mdl_request,
}
/* Remove all old requests, they will be re-added. */
m_mdl_requests.empty();
+ /*
+ Reset the pointers to conflicting MDL request and the
+ TABLE_LIST element, set when we need auto-discovery or repair,
+ for safety.
+ */
+ m_failed_table= NULL;
/* Prepare for possible another back-off. */
m_action= OT_NO_ACTION;
return result;
@@ -4081,15 +4194,25 @@ open_and_process_routine(THD *thd, Query_tables_list *prelocking_ctx,
*/
DBUG_ASSERT(rt->mdl_request.type == MDL_SHARED);
- if (thd->mdl_context.try_acquire_lock(&rt->mdl_request))
- DBUG_RETURN(TRUE);
+ /*
+ Waiting for a conflicting metadata lock to go away may
+ lead to a deadlock, detected by MDL subsystem.
+ If possible, we try to resolve such deadlocks by releasing all
+ metadata locks and restarting the pre-locking process.
+ To prevent the error from polluting the diagnostics area
+ in case of successful resolution, install a special error
+ handler for ER_LOCK_DEADLOCK error.
+ */
+ MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
- if (rt->mdl_request.ticket == NULL)
- {
- /* A lock conflict. Someone's trying to modify SP metadata. */
- ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_MDL_LOCK);
+ thd->push_internal_handler(&mdl_deadlock_handler);
+ bool result= thd->mdl_context.acquire_lock(&rt->mdl_request,
+ ot_ctx->get_timeout());
+ thd->pop_internal_handler();
+
+ if (result)
DBUG_RETURN(TRUE);
- }
+
DEBUG_SYNC(thd, "after_shared_lock_pname");
/* Ensures the routine is up-to-date and cached, if exists. */
@@ -4234,12 +4357,14 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
*/
if (tables->view)
{
+ MDL_ticket *mdl_ticket;
/*
We still need to take a MDL lock on the merged view to protect
it from concurrent changes.
*/
- if (!open_table_get_mdl_lock(thd, tables, &tables->mdl_request,
- ot_ctx, flags))
+ if (!open_table_get_mdl_lock(thd, ot_ctx, &tables->mdl_request,
+ flags, &mdl_ticket) &&
+ mdl_ticket != NULL)
goto process_view_routines;
/* Fall-through to return error. */
}
@@ -4268,12 +4393,12 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
*/
Prelock_error_handler prelock_handler;
thd->push_internal_handler(& prelock_handler);
- error= open_table(thd, tables, new_frm_mem, ot_ctx, flags);
+ error= open_table(thd, tables, new_frm_mem, ot_ctx);
thd->pop_internal_handler();
safe_to_ignore_table= prelock_handler.safely_trapped_errors();
}
else
- error= open_table(thd, tables, new_frm_mem, ot_ctx, flags);
+ error= open_table(thd, tables, new_frm_mem, ot_ctx);
free_root(new_frm_mem, MYF(MY_KEEP_PREALLOC));
@@ -4429,6 +4554,8 @@ end:
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.
@retval FALSE Success.
@retval TRUE Failure (e.g. connection was killed)
@@ -4437,31 +4564,30 @@ end:
static bool
open_tables_acquire_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
TABLE_LIST *tables_end,
- Open_table_context *ot_ctx)
+ Open_table_context *ot_ctx,
+ uint flags)
{
MDL_request_list mdl_requests;
TABLE_LIST *table;
DBUG_ASSERT(!thd->locked_tables_mode);
- DEBUG_SYNC(thd, "open_tables_acquire_upgradable_mdl");
for (table= tables_start; table && table != tables_end;
table= table->next_global)
{
- if (table->lock_type >= TL_WRITE_ALLOW_WRITE &&
+ if (table->mdl_request.type >= MDL_SHARED_NO_WRITE &&
!(table->open_type == OT_TEMPORARY_ONLY ||
+ (flags & MYSQL_OPEN_TEMPORARY_ONLY) ||
(table->open_type != OT_BASE_ONLY &&
+ ! (flags & MYSQL_OPEN_SKIP_TEMPORARY) &&
find_temporary_table(thd, table))))
- {
- table->mdl_request.set_type(table->lock_type > TL_WRITE_ALLOW_READ ?
- MDL_SHARED_NO_READ_WRITE :
- MDL_SHARED_NO_WRITE);
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)
@@ -4475,11 +4601,8 @@ open_tables_acquire_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
for (table= tables_start; table && table != tables_end;
table= table->next_global)
{
- if (table->lock_type >= TL_WRITE_ALLOW_WRITE)
- {
+ if (table->mdl_request.type >= MDL_SHARED_NO_WRITE)
table->mdl_request.ticket= NULL;
- table->mdl_request.set_type(MDL_SHARED_WRITE);
- }
}
return FALSE;
@@ -4495,6 +4618,8 @@ open_tables_acquire_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
@param tables_start Start of list of tables on which upgradable locks
should be searched for.
@param tables_end End of list of tables.
+ @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)
@@ -4502,7 +4627,7 @@ open_tables_acquire_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
static bool
open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
- TABLE_LIST *tables_end)
+ TABLE_LIST *tables_end, uint flags)
{
TABLE_LIST *table;
@@ -4511,9 +4636,11 @@ open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
for (table= tables_start; table && table != tables_end;
table= table->next_global)
{
- if (table->lock_type >= TL_WRITE_ALLOW_WRITE &&
+ if (table->mdl_request.type >= MDL_SHARED_NO_WRITE &&
!(table->open_type == OT_TEMPORARY_ONLY ||
+ (flags & MYSQL_OPEN_TEMPORARY_ONLY) ||
(table->open_type != OT_BASE_ONLY &&
+ ! (flags & MYSQL_OPEN_SKIP_TEMPORARY) &&
find_temporary_table(thd, table))))
{
/*
@@ -4525,8 +4652,14 @@ open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
lock, all other instances of TABLE for the same table will have the
same ticket.
- Note that find_table_for_mdl_upgrade() will report an error if a
- ticket is not found.
+ Note that this works OK even for CREATE TABLE statements which
+ request X type of metadata lock. This is because under LOCK TABLES
+ such statements don't create the table but only check if it exists
+ or, in most complex case, only insert into it.
+ Thus SNRW lock should be enough.
+
+ Note that find_table_for_mdl_upgrade() will report an error if
+ no suitable ticket is found.
*/
if (!find_table_for_mdl_upgrade(thd->open_tables, table->db,
table->table_name, FALSE))
@@ -4580,26 +4713,13 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
TABLE_LIST **table_to_open;
Sroutine_hash_entry **sroutine_to_open;
TABLE_LIST *tables;
- Open_table_context ot_ctx(thd, (flags & MYSQL_LOCK_IGNORE_TIMEOUT) ?
- LONG_TIMEOUT : thd->variables.lock_wait_timeout);
+ Open_table_context ot_ctx(thd, flags);
bool error= FALSE;
MEM_ROOT new_frm_mem;
bool has_prelocking_list;
DBUG_ENTER("open_tables");
/*
- Close HANDLER tables which are marked for flush or against which there
- are pending exclusive metadata locks. Note that we do this not to avoid
- deadlocks (calls to mysql_ha_flush() in mdl_wait_for_locks() and
- tdc_wait_for_old_version() are enough for this) but in order to have
- a point during statement execution at which such HANDLERs are closed
- even if they don't create problems for current thread (i.e. to avoid
- having DDL blocked by HANDLERs opened for long time).
- */
- if (thd->handler_tables_hash.records)
- mysql_ha_flush(thd);
-
- /*
temporary mem_root for new .frm parsing.
TODO: variables for size
*/
@@ -4607,6 +4727,17 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
thd->current_tablenr= 0;
restart:
+ /*
+ Close HANDLER tables which are marked for flush or against which there
+ are pending exclusive metadata locks. This is needed both in order to
+ avoid deadlocks and to have a point during statement execution at
+ which such HANDLERs are closed even if they don't create problems for
+ the current session (i.e. to avoid having a DDL blocked by HANDLERs
+ opened for a long time).
+ */
+ if (thd->handler_tables_hash.records)
+ mysql_ha_flush(thd);
+
has_prelocking_list= thd->lex->requires_prelocking();
table_to_open= start;
sroutine_to_open= (Sroutine_hash_entry**) &thd->lex->sroutines_list.first;
@@ -4618,21 +4749,19 @@ restart:
(in non-LOCK TABLES mode) we might have to acquire upgradable
semi-exclusive metadata locks (SNW or SNRW) on some of the
tables to be opened.
- So we acquire all such locks at once here as doing this in one
+ When executing CREATE TABLE .. If NOT EXISTS .. SELECT, the
+ table may not yet exist, in which case we acquire an exclusive
+ lock.
+ We acquire all such locks at once here as doing this in one
by one fashion may lead to deadlocks or starvation. Later when
we will be opening corresponding table pre-acquired metadata
lock will be reused (thanks to the fact that in recursive case
metadata locks are acquired without waiting).
*/
- if (flags & MYSQL_OPEN_TAKE_UPGRADABLE_MDL)
+ if (! (flags & (MYSQL_OPEN_HAS_MDL_LOCK |
+ MYSQL_OPEN_FORCE_SHARED_MDL |
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL)))
{
- /*
- open_tables_acquire_upgradable_mdl() does not currenly handle
- these two flags. At this point, that does not matter as they
- are not used together with MYSQL_OPEN_TAKE_UPGRADABLE_MDL.
- */
- DBUG_ASSERT(!(flags & (MYSQL_OPEN_SKIP_TEMPORARY |
- MYSQL_OPEN_TEMPORARY_ONLY)));
if (thd->locked_tables_mode)
{
/*
@@ -4640,7 +4769,8 @@ restart:
need to check if appropriate locks were pre-acquired.
*/
if (open_tables_check_upgradable_mdl(thd, *start,
- thd->lex->first_not_own_table()))
+ thd->lex->first_not_own_table(),
+ flags))
{
error= TRUE;
goto err;
@@ -4648,7 +4778,7 @@ restart:
}
else if (open_tables_acquire_upgradable_mdl(thd, *start,
thd->lex->first_not_own_table(),
- &ot_ctx))
+ &ot_ctx, flags))
{
error= TRUE;
goto err;
@@ -4694,7 +4824,6 @@ restart:
have failed to open since closing tables can trigger removal of
elements from the table list (if MERGE tables are involved),
*/
- TABLE_LIST *failed_table= *table_to_open;
close_tables_for_reopen(thd, start, ot_ctx.start_of_statement_svp());
/*
@@ -4702,8 +4831,7 @@ restart:
TABLE_LIST element. Altough currently this assumption is valid
it may change in future.
*/
- if (ot_ctx.recover_from_failed_open(thd, &failed_table->mdl_request,
- failed_table))
+ if (ot_ctx.recover_from_failed_open(thd))
goto err;
error= FALSE;
@@ -4747,7 +4875,7 @@ restart:
{
close_tables_for_reopen(thd, start,
ot_ctx.start_of_statement_svp());
- if (ot_ctx.recover_from_failed_open(thd, &rt->mdl_request, NULL))
+ if (ot_ctx.recover_from_failed_open(thd))
goto err;
error= FALSE;
@@ -5054,8 +5182,8 @@ static bool check_lock_and_start_stmt(THD *thd,
else
lock_type= table_list->lock_type;
- if ((int) lock_type >= (int) TL_WRITE_ALLOW_READ &&
- (int) table_list->table->reginfo.lock_type < (int) TL_WRITE_ALLOW_READ)
+ if ((int) lock_type > (int) TL_WRITE_ALLOW_WRITE &&
+ (int) table_list->table->reginfo.lock_type <= (int) TL_WRITE_ALLOW_WRITE)
{
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table_list->alias);
DBUG_RETURN(1);
@@ -5156,8 +5284,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
uint lock_flags)
{
TABLE *table;
- Open_table_context ot_ctx(thd, (lock_flags & MYSQL_LOCK_IGNORE_TIMEOUT) ?
- LONG_TIMEOUT : thd->variables.lock_wait_timeout);
+ Open_table_context ot_ctx(thd, lock_flags);
bool error;
DBUG_ENTER("open_ltable");
@@ -5169,7 +5296,10 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
/* open_ltable can be used only for BASIC TABLEs */
table_list->required_type= FRMTYPE_TABLE;
- while ((error= open_table(thd, table_list, thd->mem_root, &ot_ctx, lock_flags)) &&
+ /* This function can't properly handle requests for such metadata locks. */
+ DBUG_ASSERT(table_list->mdl_request.type < MDL_SHARED_NO_WRITE);
+
+ while ((error= open_table(thd, table_list, thd->mem_root, &ot_ctx)) &&
ot_ctx.can_recover_from_failed_open())
{
/*
@@ -5179,8 +5309,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
*/
thd->mdl_context.rollback_to_savepoint(ot_ctx.start_of_statement_svp());
table_list->mdl_request.ticket= 0;
- if (ot_ctx.recover_from_failed_open(thd, &table_list->mdl_request,
- table_list))
+ if (ot_ctx.recover_from_failed_open(thd))
break;
}
@@ -5554,15 +5683,6 @@ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
/* We have to cleanup translation tables of views. */
tmp->cleanup_items();
}
- /*
- Metadata lock requests for tables from extended part of prelocking set
- are part of list of requests to be waited for in Open_table_context.
- So to satisfy assumptions in MDL_context::wait_for_locks(), which will
- performs the waiting, we have to reset MDL_request::ticket values for
- them as well.
- */
- for (tmp= first_not_own_table; tmp; tmp= tmp->next_global)
- tmp->mdl_request.ticket= NULL;
close_thread_tables(thd);
thd->mdl_context.rollback_to_savepoint(start_of_statement_svp);
}
@@ -5631,7 +5751,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
{
/* No need to lock share->mutex as this is not needed for tmp tables */
free_table_share(share);
- my_free((char*) tmp_table,MYF(0));
+ my_free(tmp_table);
DBUG_RETURN(0);
}
@@ -8425,15 +8545,15 @@ my_bool mysql_rm_tmp_tables(void)
(file->name[1] == '.' && !file->name[2])))
continue;
- if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix,
- tmp_file_prefix_length))
+ if (!memcmp(file->name, tmp_file_prefix,
+ tmp_file_prefix_length))
{
char *ext= fn_ext(file->name);
uint ext_len= strlen(ext);
uint filePath_len= my_snprintf(filePath, sizeof(filePath),
"%s%c%s", tmpdir, FN_LIBCHAR,
file->name);
- if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len))
+ if (!memcmp(reg_ext, ext, ext_len))
{
handler *handler_file= 0;
/* We should cut file extention before deleting of table */
@@ -8478,7 +8598,7 @@ my_bool mysql_rm_tmp_tables(void)
all not used tables.
*/
-void flush_tables()
+void tdc_flush_unused_tables()
{
mysql_mutex_lock(&LOCK_open);
while (unused_tables)
@@ -8529,10 +8649,10 @@ bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
mysql_mutex_unlock(&in_use->mysys_var->mutex);
signalled= TRUE;
}
- mysql_mutex_lock(&LOCK_open);
if (needs_thr_lock_abort)
{
+ mysql_mutex_lock(&in_use->LOCK_thd_data);
for (TABLE *thd_table= in_use->open_tables;
thd_table ;
thd_table= thd_table->next)
@@ -8543,10 +8663,11 @@ bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
and do not remove such instances from the THD::open_tables
for some time, during which other thread can see those instances
(e.g. see partitioning code).
- */
+ */
if (!thd_table->needs_reopen())
signalled|= mysql_lock_abort_for_thread(thd, thd_table);
}
+ mysql_mutex_unlock(&in_use->LOCK_thd_data);
}
/*
Wake up threads waiting in tdc_wait_for_old_versions().
@@ -8559,7 +8680,6 @@ bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
a multi-statement transaction.
*/
broadcast_refresh();
- mysql_mutex_unlock(&LOCK_open);
return signalled;
}
@@ -8668,8 +8788,12 @@ tdc_wait_for_old_versions(THD *thd, MDL_request_list *mdl_requests,
while (!thd->killed)
{
/*
- Here we have situation as in mdl_wait_for_locks() we need to
- get rid of offending HANDLERs to avoid deadlock.
+ We have to get rid of HANDLERs which are open by this thread
+ and have old TABLE versions. Otherwise we might get a deadlock
+ in situation when we are waiting for an old TABLE object which
+ corresponds to a HANDLER open by another session. And this
+ other session waits for our HANDLER object to get closed.
+
TODO: We should also investigate in which situations we have
to broadcast on COND_refresh because of this.
*/
@@ -8686,7 +8810,7 @@ tdc_wait_for_old_versions(THD *thd, MDL_request_list *mdl_requests,
if ((share= get_cached_table_share(mdl_request->key.db_name(),
mdl_request->key.name())) &&
- share->version != refresh_version)
+ share->needs_reopen())
break;
}
if (!mdl_request)
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 0fe70e4bc9d..20a068e27d7 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -89,7 +89,7 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
uint lock_flags);
bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
- Open_table_context *ot_ctx, uint flags);
+ Open_table_context *ot_ctx);
bool name_lock_locked_table(THD *thd, TABLE_LIST *tables);
bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in);
TABLE *table_cache_insert_placeholder(THD *thd, const char *key,
@@ -233,7 +233,6 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
const char *table_name);
void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table);
void remove_db_from_cache(const char *db);
-void flush_tables();
bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
/* Functions to work with system tables. */
@@ -263,10 +262,12 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
bool tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
char *cache_key, uint cache_key_length,
MEM_ROOT *mem_root, uint flags);
+void tdc_flush_unused_tables();
TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db,
const char *table_name,
bool no_error);
void mark_tmp_table_for_reuse(TABLE *table);
+bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists);
extern uint table_cache_count;
extern TABLE *unused_tables;
@@ -322,6 +323,7 @@ inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table,
db_name, table_name);
}
+
inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array,
List<Item> &item,
enum_mark_columns mark_used_columns,
@@ -336,6 +338,89 @@ inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array,
return res;
}
+/**
+ An abstract class for a strategy specifying how the prelocking
+ algorithm should extend the prelocking set while processing
+ already existing elements in the set.
+*/
+
+class Prelocking_strategy
+{
+public:
+ virtual ~Prelocking_strategy() { }
+
+ virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
+ Sroutine_hash_entry *rt, sp_head *sp,
+ bool *need_prelocking) = 0;
+ virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
+ TABLE_LIST *table_list, bool *need_prelocking) = 0;
+ virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
+ TABLE_LIST *table_list, bool *need_prelocking)= 0;
+};
+
+
+/**
+ A Strategy for prelocking algorithm suitable for DML statements.
+
+ Ensures that all tables used by all statement's SF/SP/triggers and
+ required for foreign key checks are prelocked and SF/SPs used are
+ cached.
+*/
+
+class DML_prelocking_strategy : public Prelocking_strategy
+{
+public:
+ virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
+ Sroutine_hash_entry *rt, sp_head *sp,
+ bool *need_prelocking);
+ virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
+ TABLE_LIST *table_list, bool *need_prelocking);
+ virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
+ TABLE_LIST *table_list, bool *need_prelocking);
+};
+
+
+/**
+ A strategy for prelocking algorithm to be used for LOCK TABLES
+ statement.
+*/
+
+class Lock_tables_prelocking_strategy : public DML_prelocking_strategy
+{
+ virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
+ TABLE_LIST *table_list, bool *need_prelocking);
+};
+
+
+/**
+ Strategy for prelocking algorithm to be used for ALTER TABLE statements.
+
+ Unlike DML or LOCK TABLES strategy, it doesn't
+ prelock triggers, views or stored routines, since they are not
+ used during ALTER.
+*/
+
+class Alter_table_prelocking_strategy : public Prelocking_strategy
+{
+public:
+
+ Alter_table_prelocking_strategy(Alter_info *alter_info)
+ : m_alter_info(alter_info)
+ {}
+
+ virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
+ Sroutine_hash_entry *rt, sp_head *sp,
+ bool *need_prelocking);
+ virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
+ TABLE_LIST *table_list, bool *need_prelocking);
+ virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
+ TABLE_LIST *table_list, bool *need_prelocking);
+
+private:
+ Alter_info *m_alter_info;
+};
+
+
inline bool
open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags)
{
@@ -355,4 +440,85 @@ inline bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
&prelocking_strategy);
}
+
+/**
+ A context of open_tables() function, used to recover
+ from a failed open_table() or open_routine() attempt.
+*/
+
+class Open_table_context
+{
+public:
+ enum enum_open_table_action
+ {
+ OT_NO_ACTION= 0,
+ OT_MDL_CONFLICT,
+ OT_WAIT_TDC,
+ OT_DISCOVER,
+ OT_REPAIR
+ };
+ Open_table_context(THD *thd, uint flags);
+
+ bool recover_from_failed_open(THD *thd);
+ bool request_backoff_action(enum_open_table_action action_arg,
+ TABLE_LIST *table);
+
+ void add_request(MDL_request *request)
+ { m_mdl_requests.push_front(request); }
+
+ bool can_recover_from_failed_open() const
+ { return m_action != OT_NO_ACTION; }
+
+ /**
+ When doing a back-off, we close all tables acquired by this
+ statement. Return an MDL savepoint taken at the beginning of
+ the statement, so that we can rollback to it before waiting on
+ locks.
+ */
+ MDL_ticket *start_of_statement_svp() const
+ {
+ return m_start_of_statement_svp;
+ }
+
+ MDL_request *get_global_mdl_request(THD *thd);
+
+ inline ulong get_timeout() const
+ {
+ return m_timeout;
+ }
+
+ uint get_flags() const { return m_flags; }
+private:
+ /** List of requests for all locks taken so far. Used for waiting on locks. */
+ MDL_request_list m_mdl_requests;
+ /**
+ For OT_DISCOVER and OT_REPAIR actions, the table list element for
+ the table which definition should be re-discovered or which
+ should be repaired.
+ */
+ 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.
+ */
+ ulong m_timeout;
+ /* open_table() flags. */
+ uint m_flags;
+ /** Back off action. */
+ enum enum_open_table_action m_action;
+ /**
+ Whether we had any locks when this context was created.
+ If we did, they are from the previous statement of a transaction,
+ and we can't safely do back-off (and release them).
+ */
+ bool m_has_locks;
+};
+
+
#endif /* SQL_BASE_INCLUDED */
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index 0730f7df00c..6f59c3f51e1 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -52,9 +52,13 @@ void mysql_client_binlog_statement(THD* thd)
if (check_global_access(thd, SUPER_ACL))
DBUG_VOID_RETURN;
- size_t coded_len= thd->lex->comment.length + 1;
+ size_t coded_len= thd->lex->comment.length;
+ if (!coded_len)
+ {
+ my_error(ER_SYNTAX_ERROR, MYF(0));
+ DBUG_VOID_RETURN;
+ }
size_t decoded_len= base64_needed_decoded_length(coded_len);
- DBUG_ASSERT(coded_len > 0);
/*
Allocation
@@ -155,14 +159,16 @@ void mysql_client_binlog_statement(THD* thd)
/*
Checking that the first event in the buffer is not truncated.
*/
- ulong event_len= uint4korr(bufptr + EVENT_LEN_OFFSET);
- DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d",
- event_len, bytes_decoded));
- if (bytes_decoded < EVENT_LEN_OFFSET || (uint) bytes_decoded < event_len)
+ ulong event_len;
+ if (bytes_decoded < EVENT_LEN_OFFSET + 4 ||
+ (event_len= uint4korr(bufptr + EVENT_LEN_OFFSET)) >
+ (uint) bytes_decoded)
{
my_error(ER_SYNTAX_ERROR, MYF(0));
goto end;
}
+ DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d",
+ event_len, bytes_decoded));
/*
If we have not seen any Format_description_event, then we must
@@ -200,17 +206,6 @@ void mysql_client_binlog_statement(THD* thd)
bufptr += event_len;
DBUG_PRINT("info",("ev->get_type_code()=%d", ev->get_type_code()));
-#ifndef HAVE_purify
- /*
- This debug printout should not be used for valgrind builds
- since it will read from unassigned memory.
- */
- DBUG_PRINT("info",("bufptr+EVENT_TYPE_OFFSET: 0x%lx",
- (long) (bufptr+EVENT_TYPE_OFFSET)));
- DBUG_PRINT("info", ("bytes_decoded: %d bufptr: 0x%lx buf[EVENT_LEN_OFFSET]: %lu",
- bytes_decoded, (long) bufptr,
- (ulong) uint4korr(bufptr+EVENT_LEN_OFFSET)));
-#endif
ev->thd= thd;
/*
We go directly to the application phase, since we don't need
@@ -252,6 +247,6 @@ void mysql_client_binlog_statement(THD* thd)
end:
rli->slave_close_thread_tables(thd);
- my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buf);
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index 80a4712dd69..54a207c8adf 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -22,6 +22,7 @@
#ifndef SQL_BITMAP_INCLUDED
#define SQL_BITMAP_INCLUDED
+#include <my_sys.h>
#include <my_bitmap.h>
template <uint default_width> class Bitmap
@@ -101,16 +102,7 @@ template <> class Bitmap<64>
ulonglong map;
public:
Bitmap<64>() { }
-#if defined(__NETWARE__) || defined(__MWERKS__)
- /*
- Metwork compiler gives error on Bitmap<64>
- Changed to Bitmap, since in this case also it will proper construct
- this class
- */
- explicit Bitmap(uint prefix_to_set) { set_prefix(prefix_to_set); }
-#else
explicit Bitmap<64>(uint prefix_to_set) { set_prefix(prefix_to_set); }
-#endif
void init() { }
void init(uint prefix_to_set) { set_prefix(prefix_to_set); }
uint length() const { return 64; }
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 92d54c8e71b..b73de320ef5 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -2223,7 +2223,7 @@ void Query_cache::free_cache()
{
DBUG_ENTER("Query_cache::free_cache");
- my_free((uchar*) cache, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(cache);
make_disabled();
my_hash_free(&queries);
my_hash_free(&tables);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 8c147421363..eb4d353db81 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -100,8 +100,8 @@ extern "C" void free_user_var(user_var_entry *entry)
{
char *pos= (char*) entry+ALIGN_SIZE(sizeof(*entry));
if (entry->value && entry->value != pos)
- my_free(entry->value, MYF(0));
- my_free((char*) entry,MYF(0));
+ my_free(entry->value);
+ my_free(entry);
}
bool Key_part_spec::operator==(const Key_part_spec& other) const
@@ -353,7 +353,7 @@ int thd_sql_command(const THD *thd)
extern "C"
int thd_tx_isolation(const THD *thd)
{
- return (int) thd->variables.tx_isolation;
+ return (int) thd->tx_isolation;
}
extern "C"
@@ -493,7 +493,9 @@ THD::THD()
rli_fake(0),
lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0),
- binlog_unsafe_warning_flags(0), binlog_table_maps(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),
first_successful_insert_id_in_prev_stmt(0),
@@ -537,7 +539,7 @@ THD::THD()
count_cuted_fields= CHECK_FIELD_IGNORE;
killed= NOT_KILLED;
col_access=0;
- is_slave_error= thread_specific_used= thread_temporary_used= FALSE;
+ is_slave_error= thread_specific_used= FALSE;
my_hash_clear(&handler_tables_hash);
tmp_table=0;
used_tables=0;
@@ -592,7 +594,7 @@ THD::THD()
*scramble= '\0';
/* Call to init() below requires fully initialized Open_tables_state. */
- init_open_tables_state(this, refresh_version);
+ reset_open_tables_state(this);
init();
#if defined(ENABLED_PROFILING)
@@ -626,6 +628,9 @@ THD::THD()
thr_lock_owner_init(&main_lock_id, &lock_info);
m_internal_handler= NULL;
+ current_user_used= FALSE;
+ memset(&invoker_user, 0, sizeof(invoker_user));
+ memset(&invoker_host, 0, sizeof(invoker_host));
}
@@ -960,7 +965,7 @@ void THD::init(void)
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
TL_WRITE);
- session_tx_isolation= (enum_tx_isolation) variables.tx_isolation;
+ tx_isolation= (enum_tx_isolation) variables.tx_isolation;
update_charset();
reset_current_stmt_binlog_format_row();
bzero((char *) &status_var, sizeof(status_var));
@@ -1120,7 +1125,8 @@ THD::~THD()
DBUG_PRINT("info", ("freeing security context"));
main_security_ctx.destroy();
- safeFree(db);
+ my_free(db);
+ db= NULL;
free_root(&transaction.mem_root,MYF(0));
mysys_var=0; // Safety (shouldn't be needed)
mysql_mutex_destroy(&LOCK_thd_data);
@@ -1165,6 +1171,9 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
while (to != end)
*(to++)+= *(from++);
+
+ to_var->bytes_received+= from_var->bytes_received;
+ to_var->bytes_sent+= from_var->bytes_sent;
}
/*
@@ -1190,6 +1199,9 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
while (to != end)
*(to++)+= *(from++) - *(dec++);
+
+ to_var->bytes_received+= from_var->bytes_received - dec_var->bytes_received;;
+ to_var->bytes_sent+= from_var->bytes_sent - dec_var->bytes_sent;
}
@@ -1341,6 +1353,7 @@ void THD::cleanup_after_query()
where= THD::DEFAULT_WHERE;
/* reset table map for multi-table update */
table_map_for_update= 0;
+ clean_current_user_used();
}
@@ -2952,10 +2965,18 @@ void Security_context::destroy()
{
// If not pointer to constant
if (host != my_localhost)
- safeFree(host);
+ {
+ my_free(host);
+ host= NULL;
+ }
if (user != delayed_user)
- safeFree(user);
- safeFree(ip);
+ {
+ my_free(user);
+ user= NULL;
+ }
+
+ my_free(ip);
+ ip= NULL;
}
@@ -2971,7 +2992,7 @@ void Security_context::skip_grants()
bool Security_context::set_user(char *user_arg)
{
- safeFree(user);
+ my_free(user);
user= my_strdup(user_arg, MYF(0));
return user == 0;
}
@@ -3401,6 +3422,22 @@ void THD::leave_locked_tables_mode()
mysql_ha_move_tickets_after_trans_sentinel(this);
}
+void THD::get_definer(LEX_USER *definer)
+{
+ set_current_user_used();
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+ if (slave_thread && has_invoker())
+ {
+ definer->user = invoker_user;
+ definer->host= invoker_host;
+ definer->password.str= NULL;
+ definer->password.length= 0;
+ }
+ else
+#endif
+ get_default_definer(this, definer);
+}
+
/**
Mark transaction to rollback and mark error as fatal to a sub-statement.
@@ -3447,7 +3484,7 @@ uchar *xid_get_hash_key(const uchar *ptr, size_t *length,
void xid_free_hash(void *ptr)
{
if (!((XID_STATE*)ptr)->in_thd)
- my_free((uchar*)ptr, MYF(0));
+ my_free(ptr);
}
#ifdef HAVE_PSI_INTERFACE
@@ -3663,7 +3700,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
capabilities.
*/
handler::Table_flags flags_write_some_set= 0;
- handler::Table_flags flags_some_set= 0;
+ handler::Table_flags flags_access_some_set= 0;
handler::Table_flags flags_write_all_set=
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE;
@@ -3678,17 +3715,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
Innodb and Falcon; Innodb and MyIsam.
*/
my_bool multi_access_engine= FALSE;
- /*
- If non-transactional and transactional engines are about
- to be accessed and any of them is about to be updated.
- For example: Innodb and MyIsam.
- */
- my_bool trans_non_trans_access_engines= FALSE;
- /*
- If all engines that are about to be updated are
- transactional.
- */
- my_bool all_trans_write_engines= TRUE;
+
TABLE* prev_write_table= NULL;
TABLE* prev_access_table= NULL;
@@ -3712,9 +3739,12 @@ int THD::decide_logging_format(TABLE_LIST *tables)
{
if (table->placeholder())
continue;
+
if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE)
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_TABLE);
+
handler::Table_flags const flags= table->table->file->ha_table_flags();
+
DBUG_PRINT("info", ("table: %s; ha_table_flags: 0x%llx",
table->table_name, flags));
if (table->lock_type >= TL_WRITE_ALLOW_WRITE)
@@ -3722,177 +3752,171 @@ int THD::decide_logging_format(TABLE_LIST *tables)
if (prev_write_table && prev_write_table->file->ht !=
table->table->file->ht)
multi_write_engine= TRUE;
- /*
- Every temporary table must be always written to the binary
- log in transaction boundaries and as such we artificially
- classify them as transactional.
- Indirectly, this avoids classifying a temporary table created
- on a non-transactional engine as unsafe when it is modified
- after any transactional table:
+ my_bool trans= table->table->file->has_transactions();
- BEGIN;
- INSERT INTO innodb_t VALUES (1);
- INSERT INTO myisam_t_temp VALUES (1);
- COMMIT;
-
- BINARY LOG:
+ if (table->table->s->tmp_table)
+ set_stmt_accessed_table(trans ? STMT_WRITES_TEMP_TRANS_TABLE :
+ STMT_WRITES_TEMP_NON_TRANS_TABLE);
+ else
+ set_stmt_accessed_table(trans ? STMT_WRITES_TRANS_TABLE :
+ STMT_WRITES_NON_TRANS_TABLE);
- BEGIN;
- INSERT INTO innodb_t VALUES (1);
- INSERT INTO myisam_t_temp VALUES (1);
- COMMIT;
- */
- all_trans_write_engines= all_trans_write_engines &&
- (table->table->file->has_transactions() ||
- table->table->s->tmp_table);
- prev_write_table= table->table;
flags_write_all_set &= flags;
flags_write_some_set |= flags;
- }
- flags_some_set |= flags;
- /*
- The mixture of non-transactional and transactional tables must
- identified and classified as unsafe. However, a temporary table
- must be always handled as a transactional table. Based on that,
- we have the following statements classified as mixed and by
- consequence as unsafe:
-
- 1: INSERT INTO myisam_t SELECT * FROM innodb_t;
-
- 2: INSERT INTO innodb_t SELECT * FROM myisam_t;
-
- 3: INSERT INTO myisam_t SELECT * FROM myisam_t_temp;
- 4: INSERT INTO myisam_t_temp SELECT * FROM myisam_t;
-
- 5: CREATE TEMPORARY TABLE myisam_t_temp SELECT * FROM mysiam_t;
-
- The following statements are not considered mixed and as such
- are safe:
-
- 1: INSERT INTO innodb_t SELECT * FROM myisam_t_temp;
+ prev_write_table= table->table;
+ }
+ flags_access_some_set |= flags;
- 2: INSERT INTO myisam_t_temp SELECT * FROM innodb_t_temp;
- */
- if (!trans_non_trans_access_engines && prev_access_table &&
- (lex->sql_command != SQLCOM_CREATE_TABLE ||
+ if (lex->sql_command != SQLCOM_CREATE_TABLE ||
(lex->sql_command == SQLCOM_CREATE_TABLE &&
- (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))))
+ (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)))
{
- my_bool prev_trans;
- my_bool act_trans;
- if (prev_access_table->s->tmp_table || table->table->s->tmp_table)
- {
- prev_trans= prev_access_table->s->tmp_table ? TRUE :
- prev_access_table->file->has_transactions();
- act_trans= table->table->s->tmp_table ? TRUE :
- table->table->file->has_transactions();
- }
+ 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);
else
- {
- prev_trans= prev_access_table->file->has_transactions();
- act_trans= table->table->file->has_transactions();
- }
- trans_non_trans_access_engines= (prev_trans != act_trans);
- multi_access_engine= TRUE;
+ set_stmt_accessed_table(trans ? STMT_READS_TRANS_TABLE :
+ STMT_READS_NON_TRANS_TABLE);
}
- thread_temporary_used |= table->table->s->tmp_table;
+
+ if (prev_access_table && prev_access_table->file->ht !=
+ table->table->file->ht)
+ multi_access_engine= TRUE;
+
prev_access_table= table->table;
}
DBUG_PRINT("info", ("flags_write_all_set: 0x%llx", flags_write_all_set));
DBUG_PRINT("info", ("flags_write_some_set: 0x%llx", flags_write_some_set));
- DBUG_PRINT("info", ("flags_some_set: 0x%llx", flags_some_set));
+ DBUG_PRINT("info", ("flags_access_some_set: 0x%llx", flags_access_some_set));
DBUG_PRINT("info", ("multi_write_engine: %d", multi_write_engine));
DBUG_PRINT("info", ("multi_access_engine: %d", multi_access_engine));
- DBUG_PRINT("info", ("trans_non_trans_access_engines: %d",
- trans_non_trans_access_engines));
int error= 0;
int unsafe_flags;
/*
- Set the statement as unsafe if:
-
- . it is a mixed statement, i.e. access transactional and non-transactional
- tables, and update any of them;
-
- or:
-
- . an early statement updated a transactional table;
- . and, the current statement updates a non-transactional table.
-
- Any mixed statement is classified as unsafe to ensure that mixed mode is
- completely safe. Consider the following example to understand why we
- decided to do this:
-
- Note that mixed statements such as
-
- 1: INSERT INTO myisam_t SELECT * FROM innodb_t;
-
- 2: INSERT INTO innodb_t SELECT * FROM myisam_t;
-
- 3: INSERT INTO myisam_t SELECT * FROM myisam_t_temp;
+ Classify a statement as unsafe when there is a mixed statement and an
+ on-going transaction at any point of the execution if:
- 4: INSERT INTO myisam_t_temp SELECT * FROM myisam_t;
+ 1. The mixed statement is about to update a transactional table and
+ a non-transactional table.
- 5: CREATE TEMPORARY TABLE myisam_t_temp SELECT * FROM mysiam_t;
+ 2. The mixed statement is about to update a temporary transactional
+ table and a non-transactional table.
+
+ 3. The mixed statement is about to update a transactional table and
+ read from a non-transactional table.
- are classified as unsafe to ensure that in mixed mode the execution is
- completely safe and equivalent to the row mode. Consider the following
- statements and sessions (connections) to understand the reason:
+ 4. The mixed statement is about to update a temporary transactional
+ table and read from a non-transactional table.
- con1: INSERT INTO innodb_t VALUES (1);
- con1: INSERT INTO innodb_t VALUES (100);
+ 5. The mixed statement is about to update a non-transactional table
+ and read from a transactional table when the isolation level is
+ lower than repeatable read.
- con1: BEGIN
- con2: INSERT INTO myisam_t SELECT * FROM innodb_t;
- con1: INSERT INTO innodb_t VALUES (200);
- con1: COMMIT;
+ After updating a transactional table if:
- The point is that the concurrent statements may be written into the binary log
- in a way different from the execution. For example,
-
- BINARY LOG:
-
- con2: BEGIN;
- con2: INSERT INTO myisam_t SELECT * FROM innodb_t;
- con2: COMMIT;
- con1: BEGIN
- con1: INSERT INTO innodb_t VALUES (200);
- con1: COMMIT;
-
- ....
-
- or
-
- BINARY LOG:
-
- con1: BEGIN
- con1: INSERT INTO innodb_t VALUES (200);
- con1: COMMIT;
- con2: BEGIN;
- con2: INSERT INTO myisam_t SELECT * FROM innodb_t;
- con2: COMMIT;
-
- Clearly, this may become a problem in STMT mode and setting the statement
- as unsafe will make rows to be written into the binary log in MIXED mode
- and as such the problem will not stand.
-
- In STMT mode, although such statement is classified as unsafe, i.e.
+ 6. The mixed statement is about to update a non-transactional table
+ and read from a temporary transactional table.
+
+ 7. The mixed statement is about to update a non-transactional table
+ and read from a temporary transactional table.
+
+ 8. The mixed statement is about to update a non-transactionala table
+ and read from a temporary non-transactional table.
+
+ 9. The mixed statement is about to update a temporary non-transactional
+ table and update a non-transactional table.
+
+ 10. The mixed statement is about to update a temporary non-transactional
+ table and read from a non-transactional table.
+
+ 11. A statement is about to update a non-transactional table and the
+ option variables.binlog_direct_non_trans_update is OFF.
+
+ The reason for this is that locks acquired may not protected a concurrent
+ transaction of interfering in the current execution and by consequence in
+ the result. In particular, if there is an on-going transaction and a
+ transactional table was already updated, a temporary table must be written
+ to the binary log in the boundaries of the on-going transaction and as
+ such we artificially classify them as transactional.
+ */
+ if (in_multi_stmt_transaction_mode())
+ {
+ my_bool mixed_unsafe= FALSE;
+ my_bool non_trans_unsafe= FALSE;
+
+ /* Case 1. */
+ if (stmt_accessed_table(STMT_WRITES_TRANS_TABLE) &&
+ stmt_accessed_table(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))
+ mixed_unsafe= TRUE;
+ /* Case 3. */
+ else if (stmt_accessed_table(STMT_WRITES_TRANS_TABLE) &&
+ stmt_accessed_table(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))
+ mixed_unsafe= TRUE;
+ /* Case 5. */
+ else if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
+ stmt_accessed_table(STMT_READS_TRANS_TABLE) &&
+ tx_isolation < ISO_REPEATABLE_READ)
+ /*
+ By default, InnoDB operates in REPEATABLE READ and with the option
+ --innodb-locks-unsafe-for-binlog disabled. In this case, InnoDB uses
+ next-key locks for searches and index scans, which prevents phantom
+ rows.
+
+ This is scenario is safe for Innodb. However, there are no means to
+ transparently get this information. Therefore, we need to improve this
+ and change the storage engines to report somehow when an execution is
+ safe under an isolation level & binary logging format.
+ */
+ mixed_unsafe= TRUE;
- INSERT INTO myisam_t SELECT * FROM innodb_t;
+ 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))
+ mixed_unsafe= TRUE;
+ /* Case 7. */
+ else if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
+ stmt_accessed_table(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))
+ mixed_unsafe= TRUE;
+ /* Case 9. */
+ else if (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
+ stmt_accessed_table(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))
+ mixed_unsafe= TRUE;
+ /* Case 11. */
+ else if (!variables.binlog_direct_non_trans_update &&
+ stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+ non_trans_unsafe= TRUE;
+ }
- there is no enough information to avoid writing it outside the boundaries
- of a transaction. This is not a problem if we are considering snapshot
- isolation level but if we have pure repeatable read or serializable the
- lock history on the slave will be different from the master.
- */
- if (trans_non_trans_access_engines)
- lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MIXED_STATEMENT);
- else if (trans_has_updated_trans_table(this) && !all_trans_write_engines)
- lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS);
+ if (mixed_unsafe)
+ lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MIXED_STATEMENT);
+ else if (non_trans_unsafe)
+ lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS);
+ }
/*
If more than one engine is involved in the statement and at
@@ -3904,7 +3928,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
(flags_write_some_set & HA_HAS_OWN_BINLOGGING))
my_error((error= ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE),
MYF(0));
- else if (multi_access_engine && flags_some_set & HA_HAS_OWN_BINLOGGING)
+ else if (multi_access_engine && flags_access_some_set & HA_HAS_OWN_BINLOGGING)
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE);
/* both statement-only and row-only engines involved */
@@ -4267,7 +4291,7 @@ CPP_UNNAMED_NS_START
~Row_data_memory()
{
if (m_memory != 0 && m_release_memory_on_destruction)
- my_free((uchar*) m_memory, MYF(MY_WME));
+ my_free(m_memory);
}
/**
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 25b136bc4ca..c095fee6232 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -472,15 +472,18 @@ typedef struct system_variables
my_bool sysdate_is_now;
double long_query_time_double;
+
} SV;
-/* per thread status variables */
+/**
+ Per thread status variables.
+ Must be long/ulong up to last_system_status_var so that
+ add_to_status/add_diff_to_status can work.
+*/
typedef struct system_status_var
{
- ulonglong bytes_received;
- ulonglong bytes_sent;
ulong com_other;
ulong com_stat[(uint) SQLCOM_END];
ulong created_tmp_disk_tables;
@@ -536,13 +539,14 @@ typedef struct system_status_var
Number of statements sent from the client
*/
ulong questions;
+
+ ulonglong bytes_received;
+ ulonglong bytes_sent;
/*
IMPORTANT!
SEE last_system_status_var DEFINITION BELOW.
- Below 'last_system_status_var' are all variables which doesn't make any
- sense to add to the /global/ status variable counter.
- Status variables which it does not make sense to add to
- global status variable counter
+ Below 'last_system_status_var' are all variables that cannot be handled
+ automatically by add_to_status()/add_diff_to_status().
*/
double last_query_cost;
} STATUS_VAR;
@@ -1006,7 +1010,6 @@ public:
of the main statement is called.
*/
enum enum_locked_tables_mode locked_tables_mode;
- ulong version;
uint current_tablenr;
enum enum_flags {
@@ -1025,15 +1028,6 @@ public:
*/
Open_tables_state() : state_flags(0U) { }
- /**
- Prepare Open_tables_state instance for operations dealing with tables.
- */
- void init_open_tables_state(THD *thd, ulong version_arg)
- {
- reset_open_tables_state(thd);
- version= version_arg;
- }
-
void set_open_tables_state(Open_tables_state *state)
{
*this= *state;
@@ -1229,162 +1223,6 @@ private:
/**
- An abstract class for a strategy specifying how the prelocking
- algorithm should extend the prelocking set while processing
- already existing elements in the set.
-*/
-
-class Prelocking_strategy
-{
-public:
- virtual ~Prelocking_strategy() { }
-
- virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
- Sroutine_hash_entry *rt, sp_head *sp,
- bool *need_prelocking) = 0;
- virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
- TABLE_LIST *table_list, bool *need_prelocking) = 0;
- virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
- TABLE_LIST *table_list, bool *need_prelocking)= 0;
-};
-
-
-/**
- A Strategy for prelocking algorithm suitable for DML statements.
-
- Ensures that all tables used by all statement's SF/SP/triggers and
- required for foreign key checks are prelocked and SF/SPs used are
- cached.
-*/
-
-class DML_prelocking_strategy : public Prelocking_strategy
-{
-public:
- virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
- Sroutine_hash_entry *rt, sp_head *sp,
- bool *need_prelocking);
- virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
- TABLE_LIST *table_list, bool *need_prelocking);
- virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
- TABLE_LIST *table_list, bool *need_prelocking);
-};
-
-
-/**
- A strategy for prelocking algorithm to be used for LOCK TABLES
- statement.
-*/
-
-class Lock_tables_prelocking_strategy : public DML_prelocking_strategy
-{
- virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
- TABLE_LIST *table_list, bool *need_prelocking);
-};
-
-
-/**
- Strategy for prelocking algorithm to be used for ALTER TABLE statements.
-
- Unlike DML or LOCK TABLES strategy, it doesn't
- prelock triggers, views or stored routines, since they are not
- used during ALTER.
-*/
-
-class Alter_table_prelocking_strategy : public Prelocking_strategy
-{
-public:
-
- Alter_table_prelocking_strategy(Alter_info *alter_info)
- : m_alter_info(alter_info)
- {}
-
- virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
- Sroutine_hash_entry *rt, sp_head *sp,
- bool *need_prelocking);
- virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
- TABLE_LIST *table_list, bool *need_prelocking);
- virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
- TABLE_LIST *table_list, bool *need_prelocking);
-
-private:
- Alter_info *m_alter_info;
-};
-
-
-/**
- A context of open_tables() function, used to recover
- from a failed open_table() or open_routine() attempt.
-
- Implemented in sql_base.cc.
-*/
-
-class Open_table_context
-{
-public:
- enum enum_open_table_action
- {
- OT_NO_ACTION= 0,
- OT_WAIT_MDL_LOCK,
- OT_WAIT_TDC,
- OT_DISCOVER,
- OT_REPAIR
- };
- Open_table_context(THD *thd, ulong timeout);
-
- bool recover_from_failed_open(THD *thd, MDL_request *mdl_request,
- TABLE_LIST *table);
- bool request_backoff_action(enum_open_table_action action_arg);
-
- void add_request(MDL_request *request)
- { m_mdl_requests.push_front(request); }
-
- bool can_recover_from_failed_open() const
- { return m_action != OT_NO_ACTION; }
-
- /**
- When doing a back-off, we close all tables acquired by this
- statement. Return an MDL savepoint taken at the beginning of
- the statement, so that we can rollback to it before waiting on
- locks.
- */
- MDL_ticket *start_of_statement_svp() const
- {
- return m_start_of_statement_svp;
- }
-
- MDL_request *get_global_mdl_request(THD *thd);
-
- inline ulong get_timeout() const
- {
- return m_timeout;
- }
-
-private:
- /** List of requests for all locks taken so far. Used for waiting on locks. */
- MDL_request_list m_mdl_requests;
- /** Back off action. */
- enum enum_open_table_action m_action;
- MDL_ticket *m_start_of_statement_svp;
- /**
- Whether we had any locks when this context was created.
- If we did, they are from the previous statement of a transaction,
- and we can't safely do back-off (and release them).
- */
- bool m_has_locks;
- /**
- 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.
- */
- uint m_timeout;
-};
-
-
-/**
Tables that were locked with LOCK TABLES statement.
Encapsulates a list of TABLE_LIST instances for tables
@@ -1732,6 +1570,125 @@ 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
@@ -1769,6 +1726,12 @@ 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();
/*
@@ -2097,8 +2060,31 @@ public:
uint server_status,open_options;
enum enum_thread_type system_thread;
uint select_number; //number of select (used for EXPLAIN)
- /* variables.transaction_isolation is reset to this after each commit */
- enum_tx_isolation session_tx_isolation;
+ /*
+ Current or next transaction isolation level.
+ When a connection is established, the value is taken from
+ @@session.tx_isolation (default transaction isolation for
+ the session), which is in turn taken from @@global.tx_isolation
+ (the global value).
+ If there is no transaction started, this variable
+ holds the value of the next transaction's isolation level.
+ When a transaction starts, the value stored in this variable
+ becomes "actual".
+ At transaction commit or rollback, we assign this variable
+ again from @@session.tx_isolation.
+ The only statement that can otherwise change the value
+ of this variable is SET TRANSACTION ISOLATION LEVEL.
+ Its purpose is to effect the isolation level of the next
+ transaction in this session. When this statement is executed,
+ the value in this variable is changed. However, since
+ this statement is only allowed when there is no active
+ transaction, this assignment (naturally) only affects the
+ upcoming transaction.
+ At the end of the current active transaction the value is
+ be reset again from @@session.tx_isolation, as described
+ above.
+ */
+ enum_tx_isolation tx_isolation;
enum_check_fields count_cuted_fields;
DYNAMIC_ARRAY user_var_events; /* For user variables replication */
@@ -2164,7 +2150,6 @@ public:
is set if a statement accesses a temporary table created through
CREATE TEMPORARY TABLE.
*/
- bool thread_temporary_used;
bool charset_is_system_charset, charset_is_collation_connection;
bool charset_is_character_set_filesystem;
bool enable_slow_log; /* enable slow log for current statement */
@@ -2478,7 +2463,12 @@ public:
/** Return FALSE if connection to client is broken. */
bool is_connected()
{
- return vio_ok() ? vio_is_connected(net.vio) : FALSE;
+ /*
+ All system threads (e.g., the slave IO thread) are connected but
+ not using vio. So this function always returns true for all
+ system threads.
+ */
+ return system_thread || (vio_ok() ? vio_is_connected(net.vio) : FALSE);
}
#else
inline bool vio_ok() const { return TRUE; }
@@ -2676,7 +2666,7 @@ public:
memcpy(db, new_db, new_db_len+1);
else
{
- x_free(db);
+ my_free(db);
if (new_db)
db= my_strndup(new_db, new_db_len, MYF(MY_WME | ME_FATALERROR));
else
@@ -2843,6 +2833,12 @@ public:
void set_query_and_id(char *query_arg, uint32 query_length_arg,
query_id_t new_query_id);
void set_query_id(query_id_t new_query_id);
+ void set_open_tables(TABLE *open_tables_arg)
+ {
+ mysql_mutex_lock(&LOCK_thd_data);
+ open_tables= open_tables_arg;
+ mysql_mutex_unlock(&LOCK_thd_data);
+ }
void enter_locked_tables_mode(enum_locked_tables_mode mode_arg)
{
DBUG_ASSERT(locked_tables_mode == LTM_NONE);
@@ -2852,6 +2848,18 @@ public:
}
void leave_locked_tables_mode();
int decide_logging_format(TABLE_LIST *tables);
+ void set_current_user_used() { current_user_used= TRUE; }
+ bool is_current_user_used() { return current_user_used; }
+ void clean_current_user_used() { current_user_used= FALSE; }
+ void get_definer(LEX_USER *definer);
+ void set_invoker(const LEX_STRING *user, const LEX_STRING *host)
+ {
+ invoker_user= *user;
+ invoker_host= *host;
+ }
+ LEX_STRING get_invoker_user() { return invoker_user; }
+ LEX_STRING get_invoker_host() { return invoker_host; }
+ bool has_invoker() { return invoker_user.length > 0; }
private:
/** The current internal error handler for this thread, or NULL. */
@@ -2874,6 +2882,25 @@ private:
MEM_ROOT main_mem_root;
Warning_info main_warning_info;
Diagnostics_area main_da;
+
+ /**
+ It will be set TURE if CURRENT_USER() is called in account management
+ statements or default definer is set in CREATE/ALTER SP, SF, Event,
+ TRIGGER or VIEW statements.
+
+ Current user will be binlogged into Query_log_event if current_user_used
+ is TRUE; It will be stored into invoker_host and invoker_user by SQL thread.
+ */
+ bool current_user_used;
+
+ /**
+ It points to the invoker in the Query_log_event.
+ SQL thread use it as the default definer in CREATE/ALTER SP, SF, Event,
+ TRIGGER or VIEW statements or current user in account management
+ statements if it is not NULL.
+ */
+ LEX_STRING invoker_user;
+ LEX_STRING invoker_host;
};
@@ -3428,6 +3455,9 @@ public:
void reset();
bool walk(tree_walk_action action, void *walk_action_arg);
+ uint get_size() const { return size; }
+ ulonglong get_max_in_memory_size() const { return max_in_memory_size; }
+
friend int unique_write_to_file(uchar* key, element_count count, Unique *unique);
friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique);
};
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 7b0ef3eb226..003203b5466 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -98,7 +98,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
if (my_hash_insert(&hash_user_connections, (uchar*) uc))
{
/* The only possible error is out of memory, MY_WME sets an error. */
- my_free((char*) uc,0);
+ my_free(uc);
return_val= 1;
goto end;
}
@@ -555,7 +555,7 @@ extern "C" uchar *get_key_conn(user_conn *buff, size_t *length,
extern "C" void free_user(struct user_conn *uc)
{
- my_free((char*) uc,MYF(0));
+ my_free(uc);
}
@@ -940,8 +940,7 @@ static int check_connection(THD *thd)
user_len-= 2;
}
- if (thd->main_security_ctx.user)
- x_free(thd->main_security_ctx.user);
+ my_free(thd->main_security_ctx.user);
if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME))))
return 1; /* The error is set by my_strdup(). */
return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE);
@@ -1073,10 +1072,6 @@ static void prepare_new_connection_state(THD* thd)
{
Security_context *sctx= thd->security_ctx;
-#ifdef __NETWARE__
- netware_reg_user(sctx->ip, sctx->user, "MySQL");
-#endif
-
if (thd->client_capabilities & CLIENT_COMPRESS)
thd->net.compress=1; // Use compression
@@ -1085,7 +1080,6 @@ static void prepare_new_connection_state(THD* thd)
embedded server library.
TODO: refactor this to avoid code duplication there
*/
- thd->version= refresh_version;
thd->proc_info= 0;
thd->command= COM_SLEEP;
thd->set_time();
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index 59bf0764ada..ca724ec262f 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -357,7 +357,7 @@ void
Sensitive_cursor::reset_thd(THD *thd)
{
thd->derived_tables= 0;
- thd->open_tables= 0;
+ thd->set_open_tables(NULL);
thd->lock= 0;
thd->free_list= 0;
thd->change_list.empty();
@@ -436,7 +436,7 @@ Sensitive_cursor::fetch(ulong num_rows)
thd->lock == 0);
thd->derived_tables= derived_tables;
- thd->open_tables= open_tables;
+ thd->set_open_tables(open_tables);
thd->lock= lock;
thd->set_query_id(query_id);
change_list.move_elements_to(&thd->change_list);
@@ -519,14 +519,14 @@ Sensitive_cursor::close()
TABLE *tmp_derived_tables= thd->derived_tables;
MYSQL_LOCK *tmp_lock= thd->lock;
- thd->open_tables= open_tables;
+ 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->open_tables= tmp_derived_tables;
+ thd->set_open_tables(tmp_derived_tables);
thd->derived_tables= tmp_derived_tables;
thd->lock= tmp_lock;
}
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 15fdd842e34..1040fc92851 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -94,7 +94,7 @@ extern "C" void lock_db_free_element(void *ptr);
void lock_db_free_element(void *ptr)
{
- my_free(ptr, MYF(0));
+ my_free(ptr);
}
@@ -136,7 +136,7 @@ static my_bool lock_db_insert(const char *dbname, uint length)
opt->name_length= length;
if ((error= my_hash_insert(&lock_db_cache, (uchar*) opt)))
- my_free(opt, MYF(0));
+ my_free(opt);
}
end:
@@ -209,7 +209,7 @@ extern "C" void free_dbopt(void *dbopt);
void free_dbopt(void *dbopt)
{
- my_free((uchar*) dbopt, MYF(0));
+ my_free(dbopt);
}
#ifdef HAVE_PSI_INTERFACE
@@ -377,7 +377,7 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create)
if ((error= my_hash_insert(&dboptions, (uchar*) opt)))
{
- my_free(opt, MYF(0));
+ my_free(opt);
goto end;
}
}
@@ -1203,6 +1203,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
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;
@@ -1436,8 +1438,7 @@ static void mysql_change_db_impl(THD *thd,
we just call THD::reset_db(). Since THD::reset_db() does not releases
the previous database name, we should do it explicitly.
*/
-
- x_free(thd->db);
+ my_free(thd->db);
thd->reset_db(new_db_name->str, new_db_name->length);
}
@@ -1650,7 +1651,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
if (check_db_name(&new_db_file_name))
{
my_error(ER_WRONG_DB_NAME, MYF(0), new_db_file_name.str);
- my_free(new_db_file_name.str, MYF(0));
+ my_free(new_db_file_name.str);
if (force_switch)
mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
@@ -1680,7 +1681,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
new_db_file_name.str);
general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
sctx->priv_user, sctx->priv_host, new_db_file_name.str);
- my_free(new_db_file_name.str, MYF(0));
+ my_free(new_db_file_name.str);
DBUG_RETURN(TRUE);
}
#endif
@@ -1695,7 +1696,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR),
new_db_file_name.str);
- my_free(new_db_file_name.str, MYF(0));
+ my_free(new_db_file_name.str);
/* Change db to NULL. */
@@ -1710,7 +1711,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
/* Report an error and free new_db_file_name. */
my_error(ER_BAD_DB_ERROR, MYF(0), new_db_file_name.str);
- my_free(new_db_file_name.str, MYF(0));
+ my_free(new_db_file_name.str);
/* The operation failed. */
@@ -1918,9 +1919,11 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
Table_ident *new_ident= new Table_ident(thd, new_db, table_str, 0);
if (!old_ident || !new_ident ||
!sl->add_table_to_list(thd, old_ident, NULL,
- TL_OPTION_UPDATING, TL_IGNORE) ||
+ TL_OPTION_UPDATING, TL_IGNORE,
+ MDL_EXCLUSIVE) ||
!sl->add_table_to_list(thd, new_ident, NULL,
- TL_OPTION_UPDATING, TL_IGNORE))
+ TL_OPTION_UPDATING, TL_IGNORE,
+ MDL_EXCLUSIVE))
{
error= 1;
my_dirend(dirp);
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index d71d5c56980..00666bc85b4 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -14,7 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
- Delete of records and truncate of tables.
+ Delete of records tables.
Multi-table deletes were introduced by Monty and Sinisa
*/
@@ -47,8 +47,7 @@
*/
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
- SQL_I_List<ORDER> *order, ha_rows limit, ulonglong options,
- bool reset_auto_increment)
+ SQL_I_List<ORDER> *order_list, ha_rows limit, ulonglong options)
{
bool will_batch;
int error, loc_error;
@@ -59,17 +58,15 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
bool transactional_table, safe_update, const_cond;
bool const_cond_result;
ha_rows deleted= 0;
- bool triggers_applicable;
+ bool reverse= FALSE;
+ bool skip_record;
+ ORDER *order= (ORDER *) ((order_list && order_list->elements) ?
+ order_list->first : NULL);
uint usable_index= MAX_KEY;
SELECT_LEX *select_lex= &thd->lex->select_lex;
THD::killed_state killed_status= THD::NOT_KILLED;
+ THD::enum_binlog_query_type query_type= THD::ROW_QUERY_TYPE;
DBUG_ENTER("mysql_delete");
- bool save_binlog_row_based;
-
- THD::enum_binlog_query_type query_type=
- thd->lex->sql_command == SQLCOM_TRUNCATE ?
- THD::STMT_QUERY_TYPE :
- THD::ROW_QUERY_TYPE;
if (open_and_lock_tables(thd, table_list, TRUE, 0))
DBUG_RETURN(TRUE);
@@ -86,7 +83,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN(TRUE);
/* check ORDER BY even if it can be ignored */
- if (order && order->elements)
+ if (order)
{
TABLE_LIST tables;
List<Item> fields;
@@ -96,9 +93,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
tables.table = table;
tables.alias = table_list->alias;
- if (select_lex->setup_ref_array(thd, order->elements) ||
+ if (select_lex->setup_ref_array(thd, order_list->elements) ||
setup_order(thd, select_lex->ref_pointer_array, &tables,
- fields, all_fields, order->first))
+ fields, all_fields, order))
{
delete select;
free_underlaid_joins(thd, &thd->lex->select_lex);
@@ -129,25 +126,20 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
any side-effects (because of triggers), so we can use optimized
handler::delete_all_rows() method.
- We implement fast TRUNCATE for InnoDB even if triggers are
- present. TRUNCATE ignores triggers.
-
We can use delete_all_rows() if and only if:
- We allow new functions (not using option --skip-new), and are
not in safe mode (not using option --safe-mode)
- There is no limit clause
- The condition is constant
- If there is a condition, then it it produces a non-zero value
- - If the current command is DELETE FROM with no where clause
- (i.e., not TRUNCATE) then:
- - We should not be binlogging this statement row-based, and
+ - If the current command is DELETE FROM with no where clause, then:
+ - We should not be binlogging this statement in row-based, and
- there should be no delete triggers associated with the table.
*/
if (!using_limit && const_cond_result &&
!(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) &&
- (thd->lex->sql_command == SQLCOM_TRUNCATE ||
(!thd->is_current_stmt_binlog_format_row() &&
- !(table->triggers && table->triggers->has_delete_triggers()))))
+ !(table->triggers && table->triggers->has_delete_triggers())))
{
/* Update the table->file->stats.records number */
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
@@ -160,16 +152,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
query in row format, so we have to log it in statement format.
*/
query_type= THD::STMT_QUERY_TYPE;
- error= -1; // ok
+ error= -1;
deleted= maybe_deleted;
- save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
goto cleanup;
}
if (error != HA_ERR_WRONG_COMMAND)
{
table->file->print_error(error,MYF(0));
error=0;
- save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
goto cleanup;
}
/* Handler didn't support fast delete; Delete rows one by one */
@@ -196,6 +186,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
table->covering_keys.clear_all();
table->quick_keys.clear_all(); // Can't use 'only index'
+
select=make_select(table, 0, 0, conds, 0, &error);
if (error)
DBUG_RETURN(TRUE);
@@ -212,11 +203,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (thd->is_error())
DBUG_RETURN(TRUE);
my_ok(thd, 0);
- /*
- We don't need to call reset_auto_increment in this case, because
- mysql_truncate always gives a NULL conds argument, hence we never
- get here.
- */
DBUG_RETURN(0); // Nothing to delete
}
@@ -236,22 +222,25 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_QUICK);
- if (order && order->elements)
+ if (order)
{
uint length= 0;
SORT_FIELD *sortorder;
ha_rows examined_rows;
- if ((!select || table->quick_keys.is_clear_all()) && limit != HA_POS_ERROR)
- usable_index= get_index_for_order(table, order->first, limit);
+ table->update_const_key_parts(conds);
+ order= simple_remove_const(order, conds);
- if (usable_index == MAX_KEY)
+ bool need_sort;
+ usable_index= get_index_for_order(order, table, select, limit,
+ &need_sort, &reverse);
+ if (need_sort)
{
+ DBUG_ASSERT(usable_index == MAX_KEY);
table->sort.io_cache= (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
- if (!(sortorder= make_unireg_sortorder(order->first,
- &length, NULL)) ||
+ if (!(sortorder= make_unireg_sortorder(order, &length, NULL)) ||
(table->sort.found_records = filesort(thd, table, sortorder, length,
select, HA_POS_ERROR, 1,
&examined_rows))
@@ -282,17 +271,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (usable_index==MAX_KEY || (select && select->quick))
init_read_record(&info, thd, table, select, 1, 1, FALSE);
else
- init_read_record_idx(&info, thd, table, 1, usable_index);
+ init_read_record_idx(&info, thd, table, 1, usable_index, reverse);
init_ftfuncs(thd, select_lex, 1);
thd_proc_info(thd, "updating");
- /* NOTE: TRUNCATE must not invoke triggers. */
-
- triggers_applicable= table->triggers &&
- thd->lex->sql_command != SQLCOM_TRUNCATE;
-
- if (triggers_applicable &&
+ if (table->triggers &&
table->triggers->has_triggers(TRG_EVENT_DELETE,
TRG_ACTION_AFTER))
{
@@ -310,20 +294,15 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
table->mark_columns_needed_for_delete();
- save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
- if (thd->lex->sql_command == SQLCOM_TRUNCATE &&
- thd->is_current_stmt_binlog_format_row())
- thd->clear_current_stmt_binlog_format_row();
-
while (!(error=info.read_record(&info)) && !thd->killed &&
! thd->is_error())
{
thd->examined_row_count++;
// thd->is_error() is tested to disallow delete row on error
- if (!(select && select->skip_record())&& ! thd->is_error() )
+ if (!select || (!select->skip_record(thd, &skip_record) && !skip_record))
{
- if (triggers_applicable &&
+ if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, FALSE))
{
@@ -334,7 +313,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (!(error= table->file->ha_delete_row(table->record[0])))
{
deleted++;
- if (triggers_applicable &&
+ if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, FALSE))
{
@@ -379,21 +358,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_NORMAL);
- if (reset_auto_increment && (error < 0))
- {
- /*
- We're really doing a truncate and need to reset the table's
- auto-increment counter.
- */
- int error2= table->file->ha_reset_auto_increment(0);
-
- if (error2 && (error2 != HA_ERR_WRONG_COMMAND))
- {
- table->file->print_error(error2, MYF(0));
- error= 1;
- }
- }
-
cleanup:
/*
Invalidate the table in the query cache if something changed. This must
@@ -414,34 +378,24 @@ cleanup:
/* See similar binlogging code in sql_update.cc, for comments */
if ((error < 0) || thd->transaction.stmt.modified_non_trans_table)
{
- if (mysql_bin_log.is_open() &&
- !(thd->lex->sql_command == SQLCOM_TRUNCATE &&
- thd->is_current_stmt_binlog_format_row() &&
- find_temporary_table(thd, table_list)))
+ if (mysql_bin_log.is_open())
{
- bool const is_trans=
- thd->lex->sql_command == SQLCOM_TRUNCATE ?
- FALSE :
- transactional_table;
-
int errcode= 0;
if (error < 0)
thd->clear_error();
else
errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
-
+
/*
[binlog]: If 'handler::delete_all_rows()' was called and the
storage engine does not inject the rows itself, we replicate
statement-based; otherwise, 'ha_delete_row()' was used to
delete specific rows which we might log row-based.
-
- Note that TRUNCATE TABLE is not transactional and should
- therefore be treated as a DDL.
*/
int log_result= thd->binlog_query(query_type,
thd->query(), thd->query_length(),
- is_trans, FALSE, FALSE, errcode);
+ transactional_table, FALSE, FALSE,
+ errcode);
if (log_result)
{
@@ -449,18 +403,12 @@ cleanup:
}
}
}
- if (save_binlog_row_based)
- thd->set_current_stmt_binlog_format_row();
DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex);
if (error < 0 ||
(thd->lex->ignore && !thd->is_error() && !thd->is_fatal_error))
{
- /*
- If a TRUNCATE TABLE was issued, the number of rows should be reported as
- zero since the exact number is unknown.
- */
- my_ok(thd, reset_auto_increment ? 0 : deleted);
+ my_ok(thd, deleted);
DBUG_PRINT("info",("%ld records deleted",(long) deleted));
}
DBUG_RETURN(error >= 0 || thd->is_error());
@@ -1062,227 +1010,3 @@ bool multi_delete::send_eof()
return 0;
}
-
-/***************************************************************************
- TRUNCATE TABLE
-****************************************************************************/
-
-/*
- Row-by-row truncation if the engine does not support table recreation.
- Probably a InnoDB table.
-*/
-
-static bool mysql_truncate_by_delete(THD *thd, TABLE_LIST *table_list)
-{
- bool error;
- DBUG_ENTER("mysql_truncate_by_delete");
- table_list->lock_type= TL_WRITE;
- table_list->mdl_request.set_type(MDL_SHARED_WRITE);
- mysql_init_select(thd->lex);
- /* Delete all rows from table */
- error= mysql_delete(thd, table_list, NULL, NULL, HA_POS_ERROR, LL(0), TRUE);
- /*
- All effects of a TRUNCATE TABLE operation are rolled back if a row by row
- deletion fails. Otherwise, operation is automatically committed at the end.
- */
- if (error)
- {
- DBUG_ASSERT(thd->stmt_da->is_error());
- trans_rollback_stmt(thd);
- trans_rollback(thd);
- }
- DBUG_RETURN(error);
-}
-
-
-/*
- Optimize delete of all rows by doing a full generate of the table
- This will work even if the .ISM and .ISD tables are destroyed
-
- dont_send_ok should be set if:
- - We should always wants to generate the table (even if the table type
- normally can't safely do this.
- - We don't want an ok to be sent to the end user.
- - We don't want to log the truncate command
- - If we want to keep exclusive metadata lock on the table (obtained by
- caller) on exit without errors.
-*/
-
-bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
-{
- HA_CREATE_INFO create_info;
- char path[FN_REFLEN + 1];
- TABLE *table;
- bool error= TRUE;
- uint path_length;
- /*
- Is set if we're under LOCK TABLES, and used
- to downgrade the exclusive lock after the
- table was truncated.
- */
- MDL_ticket *mdl_ticket= NULL;
- bool has_mdl_lock= FALSE;
- bool is_temporary_table= false;
- DBUG_ENTER("mysql_truncate");
-
- bzero((char*) &create_info,sizeof(create_info));
-
- /* Remove tables from the HANDLER's hash. */
- mysql_ha_rm_tables(thd, table_list);
-
- /* If it is a temporary table, close and regenerate it */
- if (!dont_send_ok && (table= find_temporary_table(thd, table_list)))
- {
- is_temporary_table= true;
- handlerton *table_type= table->s->db_type();
- TABLE_SHARE *share= table->s;
- /* Note that a temporary table cannot be partitioned */
- if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE))
- goto trunc_by_del;
-
- table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
-
- close_temporary_table(thd, table, 0, 0); // Don't free share
- ha_create_table(thd, share->normalized_path.str,
- share->db.str, share->table_name.str, &create_info, 1);
- // We don't need to call invalidate() because this table is not in cache
- if ((error= (int) !(open_temporary_table(thd, share->path.str,
- share->db.str,
- share->table_name.str, 1))))
- (void) rm_temporary_table(table_type, path);
- else
- thd->thread_specific_used= TRUE;
-
- free_table_share(share);
- my_free((char*) table,MYF(0));
- /*
- If we return here we will not have logged the truncation to the bin log
- and we will not my_ok() to the client.
- */
- goto end;
- }
-
- path_length= build_table_filename(path, sizeof(path) - 1, table_list->db,
- table_list->table_name, reg_ext, 0);
-
- if (!dont_send_ok)
- {
- enum legacy_db_type table_type;
- /*
- FIXME: Code of TRUNCATE breaks the meta-data
- locking protocol since it tries to find out the table storage
- engine and therefore accesses table in some way without holding
- any kind of meta-data lock.
- */
- mysql_frm_type(thd, path, &table_type);
- if (table_type == DB_TYPE_UNKNOWN)
- {
- my_error(ER_NO_SUCH_TABLE, MYF(0),
- table_list->db, table_list->table_name);
- DBUG_RETURN(TRUE);
- }
-#ifdef WITH_PARTITION_STORAGE_ENGINE
- /*
- TODO: Add support for TRUNCATE PARTITION for NDB and other engines
- supporting native partitioning
- */
- if (table_type != DB_TYPE_PARTITION_DB &&
- thd->lex->alter_info.flags & ALTER_ADMIN_PARTITION)
- {
- my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
- DBUG_RETURN(TRUE);
- }
-#endif
- if (!ha_check_storage_engine_flag(ha_resolve_by_legacy_type(thd,
- table_type),
- HTON_CAN_RECREATE) ||
- thd->lex->alter_info.flags & ALTER_ADMIN_PARTITION)
- goto trunc_by_del;
-
-
- if (thd->locked_tables_mode)
- {
- if (!(table= find_table_for_mdl_upgrade(thd->open_tables, table_list->db,
- table_list->table_name, FALSE)))
- DBUG_RETURN(TRUE);
- mdl_ticket= table->mdl_ticket;
- if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
- goto end;
- close_all_tables_for_name(thd, table->s, FALSE);
- }
- else
- {
- MDL_request mdl_global_request, mdl_request;
- MDL_request_list mdl_requests;
- /*
- Even though we could use the previous execution branch
- here just as well, we must not try to open the table:
- MySQL manual documents that TRUNCATE can be used to
- repair a damaged table, i.e. a table that can not be
- fully "opened". In particular MySQL manual says:
-
- As long as the table format file tbl_name.frm is valid,
- the table can be re-created as an empty table with TRUNCATE
- TABLE, even if the data or index files have become corrupted.
- */
-
- mdl_global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE);
- mdl_request.init(MDL_key::TABLE, table_list->db, table_list->table_name,
- MDL_EXCLUSIVE);
- 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_RETURN(TRUE);
-
- has_mdl_lock= TRUE;
- mysql_mutex_lock(&LOCK_open);
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table_list->db,
- table_list->table_name);
- mysql_mutex_unlock(&LOCK_open);
- }
- }
-
- /*
- Remove the .frm extension AIX 5.2 64-bit compiler bug (BUG#16155): this
- crashes, replacement works. *(path + path_length - reg_ext_length)=
- '\0';
- */
- path[path_length - reg_ext_length] = 0;
- mysql_mutex_lock(&LOCK_open);
- error= ha_create_table(thd, path, table_list->db, table_list->table_name,
- &create_info, 1);
- mysql_mutex_unlock(&LOCK_open);
- query_cache_invalidate3(thd, table_list, 0);
-
-end:
- if (!dont_send_ok)
- {
- if (thd->locked_tables_mode && thd->locked_tables_list.reopen_tables(thd))
- thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
- /*
- Even if we failed to reopen some tables,
- the operation itself succeeded, write the binlog.
- */
- if (!error)
- {
- /* In RBR, the statement is not binlogged if the table is temporary. */
- if (!is_temporary_table || !thd->is_current_stmt_binlog_format_row())
- error= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
- if (!error)
- my_ok(thd); // This should return record count
- }
- if (has_mdl_lock)
- thd->mdl_context.release_transactional_locks();
- if (mdl_ticket)
- mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_NO_READ_WRITE);
- }
-
- DBUG_PRINT("exit", ("error: %d", error));
- DBUG_RETURN(error);
-
-trunc_by_del:
- error= mysql_truncate_by_delete(thd, table_list);
- DBUG_RETURN(error);
-}
diff --git a/sql/sql_delete.h b/sql/sql_delete.h
index 0e09120f557..264991c220b 100644
--- a/sql/sql_delete.h
+++ b/sql/sql_delete.h
@@ -27,8 +27,6 @@ template <typename T> class SQL_I_List;
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
- SQL_I_List<ORDER> *order, ha_rows rows, ulonglong options,
- bool reset_auto_increment);
-bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
+ SQL_I_List<ORDER> *order, ha_rows rows, ulonglong options);
#endif /* SQL_DELETE_INCLUDED */
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index b9cc0ef477d..06a453f7b12 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -109,7 +109,7 @@ static char *mysql_ha_hash_get_key(TABLE_LIST *tables, size_t *key_len_p,
static void mysql_ha_hash_free(TABLE_LIST *tables)
{
- my_free((char*) tables, MYF(0));
+ my_free(tables);
}
/**
@@ -131,13 +131,11 @@ static void mysql_ha_close_table(THD *thd, TABLE_LIST *tables)
/* Non temporary table. */
tables->table->file->ha_index_or_rnd_end();
tables->table->open_by_handler= 0;
- mysql_mutex_lock(&LOCK_open);
if (close_thread_table(thd, &tables->table))
{
/* Tell threads waiting for refresh that something has happened */
broadcast_refresh();
}
- mysql_mutex_unlock(&LOCK_open);
thd->mdl_context.release_lock(tables->mdl_request.ticket);
}
else if (tables->table)
@@ -261,7 +259,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
/* add to hash */
if (my_hash_insert(&thd->handler_tables_hash, (uchar*) hash_tables))
{
- my_free((char*) hash_tables, MYF(0));
+ my_free(hash_tables);
DBUG_PRINT("exit",("ERROR"));
DBUG_RETURN(TRUE);
}
@@ -278,7 +276,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
See open_table() back-off comments for more details.
*/
backup_open_tables= thd->open_tables;
- thd->open_tables= NULL;
+ thd->set_open_tables(NULL);
mdl_savepoint= thd->mdl_context.mdl_savepoint();
/*
@@ -312,7 +310,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
if (error)
{
close_thread_tables(thd);
- thd->open_tables= backup_open_tables;
+ thd->set_open_tables(backup_open_tables);
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
if (!reopen)
my_hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables);
@@ -325,7 +323,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
DBUG_PRINT("exit",("ERROR"));
DBUG_RETURN(TRUE);
}
- thd->open_tables= backup_open_tables;
+ thd->set_open_tables(backup_open_tables);
if (hash_tables->mdl_request.ticket)
{
thd->mdl_context.
@@ -559,7 +557,7 @@ retry:
mysql_lock_tables() needs thd->open_tables to be set correctly to
be able to handle aborts properly.
*/
- thd->open_tables= hash_tables->table;
+ thd->set_open_tables(hash_tables->table);
sql_handler_lock_error.init();
@@ -575,7 +573,7 @@ retry:
*/
DBUG_ASSERT(hash_tables->table == thd->open_tables);
/* Restore previous context. */
- thd->open_tables= backup_open_tables;
+ thd->set_open_tables(backup_open_tables);
if (sql_handler_lock_error.need_reopen())
{
@@ -853,6 +851,35 @@ void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables)
/**
+ Close cursors of matching tables from the HANDLER's hash table.
+
+ @param thd Thread identifier.
+ @param tables The list of tables to flush.
+*/
+
+void mysql_ha_flush_tables(THD *thd, TABLE_LIST *all_tables)
+{
+ DBUG_ENTER("mysql_ha_flush_tables");
+
+ for (TABLE_LIST *table_list= all_tables; table_list;
+ table_list= table_list->next_global)
+ {
+ TABLE_LIST *hash_tables= mysql_ha_find(thd, table_list);
+ /* Close all aliases of the same table. */
+ while (hash_tables)
+ {
+ TABLE_LIST *next_local= hash_tables->next_local;
+ if (hash_tables->table)
+ mysql_ha_close_table(thd, hash_tables);
+ hash_tables= next_local;
+ }
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
Flush (close and mark for re-open) all tables that should be should
be reopen.
diff --git a/sql/sql_handler.h b/sql/sql_handler.h
index 8666d5a8d7b..c5da3c4d468 100644
--- a/sql/sql_handler.h
+++ b/sql/sql_handler.h
@@ -28,6 +28,7 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables);
bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
void mysql_ha_flush(THD *thd);
+void mysql_ha_flush_tables(THD *thd, TABLE_LIST *all_tables);
void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables);
void mysql_ha_cleanup(THD *thd);
void mysql_ha_move_tickets_after_trans_sentinel(THD *thd);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index d40f0dcb410..c783d74b363 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -93,7 +93,7 @@ static bool check_view_insertability(THD *thd, TABLE_LIST *view);
#define my_safe_afree(ptr, size, min_length) my_afree(ptr)
#else
#define my_safe_alloca(size, min_length) ((size <= min_length) ? my_alloca(size) : my_malloc(size,MYF(0)))
-#define my_safe_afree(ptr, size, min_length) if (size > min_length) my_free(ptr,MYF(0))
+#define my_safe_afree(ptr, size, min_length) if (size > min_length) my_free(ptr)
#endif
/*
@@ -1779,8 +1779,8 @@ public:
{}
~delayed_row()
{
- x_free(query.str);
- x_free(record);
+ my_free(query.str);
+ my_free(record);
}
};
@@ -1814,7 +1814,6 @@ public:
thd.security_ctx->user=thd.security_ctx->priv_user=(char*) delayed_user;
thd.security_ctx->host=(char*) my_localhost;
thd.current_tablenr=0;
- thd.version=refresh_version;
thd.command=COM_DELAYED_INSERT;
thd.lex->current_select= 0; // for my_message_sql
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
@@ -1869,7 +1868,7 @@ public:
mysql_cond_destroy(&cond);
mysql_cond_destroy(&cond_client);
thd.unlink(); // Must be unlinked under lock
- x_free(thd.query());
+ my_free(thd.query());
thd.security_ctx->user= thd.security_ctx->host=0;
thread_count--;
delayed_insert_threads--;
@@ -2277,7 +2276,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
row= new delayed_row(query, duplic, ignore, log_on);
if (row == NULL)
{
- my_free(query.str, MYF(MY_WME));
+ my_free(query.str);
goto err;
}
@@ -2681,7 +2680,7 @@ static void free_delayed_insert_blobs(register TABLE *table)
{
uchar *str;
((Field_blob *) (*ptr))->get_ptr(&str);
- my_free(str,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(str);
((Field_blob *) (*ptr))->reset();
}
}
@@ -3608,13 +3607,12 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
- Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+ Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
/*
Here we open the destination table, on which we already have
an exclusive metadata lock.
*/
- if (open_table(thd, create_table, thd->mem_root,
- &ot_ctx_unused, MYSQL_OPEN_REOPEN))
+ if (open_table(thd, create_table, thd->mem_root, &ot_ctx))
{
mysql_mutex_lock(&LOCK_open);
quick_rm_table(create_info->db_type, create_table->db,
@@ -3627,9 +3625,8 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
else
{
- Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
- if (open_table(thd, create_table, thd->mem_root, &ot_ctx_unused,
- MYSQL_OPEN_TEMPORARY_ONLY))
+ Open_table_context ot_ctx(thd, MYSQL_OPEN_TEMPORARY_ONLY);
+ if (open_table(thd, create_table, thd->mem_root, &ot_ctx))
{
/*
This shouldn't happen as creation of temporary table should make
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 16b4c727689..aefddc0b6a5 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -443,8 +443,11 @@ void lex_end(LEX *lex)
DBUG_PRINT("enter", ("lex: 0x%lx", (long) lex));
/* release used plugins */
- plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer,
- lex->plugins.elements);
+ if (lex->plugins.elements) /* No function call and no mutex if no plugins. */
+ {
+ plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer,
+ lex->plugins.elements);
+ }
reset_dynamic(&lex->plugins);
DBUG_VOID_RETURN;
@@ -454,8 +457,8 @@ Yacc_state::~Yacc_state()
{
if (yacc_yyss)
{
- my_free(yacc_yyss, MYF(0));
- my_free(yacc_yyvs, MYF(0));
+ my_free(yacc_yyss);
+ my_free(yacc_yyvs);
}
}
@@ -1986,6 +1989,7 @@ TABLE_LIST *st_select_lex_node::add_table_to_list (THD *thd, Table_ident *table,
LEX_STRING *alias,
ulong table_join_options,
thr_lock_type flags,
+ enum_mdl_type mdl_type,
List<Index_hint> *hints,
LEX_STRING *option)
{
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 985edd42496..b8bf3b220c9 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -502,6 +502,7 @@ public:
LEX_STRING *alias,
ulong table_options,
thr_lock_type flags= TL_UNLOCK,
+ enum_mdl_type mdl_type= MDL_SHARED_READ,
List<Index_hint> *hints= 0,
LEX_STRING *option= 0);
virtual void set_lock_for_tables(thr_lock_type lock_type) {}
@@ -799,6 +800,7 @@ public:
LEX_STRING *alias,
ulong table_options,
thr_lock_type flags= TL_UNLOCK,
+ enum_mdl_type mdl_type= MDL_SHARED_READ,
List<Index_hint> *hints= 0,
LEX_STRING *option= 0);
TABLE_LIST* get_table_list();
@@ -996,7 +998,7 @@ extern const LEX_STRING null_lex_str;
extern const LEX_STRING empty_lex_str;
-struct Sroutine_hash_entry;
+class Sroutine_hash_entry;
/*
Class representing list of all tables used by statement and other
@@ -1989,7 +1991,7 @@ struct LEX: public Query_tables_list
bool autocommit;
bool verbose, no_write_to_binlog;
- bool tx_chain, tx_release;
+ enum enum_yes_no_unknown tx_chain, tx_release;
/*
Special JOIN::prepare mode: changing of query is prohibited.
When creating a view, we need to just check its syntax omitting
@@ -2266,6 +2268,7 @@ public:
yacc_yyvs= NULL;
m_set_signal_info.clear();
m_lock_type= TL_READ_DEFAULT;
+ m_mdl_type= MDL_SHARED_READ;
}
~Yacc_state();
@@ -2277,6 +2280,7 @@ public:
void reset_before_substatement()
{
m_lock_type= TL_READ_DEFAULT;
+ m_mdl_type= MDL_SHARED_READ;
}
/**
@@ -2316,6 +2320,12 @@ public:
*/
thr_lock_type m_lock_type;
+ /**
+ The type of requested metadata lock for tables added to
+ the statement table list.
+ */
+ enum_mdl_type m_mdl_type;
+
/*
TODO: move more attributes from the LEX structure here.
*/
diff --git a/sql/sql_list.h b/sql/sql_list.h
index d57534b0999..5cd24236644 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -85,7 +85,7 @@ public:
SQL_I_List() { empty(); }
- SQL_I_List(const SQL_I_List &tmp)
+ SQL_I_List(const SQL_I_List &tmp) : Sql_alloc()
{
elements= tmp.elements;
first= tmp.first;
@@ -534,7 +534,7 @@ struct ilink
}
static void operator delete(void* ptr_arg, size_t size)
{
- my_free((uchar*)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
+ my_free(ptr_arg);
}
inline ilink()
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 7e540ffbe4b..b2a816a69dd 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -355,7 +355,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
(void) fn_format(name, ex->file_name, mysql_real_data_home, "",
MY_RELATIVE_PATH | MY_UNPACK_FILENAME |
MY_RETURN_REAL_PATH);
-#if !defined(__WIN__) && ! defined(__NETWARE__)
+#if !defined(__WIN__)
MY_STAT stat_info;
if (!mysql_file_stat(key_file_load, name, &stat_info, MYF(MY_WME)))
DBUG_RETURN(TRUE);
@@ -1337,7 +1337,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
(is_fifo ? READ_FIFO : READ_CACHE),0L,1,
MYF(MY_WME)))
{
- my_free((uchar*) buffer,MYF(0)); /* purecov: inspected */
+ my_free(buffer); /* purecov: inspected */
error=1;
}
else
@@ -1368,7 +1368,7 @@ READ_INFO::~READ_INFO()
{
if (need_end_io_cache)
::end_io_cache(&cache);
- my_free((uchar*) buffer,MYF(0));
+ my_free(buffer);
error=1;
}
List_iterator<XML_TAG> xmlit(taglist);
@@ -1441,29 +1441,6 @@ int READ_INFO::read_field()
while ( to < end_of_buff)
{
chr = GET;
-#ifdef USE_MB
- if ((my_mbcharlen(read_charset, chr) > 1) &&
- to+my_mbcharlen(read_charset, chr) <= end_of_buff)
- {
- uchar* p = (uchar*)to;
- *to++ = chr;
- int ml = my_mbcharlen(read_charset, chr);
- int i;
- for (i=1; i<ml; i++) {
- chr = GET;
- if (chr == my_b_EOF)
- goto found_eof;
- *to++ = chr;
- }
- if (my_ismbchar(read_charset,
- (const char *)p,
- (const char *)to))
- continue;
- for (i=0; i<ml; i++)
- PUSH((uchar) *--to);
- chr = GET;
- }
-#endif
if (chr == my_b_EOF)
goto found_eof;
if (chr == escape_char)
@@ -1547,6 +1524,39 @@ int READ_INFO::read_field()
return 0;
}
}
+#ifdef USE_MB
+ if (my_mbcharlen(read_charset, chr) > 1 &&
+ to + my_mbcharlen(read_charset, chr) <= end_of_buff)
+ {
+ uchar* p= (uchar*) to;
+ int ml, i;
+ *to++ = chr;
+
+ ml= my_mbcharlen(read_charset, chr);
+
+ for (i= 1; i < ml; i++)
+ {
+ chr= GET;
+ if (chr == my_b_EOF)
+ {
+ /*
+ Need to back up the bytes already ready from illformed
+ multi-byte char
+ */
+ to-= i;
+ goto found_eof;
+ }
+ *to++ = chr;
+ }
+ if (my_ismbchar(read_charset,
+ (const char *)p,
+ (const char *)to))
+ continue;
+ for (i= 0; i < ml; i++)
+ PUSH((uchar) *--to);
+ chr= GET;
+ }
+#endif
*to++ = (uchar) chr;
}
/*
diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc
index abd9c395083..c8aee307362 100644
--- a/sql/sql_locale.cc
+++ b/sql/sql_locale.cc
@@ -3442,6 +3442,6 @@ void cleanup_errmsgs()
{
for (MY_LOCALE_ERRMSGS *msgs= global_errmsgs; msgs->language; msgs++)
{
- my_free(msgs->errmsgs, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
+ my_free(msgs->errmsgs);
}
}
diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc
index e9c9402a89a..e3929066361 100644
--- a/sql/sql_manager.cc
+++ b/sql/sql_manager.cc
@@ -108,7 +108,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
if (error == ETIMEDOUT || error == ETIME)
{
- flush_tables();
+ tdc_flush_unused_tables();
error = 0;
reset_flush_time = TRUE;
}
@@ -117,7 +117,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
{
struct handler_cb *next= cb->next;
cb->action();
- my_free((uchar*)cb, MYF(0));
+ my_free(cb);
cb= next;
}
}
diff --git a/sql/sql_map.cc b/sql/sql_map.cc
index 35a248e5465..ca8a88bcbf8 100644
--- a/sql/sql_map.cc
+++ b/sql/sql_map.cc
@@ -74,7 +74,7 @@ mapped_files::~mapped_files()
(void) mysql_file_close(file, MYF(0));
file= -1; map=0;
}
- my_free(name,MYF(0));
+ my_free(name);
#endif
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index bdee13372d5..28a867cfcd8 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -49,6 +49,7 @@
// mysql_recreate_table,
// mysql_backup_table,
// mysql_restore_table
+#include "sql_truncate.h" // mysql_truncate_table
#include "sql_connect.h" // check_user,
// decrease_user_connections,
// thd_init_client_charset, check_mqh,
@@ -264,7 +265,7 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_ALTER_TABLE]= CF_CHANGES_DATA | CF_WRITE_LOGS_COMMAND |
CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
sql_command_flags[SQLCOM_TRUNCATE]= CF_CHANGES_DATA | CF_WRITE_LOGS_COMMAND |
- CF_AUTO_COMMIT_TRANS;
+ CF_AUTO_COMMIT_TRANS | CF_PROTECT_AGAINST_GRL;
sql_command_flags[SQLCOM_DROP_TABLE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_LOAD]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_PROTECT_AGAINST_GRL |
@@ -496,7 +497,6 @@ static void handle_bootstrap_impl(THD *thd)
#endif /* EMBEDDED_LIBRARY */
thd_proc_info(thd, 0);
- thd->version=refresh_version;
thd->security_ctx->priv_user=
thd->security_ctx->user= (char*) my_strdup("boot", MYF(MY_WME));
thd->security_ctx->priv_host[0]=0;
@@ -1058,7 +1058,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (res)
{
- x_free(thd->security_ctx->user);
+ my_free(thd->security_ctx->user);
*thd->security_ctx= save_security_ctx;
thd->user_connect= save_user_connect;
thd->db= save_db;
@@ -1071,8 +1071,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (save_user_connect)
decrease_user_connections(save_user_connect);
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
- x_free(save_db);
- x_free(save_security_ctx.user);
+ my_free(save_db);
+ my_free(save_security_ctx.user);
if (cs_number)
{
@@ -1415,18 +1415,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#ifdef EMBEDDED_LIBRARY
/* Store the buffer in permanent memory */
my_ok(thd, 0, 0, buff);
-#endif
-#ifdef SAFEMALLOC
- if (sf_malloc_cur_memory) // Using SAFEMALLOC
- {
- char *end= buff + length;
- length+= my_snprintf(end, buff_len - length - 1,
- end," Memory in use: %ldK Max memory used: %ldK",
- (sf_malloc_cur_memory+1023L)/1024L,
- (sf_malloc_max_memory+1023L)/1024L);
- }
-#endif
-#ifndef EMBEDDED_LIBRARY
+#else
(void) my_net_write(net, (uchar*) buff, length);
(void) net_flush(net);
thd->stmt_da->disable_status();
@@ -1674,7 +1663,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
/* 'parent_lex' is used in init_query() so it must be before it. */
schema_select_lex->parent_lex= lex;
schema_select_lex->init_query();
- if (!schema_select_lex->add_table_to_list(thd, table_ident, 0, 0, TL_READ))
+ if (!schema_select_lex->add_table_to_list(thd, table_ident, 0, 0, TL_READ,
+ MDL_SHARED_READ))
DBUG_RETURN(1);
lex->query_tables_last= query_tables_last;
break;
@@ -2612,7 +2602,7 @@ case SQLCOM_PREPARE:
/* Set strategies: reset default or 'prepared' values. */
create_table->open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
- create_table->lock_strategy= TABLE_LIST::EXCLUSIVE_DOWNGRADABLE_MDL;
+ create_table->lock_strategy= TABLE_LIST::OTLS_DOWNGRADE_IF_EXISTS;
/*
Close any open handlers for the table
@@ -3350,9 +3340,8 @@ end_with_restore_list:
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
goto error;
}
- if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- goto error;
- res= mysql_truncate(thd, first_table, 0);
+ if (! (res= mysql_truncate_table(thd, first_table)))
+ my_ok(thd);
break;
case SQLCOM_DELETE:
{
@@ -3365,8 +3354,7 @@ end_with_restore_list:
MYSQL_DELETE_START(thd->query());
res = mysql_delete(thd, all_tables, select_lex->where,
&select_lex->order_list,
- unit->select_limit_cnt, select_lex->options,
- FALSE);
+ unit->select_limit_cnt, select_lex->options);
MYSQL_DELETE_DONE(res, (ulong) thd->get_row_count_func());
break;
}
@@ -3572,16 +3560,13 @@ end_with_restore_list:
thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
goto error;
- init_mdl_requests(all_tables);
-
thd->variables.option_bits|= OPTION_TABLE_LOCK;
thd->in_lock_tables=1;
{
Lock_tables_prelocking_strategy lock_tables_prelocking_strategy;
- res= (open_and_lock_tables(thd, all_tables, FALSE,
- MYSQL_OPEN_TAKE_UPGRADABLE_MDL,
+ res= (open_and_lock_tables(thd, all_tables, FALSE, 0,
&lock_tables_prelocking_strategy) ||
thd->locked_tables_list.init_locked_tables(thd));
}
@@ -4103,33 +4088,65 @@ end_with_restore_list:
my_ok(thd);
break;
case SQLCOM_COMMIT:
+ {
DBUG_ASSERT(thd->lock == NULL ||
thd->locked_tables_mode == LTM_LOCK_TABLES);
+ bool tx_chain= (lex->tx_chain == TVL_YES ||
+ (thd->variables.completion_type == 1 &&
+ lex->tx_chain != TVL_NO));
+ bool tx_release= (lex->tx_release == TVL_YES ||
+ (thd->variables.completion_type == 2 &&
+ lex->tx_release != TVL_NO));
if (trans_commit(thd))
goto error;
thd->mdl_context.release_transactional_locks();
/* Begin transaction with the same isolation level. */
- if (lex->tx_chain && trans_begin(thd))
+ if (tx_chain)
+ {
+ if (trans_begin(thd))
goto error;
+ }
+ else
+ {
+ /* Reset the isolation level if no chaining transaction. */
+ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
+ }
/* Disconnect the current client connection. */
- if (lex->tx_release)
+ if (tx_release)
thd->killed= THD::KILL_CONNECTION;
my_ok(thd);
break;
+ }
case SQLCOM_ROLLBACK:
+ {
DBUG_ASSERT(thd->lock == NULL ||
thd->locked_tables_mode == LTM_LOCK_TABLES);
+ bool tx_chain= (lex->tx_chain == TVL_YES ||
+ (thd->variables.completion_type == 1 &&
+ lex->tx_chain != TVL_NO));
+ bool tx_release= (lex->tx_release == TVL_YES ||
+ (thd->variables.completion_type == 2 &&
+ lex->tx_release != TVL_NO));
if (trans_rollback(thd))
goto error;
thd->mdl_context.release_transactional_locks();
/* Begin transaction with the same isolation level. */
- if (lex->tx_chain && trans_begin(thd))
- goto error;
+ if (tx_chain)
+ {
+ if (trans_begin(thd))
+ goto error;
+ }
+ else
+ {
+ /* Reset the isolation level if no chaining transaction. */
+ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
+ }
/* Disconnect the current client connection. */
- if (lex->tx_release)
+ if (tx_release)
thd->killed= THD::KILL_CONNECTION;
my_ok(thd);
break;
+ }
case SQLCOM_RELEASE_SAVEPOINT:
if (trans_release_savepoint(thd, lex->ident))
goto error;
@@ -4632,12 +4649,22 @@ create_sp_error:
if (trans_xa_commit(thd))
goto error;
thd->mdl_context.release_transactional_locks();
+ /*
+ We've just done a commit, reset transaction
+ isolation level to the session default.
+ */
+ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
my_ok(thd);
break;
case SQLCOM_XA_ROLLBACK:
if (trans_xa_rollback(thd))
goto error;
thd->mdl_context.release_transactional_locks();
+ /*
+ We've just done a rollback, reset transaction
+ isolation level to the session default.
+ */
+ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
my_ok(thd);
break;
case SQLCOM_XA_RECOVER:
@@ -5595,7 +5622,7 @@ void THD::reset_for_next_command()
thd->transaction.all.modified_non_trans_table= FALSE;
}
DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
- thd->thread_specific_used= thd->thread_temporary_used= FALSE;
+ thd->thread_specific_used= FALSE;
if (opt_bin_log)
{
@@ -5610,6 +5637,7 @@ 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",
@@ -6087,6 +6115,7 @@ bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *item,bool asc)
- TL_OPTION_FORCE_INDEX : Force usage of index
- TL_OPTION_ALIAS : an alias in multi table DELETE
@param lock_type How table should be locked
+ @param mdl_type Type of metadata lock to acquire on the table.
@param use_index List of indexed used in USE INDEX
@param ignore_index List of indexed used in IGNORE INDEX
@@ -6101,6 +6130,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
LEX_STRING *alias,
ulong table_options,
thr_lock_type lock_type,
+ enum_mdl_type mdl_type,
List<Index_hint> *index_hints_arg,
LEX_STRING *option)
{
@@ -6248,9 +6278,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr->next_name_resolution_table= NULL;
/* Link table in global list (all used tables) */
lex->add_to_query_tables(ptr);
- ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name,
- (ptr->lock_type >= TL_WRITE_ALLOW_WRITE) ?
- MDL_SHARED_WRITE : MDL_SHARED_READ);
+ ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type);
DBUG_RETURN(ptr);
}
@@ -7620,7 +7648,7 @@ LEX_USER *create_default_definer(THD *thd)
if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER))))
return 0;
- get_default_definer(thd, definer);
+ thd->get_definer(definer);
return definer;
}
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index de0a3035e9a..475811d45b7 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -130,11 +130,6 @@ bool check_simple_select();
Item *negate_expression(THD *thd, Item *expr);
bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
-bool begin_trans(THD *thd);
-bool end_active_trans(THD *thd);
-int end_trans(THD *thd, enum enum_mysql_completiontype completion);
-
-
/* Variables */
extern const char* any_db;
@@ -188,9 +183,8 @@ inline bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list)
inline bool check_some_routine_access(THD *thd, const char *db,
const char *name, bool is_proc)
{ return false; }
-inline bool check_access(THD *thd, ulong access, const char *db,
- ulong *save_priv, bool no_grant, bool no_errors,
- bool schema_db)
+inline bool check_access(THD *, ulong, const char *, ulong *save_priv,
+ GRANT_INTERNAL_INFO *, bool, bool)
{
if (save_priv)
*save_priv= GLOBAL_ACLS;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index bc9a7d8ee65..d7ff753dfd0 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -2624,7 +2624,7 @@ char *generate_partition_syntax(partition_info *part_info,
if (unlikely(mysql_file_read(fptr, (uchar*)buf, *buf_length, MYF(MY_FNABP))))
{
if (!use_sql_alloc)
- my_free(buf, MYF(0));
+ my_free(buf);
else
buf= NULL;
}
diff --git a/sql/sql_plist.h b/sql/sql_plist.h
index eb239a63467..db85266be15 100644
--- a/sql/sql_plist.h
+++ b/sql/sql_plist.h
@@ -18,8 +18,10 @@
#include <my_global.h>
-template <typename T, typename B, typename C> class I_P_List_iterator;
+template <typename T, typename B, typename C, typename I>
+class I_P_List_iterator;
class I_P_List_null_counter;
+template <typename T> class I_P_List_no_push_back;
/**
@@ -52,12 +54,19 @@ class I_P_List_null_counter;
should be done. Instance of this class is also used as a place
where information about number of list elements is stored.
@sa I_P_List_null_counter, I_P_List_counter
+ @param I Policy class specifying whether I_P_List should support
+ efficient push_back() operation. Instance of this class
+ is used as place where we store information to support
+ this operation.
+ @sa I_P_List_no_push_back, I_P_List_fast_push_back.
*/
-template <typename T, typename B, typename C = I_P_List_null_counter>
-class I_P_List : public C
+template <typename T, typename B,
+ typename C = I_P_List_null_counter,
+ typename I = I_P_List_no_push_back<T> >
+class I_P_List : public C, public I
{
- T *first;
+ T *m_first;
/*
Do not prohibit copying of I_P_List object to simplify their usage in
@@ -65,31 +74,27 @@ class I_P_List : public C
is a bad idea.
*/
public:
- I_P_List() : first(NULL) { };
- inline void empty() { first= NULL; C::reset(); }
- inline bool is_empty() const { return (first == NULL); }
+ I_P_List() : I(&m_first), m_first(NULL) {};
+ inline void empty() { m_first= NULL; C::reset(); I::set_last(&m_first); }
+ inline bool is_empty() const { return (m_first == NULL); }
inline void push_front(T* a)
{
- *B::next_ptr(a)= first;
- if (first)
- *B::prev_ptr(first)= B::next_ptr(a);
- first= a;
- *B::prev_ptr(a)= &first;
+ *B::next_ptr(a)= m_first;
+ if (m_first)
+ *B::prev_ptr(m_first)= B::next_ptr(a);
+ else
+ I::set_last(B::next_ptr(a));
+ m_first= a;
+ *B::prev_ptr(a)= &m_first;
C::inc();
}
inline void push_back(T *a)
{
- insert_after(back(), a);
- }
- inline T *back()
- {
- T *t= front();
- if (t)
- {
- while (*B::next_ptr(t))
- t= *B::next_ptr(t);
- }
- return t;
+ T **last= I::get_last();
+ *B::next_ptr(a)= *last;
+ *last= a;
+ *B::prev_ptr(a)= last;
+ I::set_last(B::next_ptr(a));
}
inline void insert_after(T *pos, T *a)
{
@@ -105,6 +110,8 @@ public:
T *old_next= *B::next_ptr(a);
*B::prev_ptr(old_next)= B::next_ptr(a);
}
+ else
+ I::set_last(B::next_ptr(a));
}
}
inline void remove(T *a)
@@ -112,24 +119,31 @@ public:
T *next= *B::next_ptr(a);
if (next)
*B::prev_ptr(next)= *B::prev_ptr(a);
+ else
+ I::set_last(*B::prev_ptr(a));
**B::prev_ptr(a)= next;
C::dec();
}
- inline T* front() { return first; }
- inline const T *front() const { return first; }
+ inline T* front() { return m_first; }
+ inline const T *front() const { return m_first; }
void swap(I_P_List<T, B, C> &rhs)
{
- swap_variables(T *, first, rhs.first);
- if (first)
- *B::prev_ptr(first)= &first;
- if (rhs.first)
- *B::prev_ptr(rhs.first)= &rhs.first;
+ swap_variables(T *, m_first, rhs.m_first);
+ I::swap(rhs);
+ if (m_first)
+ *B::prev_ptr(m_first)= &m_first;
+ else
+ I::set_last(&m_first);
+ if (rhs.m_first)
+ *B::prev_ptr(rhs.m_first)= &rhs.m_first;
+ else
+ I::set_last(&rhs.m_first);
C::swap(rhs);
}
#ifndef _lint
- friend class I_P_List_iterator<T, B, C>;
+ friend class I_P_List_iterator<T, B, C, I>;
#endif
- typedef I_P_List_iterator<T, B, C> Iterator;
+ typedef I_P_List_iterator<T, B, C, I> Iterator;
};
@@ -137,18 +151,22 @@ public:
Iterator for I_P_List.
*/
-template <typename T, typename B, typename C = I_P_List_null_counter>
+template <typename T, typename B,
+ typename C = I_P_List_null_counter,
+ typename I = I_P_List_no_push_back<T> >
class I_P_List_iterator
{
- const I_P_List<T, B, C> *list;
+ const I_P_List<T, B, C, I> *list;
T *current;
public:
- I_P_List_iterator(const I_P_List<T, B, C> &a) : list(&a), current(a.first) {}
- I_P_List_iterator(const I_P_List<T, B, C> &a, T* current_arg) : list(&a), current(current_arg) {}
- inline void init(const I_P_List<T, B, C> &a)
+ I_P_List_iterator(const I_P_List<T, B, C, I> &a)
+ : list(&a), current(a.m_first) {}
+ I_P_List_iterator(const I_P_List<T, B, C, I> &a, T* current_arg)
+ : list(&a), current(current_arg) {}
+ inline void init(const I_P_List<T, B, C, I> &a)
{
list= &a;
- current= a.first;
+ current= a.m_first;
}
inline T* operator++(int)
{
@@ -164,7 +182,7 @@ public:
}
inline void rewind()
{
- current= list->first;
+ current= list->m_first;
}
};
@@ -203,4 +221,40 @@ public:
uint elements() const { return m_counter; }
};
+
+/**
+ A null insertion policy class for I_P_List to be used
+ in cases when push_back() operation is not necessary.
+*/
+
+template <typename T> class I_P_List_no_push_back
+{
+protected:
+ I_P_List_no_push_back(T **a) {};
+ void set_last(T **a) {}
+ /*
+ T** get_last() const method is intentionally left unimplemented
+ in order to prohibit usage of push_back() method in lists which
+ use this policy.
+ */
+ void swap(I_P_List_no_push_back<T> &rhs) {}
+};
+
+
+/**
+ An insertion policy class for I_P_List which can
+ be used when fast push_back() operation is required.
+*/
+
+template <typename T> class I_P_List_fast_push_back
+{
+ T **m_last;
+protected:
+ I_P_List_fast_push_back(T **a) : m_last(a) { };
+ void set_last(T **a) { m_last= a; }
+ T** get_last() const { return m_last; }
+ void swap(I_P_List_fast_push_back<T> &rhs)
+ { swap_variables(T**, m_last, rhs.m_last); }
+};
+
#endif
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index c87da592210..2b6be403fc6 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -254,18 +254,12 @@ static void plugin_vars_free_values(sys_var *vars);
static void restore_pluginvar_names(sys_var *first);
static void plugin_opt_set_limits(struct my_option *,
const struct st_mysql_sys_var *);
-#define my_intern_plugin_lock(A,B) intern_plugin_lock(A,B CALLER_INFO)
-#define my_intern_plugin_lock_ci(A,B) intern_plugin_lock(A,B ORIG_CALLER_INFO)
-static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin
- CALLER_INFO_PROTO);
+#define my_intern_plugin_lock(A,B) intern_plugin_lock(A,B)
+#define my_intern_plugin_lock_ci(A,B) intern_plugin_lock(A,B)
+static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin);
static void intern_plugin_unlock(LEX *lex, plugin_ref plugin);
static void reap_plugins(void);
-#ifdef EMBEDDED_LIBRARY
-/* declared in sql_base.cc */
-extern bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists);
-#endif /* EMBEDDED_LIBRARY */
-
static void report_error(int where_to, uint error, ...)
{
va_list args;
@@ -397,9 +391,9 @@ static inline void free_plugin_mem(struct st_plugin_dl *p)
if (p->handle)
dlclose(p->handle);
#endif
- my_free(p->dl.str, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(p->dl.str);
if (p->version != MYSQL_PLUGIN_INTERFACE_VERSION)
- my_free((uchar*)p->plugins, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(p->plugins);
}
@@ -665,7 +659,7 @@ SHOW_COMP_OPTION plugin_status(const char *name, int len, size_t type)
}
-static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO)
+static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc)
{
st_plugin_int *pi= plugin_ref_to_int(rc);
DBUG_ENTER("intern_plugin_lock");
@@ -687,7 +681,7 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO)
memory manager and/or valgrind to track locked references and
double unlocks to aid resolving reference counting problems.
*/
- if (!(plugin= (plugin_ref) my_malloc_ci(sizeof(pi), MYF(MY_WME))))
+ if (!(plugin= (plugin_ref) my_malloc(sizeof(pi), MYF(MY_WME))))
DBUG_RETURN(NULL);
*plugin= pi;
@@ -704,7 +698,7 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO)
}
-plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO)
+plugin_ref plugin_lock(THD *thd, plugin_ref *ptr)
{
LEX *lex= thd ? thd->lex : 0;
plugin_ref rc;
@@ -716,8 +710,7 @@ plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO)
}
-plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type
- CALLER_INFO_PROTO)
+plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type)
{
LEX *lex= thd ? thd->lex : 0;
plugin_ref rc= NULL;
@@ -978,7 +971,7 @@ static void intern_plugin_unlock(LEX *lex, plugin_ref plugin)
if (!pi->plugin_dl)
DBUG_VOID_RETURN;
#else
- my_free((uchar*) plugin, MYF(MY_WME));
+ my_free(plugin);
#endif
DBUG_PRINT("info",("unlocking plugin, name= %s, ref_count= %d",
@@ -1475,10 +1468,8 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
When building an embedded library, if the mysql.plugin table
does not exist, we silently ignore the missing table
*/
- mysql_mutex_lock(&LOCK_open);
if (check_if_table_exists(new_thd, &tables, &table_exists))
table_exists= FALSE;
- mysql_mutex_unlock(&LOCK_open);
if (!table_exists)
goto end;
#endif /* EMBEDDED_LIBRARY */
@@ -1519,7 +1510,7 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
if (error > 0)
sql_print_error(ER(ER_GET_ERRNO), my_errno);
end_read_record(&read_record_info);
- new_thd->version--; // Force close to free memory
+ table->m_needs_reopen= TRUE; // Force close to free memory
end:
close_thread_tables(new_thd);
/* Remember that we don't have a THD */
@@ -2252,7 +2243,7 @@ static void update_func_str(THD *thd, struct st_mysql_sys_var *var,
if (var->flags & PLUGIN_VAR_MEMALLOC)
{
*(char **)tgt= my_strdup(*(char **) save, MYF(0));
- my_free(old, MYF(0));
+ my_free(old);
}
}
@@ -2644,7 +2635,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars)
flags & PLUGIN_VAR_THDLOCAL && flags & PLUGIN_VAR_MEMALLOC)
{
char **ptr= (char**) pivar->real_value_ptr(thd, OPT_SESSION);
- my_free(*ptr, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
+ my_free(*ptr);
*ptr= NULL;
}
}
@@ -2652,7 +2643,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars)
DBUG_ASSERT(vars->table_plugin == NULL);
- my_free(vars->dynamic_variables_ptr, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(vars->dynamic_variables_ptr);
vars->dynamic_variables_ptr= NULL;
vars->dynamic_variables_size= 0;
vars->dynamic_variables_version= 0;
@@ -2713,7 +2704,7 @@ static void plugin_vars_free_values(sys_var *vars)
char **valptr= (char**) piv->real_value_ptr(NULL, OPT_GLOBAL);
DBUG_PRINT("plugin", ("freeing value for: '%s' addr: 0x%lx",
var->name.str, (long) valptr));
- my_free(*valptr, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
+ my_free(*valptr);
*valptr= NULL;
}
}
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h
index e7ecca029b9..079dc4e6dca 100644
--- a/sql/sql_plugin.h
+++ b/sql/sql_plugin.h
@@ -30,8 +30,6 @@
#include "m_string.h" /* LEX_STRING */
#include "my_alloc.h" /* MEM_ROOT */
-#include "my_sys.h" /* CALLER_INFO_PROTO */
-
class sys_var;
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
@@ -134,13 +132,13 @@ extern int plugin_init(int *argc, char **argv, int init_flags);
extern void plugin_shutdown(void);
void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root);
extern bool plugin_is_ready(const LEX_STRING *name, int type);
-#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C CALLER_INFO)
-#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO)
-#define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO)
-#define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO)
-extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO);
+#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C)
+#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C)
+#define my_plugin_lock(A,B) plugin_lock(A,B)
+#define my_plugin_lock_ci(A,B) plugin_lock(A,B)
+extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr);
extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name,
- int type CALLER_INFO_PROTO);
+ int type);
extern void plugin_unlock(THD *thd, plugin_ref plugin);
extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count);
extern bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 296fcf301d3..089e751900e 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -791,6 +791,19 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
}
#ifndef EMBEDDED_LIBRARY
+
+/**
+ Check whether this parameter data type is compatible with long data.
+ Used to detect whether a long data stream has been supplied to a
+ incompatible data type.
+*/
+inline bool is_param_long_data_type(Item_param *param)
+{
+ return ((param->param_type >= MYSQL_TYPE_TINY_BLOB) &&
+ (param->param_type <= MYSQL_TYPE_STRING));
+}
+
+
/**
Routines to assign parameters from data supplied by the client.
@@ -860,6 +873,14 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
DBUG_RETURN(1);
}
}
+ /*
+ A long data stream was supplied for this parameter marker.
+ This was done after prepare, prior to providing a placeholder
+ type (the types are supplied at execute). Check that the
+ supplied type of placeholder can accept a data stream.
+ */
+ else if (!is_param_long_data_type(param))
+ DBUG_RETURN(1);
res= param->query_val_str(&str);
if (param->convert_str_value(thd))
DBUG_RETURN(1); /* out of memory */
@@ -898,6 +919,14 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array,
DBUG_RETURN(1);
}
}
+ /*
+ A long data stream was supplied for this parameter marker.
+ This was done after prepare, prior to providing a placeholder
+ type (the types are supplied at execute). Check that the
+ supplied type of placeholder can accept a data stream.
+ */
+ else if (is_param_long_data_type(param))
+ DBUG_RETURN(1);
if (param->convert_str_value(stmt->thd))
DBUG_RETURN(1); /* out of memory */
}
@@ -1690,7 +1719,7 @@ static bool mysql_test_create_table(Prepared_statement *stmt)
for the prepare phase.
*/
create_table->open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
- create_table->lock_strategy= TABLE_LIST::SHARED_MDL;
+ create_table->lock_strategy= TABLE_LIST::OTLS_NONE;
if (select_lex->item_list.elements)
{
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index 8601b10b9bf..604890ffbe5 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -211,6 +211,11 @@ enum enum_var_type
class sys_var;
+enum enum_yes_no_unknown
+{
+ TVL_YES, TVL_NO, TVL_UNKNOWN
+};
+
#ifdef MYSQL_SERVER
#endif /* MYSQL_SERVER */
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
index 4a0d3d944ad..ce3d786cf92 100644
--- a/sql/sql_profile.cc
+++ b/sql/sql_profile.cc
@@ -177,8 +177,7 @@ PROF_MEASUREMENT::PROF_MEASUREMENT(QUERY_PROFILE *profile_arg,
PROF_MEASUREMENT::~PROF_MEASUREMENT()
{
- if (allocated_status_memory != NULL)
- my_free(allocated_status_memory, MYF(0));
+ my_free(allocated_status_memory);
status= function= file= NULL;
}
@@ -268,8 +267,7 @@ QUERY_PROFILE::~QUERY_PROFILE()
while (! entries.is_empty())
delete entries.pop();
- if (query_source != NULL)
- my_free(query_source, MYF(0));
+ my_free(query_source);
}
/**
diff --git a/sql/sql_profile.h b/sql/sql_profile.h
index ff16a2da19b..7d17dc69b88 100644
--- a/sql/sql_profile.h
+++ b/sql/sql_profile.h
@@ -82,7 +82,7 @@ public:
for (i= first; i != NULL; i= after_i)
{
after_i= i->next;
- my_free((char *) i, MYF(0));
+ my_free(i);
}
elements= 0;
}
@@ -129,7 +129,7 @@ public:
last= NULL;
first= first->next;
- my_free((char *)old_item, MYF(0));
+ my_free(old_item);
elements--;
return ret;
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index ea95b59b0c2..130a99a374f 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -29,6 +29,7 @@
// start_waiting_global_read_lock
#include "sql_base.h" // tdc_remove_table
#include "sql_handler.h" // mysql_ha_rm_tables
+#include "datadict.h"
static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
bool skip_error);
@@ -283,7 +284,7 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
build_table_filename(name, sizeof(name) - 1,
ren_table->db, old_alias, reg_ext, 0);
- frm_type= mysql_frm_type(thd, name, &table_type);
+ frm_type= dd_frm_type(thd, name, &table_type);
switch (frm_type)
{
case FRMTYPE_TABLE:
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 787f9dcae2c..5f994c09d6d 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -257,8 +257,7 @@ bool log_in_use(const char* log_name)
if ((linfo = tmp->current_linfo))
{
mysql_mutex_lock(&linfo->lock);
- result = !bcmp((uchar*) log_name, (uchar*) linfo->log_file_name,
- log_name_len);
+ result = !memcmp(log_name, linfo->log_file_name, log_name_len);
mysql_mutex_unlock(&linfo->lock);
if (result)
break;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 992fa8f6212..74d05780f81 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -137,7 +137,6 @@ static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list,
static COND *optimize_cond(JOIN *join, COND *conds,
List<TABLE_LIST> *join_list,
Item::cond_result *cond_value);
-static bool const_expression_in_where(COND *conds,Item *item, Item **comp_item);
static bool open_tmp_table(TABLE *table);
static bool create_myisam_tmp_table(TABLE *,TMP_TABLE_PARAM *, ulonglong, my_bool);
static int do_select(JOIN *join,List<Item> *fields,TABLE *tmp_table,
@@ -190,6 +189,14 @@ static COND *make_cond_for_table(COND *cond,table_map table,
table_map used_table);
static Item* part_of_refkey(TABLE *form,Field *field);
uint find_shortest_key(TABLE *table, const key_map *usable_keys);
+static bool test_if_cheaper_ordering(const JOIN_TAB *tab,
+ ORDER *order, TABLE *table,
+ key_map usable_keys, int key,
+ ha_rows select_limit,
+ int *new_key, int *new_key_direction,
+ ha_rows *new_select_limit,
+ uint *new_used_key_parts= NULL,
+ uint *saved_best_key_parts= NULL);
static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,
ha_rows select_limit, bool no_changes,
key_map *map);
@@ -586,13 +593,21 @@ JOIN::prepare(Item ***rref_pointer_array,
{
Item *item= *ord->item;
/*
- Disregard sort order if there's only "{VAR}CHAR(0) NOT NULL" fields
- there. Such fields don't contain any data to sort.
+ Disregard sort order if there's only
+ zero length NOT NULL fields (e.g. {VAR}CHAR(0) NOT NULL") or
+ zero length NOT NULL string functions there.
+ Such tuples don't contain any data to sort.
*/
if (!real_order &&
- (item->type() != Item::FIELD_ITEM ||
- ((Item_field *) item)->field->maybe_null() ||
- ((Item_field *) item)->field->sort_length()))
+ /* Not a zero length NOT NULL field */
+ ((item->type() != Item::FIELD_ITEM ||
+ ((Item_field *) item)->field->maybe_null() ||
+ ((Item_field *) item)->field->sort_length()) &&
+ /* AND not a zero length NOT NULL string function. */
+ (item->type() != Item::FUNC_ITEM ||
+ item->maybe_null ||
+ item->result_type() != STRING_RESULT ||
+ item->max_length)))
real_order= TRUE;
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
@@ -1146,7 +1161,7 @@ JOIN::optimize()
elements may be lost during further having
condition transformation in JOIN::exec.
*/
- if (having && const_table_map)
+ if (having && const_table_map && !having->with_sum_func)
{
having->update_used_tables();
having= remove_eq_conds(thd, having, &having_value);
@@ -6951,7 +6966,7 @@ void JOIN_TAB::cleanup()
select= 0;
delete quick;
quick= 0;
- x_free(cache.buff);
+ my_free(cache.buff);
cache.buff= 0;
limit= 0;
if (table)
@@ -7350,7 +7365,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
*simple_order=0; // Must do a temp table to sort
else if (!(order_tables & not_const_tables))
{
- if (order->item[0]->with_subselect)
+ if (order->item[0]->with_subselect &&
+ !(join->select_lex->options & SELECT_DESCRIBE))
order->item[0]->val_str(&order->item[0]->str_value);
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue; // skip const item
@@ -7361,8 +7377,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
*simple_order=0;
else
{
- Item *comp_item=0;
- if (cond && const_expression_in_where(cond,order->item[0], &comp_item))
+ if (cond && const_expression_in_where(cond,order->item[0]))
{
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue;
@@ -7392,6 +7407,46 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
}
+/**
+ Filter out ORDER items those are equal to constants in WHERE
+
+ This function is a limited version of remove_const() for use
+ with non-JOIN statements (i.e. single-table UPDATE and DELETE).
+
+
+ @param order Linked list of ORDER BY arguments
+ @param cond WHERE expression
+
+ @return pointer to new filtered ORDER list or NULL if whole list eliminated
+
+ @note
+ This function overwrites input order list.
+*/
+
+ORDER *simple_remove_const(ORDER *order, COND *where)
+{
+ if (!order || !where)
+ return order;
+
+ ORDER *first= NULL, *prev= NULL;
+ for (; order; order= order->next)
+ {
+ DBUG_ASSERT(!order->item[0]->with_sum_func); // should never happen
+ if (!const_expression_in_where(where, order->item[0]))
+ {
+ if (!first)
+ first= order;
+ if (prev)
+ prev->next= order;
+ prev= order;
+ }
+ }
+ if (prev)
+ prev->next= NULL;
+ return first;
+}
+
+
static int
return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
List<Item> &fields, bool send_row, ulonglong select_options,
@@ -8584,10 +8639,9 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
left_item->collation.collation == value->collation.collation))
{
Item *tmp=value->clone_item();
- tmp->collation.set(right_item->collation);
-
if (tmp)
{
+ tmp->collation.set(right_item->collation);
thd->change_item_tree(args + 1, tmp);
func->update_used_tables();
if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC)
@@ -8608,10 +8662,9 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
right_item->collation.collation == value->collation.collation))
{
Item *tmp= value->clone_item();
- tmp->collation.set(left_item->collation);
-
if (tmp)
{
+ tmp->collation.set(left_item->collation);
thd->change_item_tree(args, tmp);
value= tmp;
func->update_used_tables();
@@ -9593,13 +9646,50 @@ test_if_equality_guarantees_uniqueness(Item *l, Item *r)
l->collation.collation == r->collation.collation)));
}
-/**
- Return TRUE if the item is a const value in all the WHERE clause.
+
+/*
+ Return TRUE if i1 and i2 (if any) are equal items,
+ or if i1 is a wrapper item around the f2 field.
*/
-static bool
-const_expression_in_where(COND *cond, Item *comp_item, Item **const_item)
+static bool equal(Item *i1, Item *i2, Field *f2)
{
+ DBUG_ASSERT((i2 == NULL) ^ (f2 == NULL));
+
+ if (i2 != NULL)
+ return i1->eq(i2, 1);
+ else if (i1->type() == Item::FIELD_ITEM)
+ return f2->eq(((Item_field *) i1)->field);
+ else
+ return FALSE;
+}
+
+
+/**
+ Test if a field or an item is equal to a constant value in WHERE
+
+ @param cond WHERE clause expression
+ @param comp_item Item to find in WHERE expression
+ (if comp_field != NULL)
+ @param comp_field Field to find in WHERE expression
+ (if comp_item != NULL)
+ @param[out] const_item intermediate arg, set to Item pointer to NULL
+
+ @return TRUE if the field is a constant value in WHERE
+
+ @note
+ comp_item and comp_field parameters are mutually exclusive.
+*/
+bool
+const_expression_in_where(COND *cond, Item *comp_item, Field *comp_field,
+ Item **const_item)
+{
+ DBUG_ASSERT((comp_item == NULL) ^ (comp_field == NULL));
+
+ Item *intermediate= NULL;
+ if (const_item == NULL)
+ const_item= &intermediate;
+
if (cond->type() == Item::COND_ITEM)
{
bool and_level= (((Item_cond*) cond)->functype()
@@ -9608,7 +9698,8 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item)
Item *item;
while ((item=li++))
{
- bool res=const_expression_in_where(item, comp_item, const_item);
+ bool res=const_expression_in_where(item, comp_item, comp_field,
+ const_item);
if (res) // Is a const value
{
if (and_level)
@@ -9620,14 +9711,14 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item)
return and_level ? 0 : 1;
}
else if (cond->eq_cmp_result() != Item::COND_OK)
- { // boolan compare function
+ { // boolean compare function
Item_func* func= (Item_func*) cond;
if (func->functype() != Item_func::EQUAL_FUNC &&
func->functype() != Item_func::EQ_FUNC)
return 0;
Item *left_item= ((Item_func*) cond)->arguments()[0];
Item *right_item= ((Item_func*) cond)->arguments()[1];
- if (left_item->eq(comp_item,1))
+ if (equal(left_item, comp_item, comp_field))
{
if (test_if_equality_guarantees_uniqueness (left_item, right_item))
{
@@ -9637,7 +9728,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item)
return 1;
}
}
- else if (right_item->eq(comp_item,1))
+ else if (equal(right_item, comp_item, comp_field))
{
if (test_if_equality_guarantees_uniqueness (right_item, left_item))
{
@@ -9651,6 +9742,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item)
return 0;
}
+
/****************************************************************************
Create internal temporary table
****************************************************************************/
@@ -11849,38 +11941,30 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last)
SQL_SELECT *select=join_tab->select;
if (rc == NESTED_LOOP_OK)
{
- bool consider_record= !join_tab->cache.select ||
- !join_tab->cache.select->skip_record();
-
- /*
- Check for error: skip_record() can execute code by calling
- Item_subselect::val_*. We need to check for errors (if any)
- after such call.
- */
- if (join->thd->is_error())
+ bool skip_record= FALSE;
+ if (join_tab->cache.select &&
+ join_tab->cache.select->skip_record(join->thd, &skip_record))
{
reset_cache_write(&join_tab->cache);
return NESTED_LOOP_ERROR;
}
- if (consider_record)
+ if (!skip_record)
{
uint i;
reset_cache_read(&join_tab->cache);
for (i=(join_tab->cache.records- (skip_last ? 1 : 0)) ; i-- > 0 ;)
{
read_cached_record(join_tab);
- if (!select || !select->skip_record())
+ skip_record= FALSE;
+ if (select && select->skip_record(join->thd, &skip_record))
{
- /*
- Check for error: skip_record() can execute code by calling
- Item_subselect::val_*. We need to check for errors (if any)
- after such call.
- */
- if (join->thd->is_error())
- rc= NESTED_LOOP_ERROR;
- else
- rc= (join_tab->next_select)(join,join_tab+1,0);
+ reset_cache_write(&join_tab->cache);
+ return NESTED_LOOP_ERROR;
+ }
+ if (!skip_record)
+ {
+ rc= (join_tab->next_select)(join,join_tab+1,0);
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
{
reset_cache_write(&join_tab->cache);
@@ -13104,7 +13188,8 @@ part_of_refkey(TABLE *table,Field *field)
@param order Sort order
@param table Table to sort
@param idx Index to check
- @param used_key_parts Return value for used key parts.
+ @param used_key_parts [out] NULL by default, otherwise return value for
+ used key parts.
@note
@@ -13123,13 +13208,14 @@ part_of_refkey(TABLE *table,Field *field)
*/
static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
- uint *used_key_parts)
+ uint *used_key_parts= NULL)
{
KEY_PART_INFO *key_part,*key_part_end;
key_part=table->key_info[idx].key_part;
key_part_end=key_part+table->key_info[idx].key_parts;
key_part_map const_key_parts=table->const_key_parts[idx];
int reverse=0;
+ uint key_parts;
my_bool on_pk_suffix= FALSE;
DBUG_ENTER("test_if_order_by_key");
@@ -13170,8 +13256,9 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
*/
if (key_part == key_part_end && reverse == 0)
{
- *used_key_parts= 0;
- DBUG_RETURN(1);
+ key_parts= 0;
+ reverse= 1;
+ goto ok;
}
}
else
@@ -13194,7 +13281,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
uint used_key_parts_secondary= table->key_info[idx].key_parts;
uint used_key_parts_pk=
(uint) (key_part - table->key_info[table->s->primary_key].key_part);
- *used_key_parts= used_key_parts_pk + used_key_parts_secondary;
+ key_parts= used_key_parts_pk + used_key_parts_secondary;
if (reverse == -1 &&
(!(table->file->index_flags(idx, used_key_parts_secondary - 1, 1) &
@@ -13205,11 +13292,14 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
}
else
{
- *used_key_parts= (uint) (key_part - table->key_info[idx].key_part);
+ key_parts= (uint) (key_part - table->key_info[idx].key_part);
if (reverse == -1 &&
- !(table->file->index_flags(idx, *used_key_parts-1, 1) & HA_READ_PREV))
+ !(table->file->index_flags(idx, key_parts-1, 1) & HA_READ_PREV))
reverse= 0; // Index can't be used
}
+ok:
+ if (used_key_parts != NULL)
+ *used_key_parts= key_parts;
DBUG_RETURN(reverse);
}
@@ -13303,7 +13393,6 @@ test_if_subkey(ORDER *order, TABLE *table, uint ref, uint ref_key_parts,
uint nr;
uint min_length= (uint) ~0;
uint best= MAX_KEY;
- uint not_used;
KEY_PART_INFO *ref_key_part= table->key_info[ref].key_part;
KEY_PART_INFO *ref_key_part_end= ref_key_part + ref_key_parts;
@@ -13314,7 +13403,7 @@ test_if_subkey(ORDER *order, TABLE *table, uint ref, uint ref_key_parts,
table->key_info[nr].key_parts >= ref_key_parts &&
is_subkey(table->key_info[nr].key_part, ref_key_part,
ref_key_part_end) &&
- test_if_order_by_key(order, table, nr, &not_used))
+ test_if_order_by_key(order, table, nr))
{
min_length= table->key_info[nr].key_length;
best= nr;
@@ -13606,183 +13695,18 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
goto check_reverse_order;
}
{
- /*
- Check whether there is an index compatible with the given order
- usage of which is cheaper than usage of the ref_key index (ref_key>=0)
- or a table scan.
- It may be the case if ORDER/GROUP BY is used with LIMIT.
- */
- uint nr;
- key_map keys;
uint best_key_parts= 0;
+ uint saved_best_key_parts= 0;
int best_key_direction= 0;
- ha_rows best_records= 0;
- double read_time;
int best_key= -1;
- bool is_best_covering= FALSE;
- double fanout= 1;
JOIN *join= tab->join;
- uint tablenr= tab - join->join_tab;
ha_rows table_records= table->file->stats.records;
- bool group= join->group && order == join->group_list;
- ha_rows ref_key_quick_rows= HA_POS_ERROR;
-
- /*
- If not used with LIMIT, only use keys if the whole query can be
- resolved with a key; This is because filesort() is usually faster than
- retrieving all rows through an index.
- */
- if (select_limit >= table_records)
- {
- keys= *table->file->keys_to_use_for_scanning();
- keys.merge(table->covering_keys);
-
- /*
- We are adding here also the index specified in FORCE INDEX clause,
- if any.
- This is to allow users to use index in ORDER BY.
- */
- if (table->force_index)
- keys.merge(group ? table->keys_in_use_for_group_by :
- table->keys_in_use_for_order_by);
- keys.intersect(usable_keys);
- }
- else
- keys= usable_keys;
-
- if (ref_key >= 0 && table->covering_keys.is_set(ref_key))
- ref_key_quick_rows= table->quick_rows[ref_key];
-
- read_time= join->best_positions[tablenr].read_time;
- for (uint i= tablenr+1; i < join->tables; i++)
- fanout*= join->best_positions[i].records_read; // fanout is always >= 1
-
- for (nr=0; nr < table->s->keys ; nr++)
- {
- int direction;
- if (keys.is_set(nr) &&
- (direction= test_if_order_by_key(order, table, nr, &used_key_parts)))
- {
- /*
- At this point we are sure that ref_key is a non-ordering
- key (where "ordering key" is a key that will return rows
- in the order required by ORDER BY).
- */
- DBUG_ASSERT (ref_key != (int) nr);
-
- bool is_covering= table->covering_keys.is_set(nr) ||
- (nr == table->s->primary_key &&
- table->file->primary_key_is_clustered());
-
- /*
- Don't use an index scan with ORDER BY without limit.
- For GROUP BY without limit always use index scan
- if there is a suitable index.
- Why we hold to this asymmetry hardly can be explained
- rationally. It's easy to demonstrate that using
- temporary table + filesort could be cheaper for grouping
- queries too.
- */
- if (is_covering ||
- select_limit != HA_POS_ERROR ||
- (ref_key < 0 && (group || table->force_index)))
- {
- double rec_per_key;
- double index_scan_time;
- KEY *keyinfo= tab->table->key_info+nr;
- if (select_limit == HA_POS_ERROR)
- select_limit= table_records;
- if (group)
- {
- /*
- Used_key_parts can be larger than keyinfo->key_parts
- when using a secondary index clustered with a primary
- key (e.g. as in Innodb).
- See Bug #28591 for details.
- */
- rec_per_key= used_key_parts &&
- used_key_parts <= keyinfo->key_parts ?
- keyinfo->rec_per_key[used_key_parts-1] : 1;
- set_if_bigger(rec_per_key, 1);
- /*
- With a grouping query each group containing on average
- rec_per_key records produces only one row that will
- be included into the result set.
- */
- if (select_limit > table_records/rec_per_key)
- select_limit= table_records;
- else
- select_limit= (ha_rows) (select_limit*rec_per_key);
- }
- /*
- If tab=tk is not the last joined table tn then to get first
- L records from the result set we can expect to retrieve
- only L/fanout(tk,tn) where fanout(tk,tn) says how many
- rows in the record set on average will match each row tk.
- Usually our estimates for fanouts are too pessimistic.
- So the estimate for L/fanout(tk,tn) will be too optimistic
- and as result we'll choose an index scan when using ref/range
- access + filesort will be cheaper.
- */
- select_limit= (ha_rows) (select_limit < fanout ?
- 1 : select_limit/fanout);
- /*
- We assume that each of the tested indexes is not correlated
- with ref_key. Thus, to select first N records we have to scan
- N/selectivity(ref_key) index entries.
- selectivity(ref_key) = #scanned_records/#table_records =
- table->quick_condition_rows/table_records.
- In any case we can't select more than #table_records.
- N/(table->quick_condition_rows/table_records) > table_records
- <=> N > table->quick_condition_rows.
- */
- if (select_limit > table->quick_condition_rows)
- select_limit= table_records;
- else
- select_limit= (ha_rows) (select_limit *
- (double) table_records /
- table->quick_condition_rows);
- rec_per_key= keyinfo->rec_per_key[keyinfo->key_parts-1];
- set_if_bigger(rec_per_key, 1);
- /*
- Here we take into account the fact that rows are
- accessed in sequences rec_per_key records in each.
- Rows in such a sequence are supposed to be ordered
- by rowid/primary key. When reading the data
- in a sequence we'll touch not more pages than the
- table file contains.
- TODO. Use the formula for a disk sweep sequential access
- to calculate the cost of accessing data rows for one
- index entry.
- */
- index_scan_time= select_limit/rec_per_key *
- min(rec_per_key, table->file->scan_time());
- if ((ref_key < 0 && is_covering) ||
- (ref_key < 0 && (group || table->force_index)) ||
- index_scan_time < read_time)
- {
- ha_rows quick_records= table_records;
- if ((is_best_covering && !is_covering) ||
- (is_covering && ref_key_quick_rows < select_limit))
- continue;
- if (table->quick_keys.is_set(nr))
- quick_records= table->quick_rows[nr];
- if (best_key < 0 ||
- (select_limit <= min(quick_records,best_records) ?
- keyinfo->key_parts < best_key_parts :
- quick_records < best_records))
- {
- best_key= nr;
- best_key_parts= keyinfo->key_parts;
- best_records= quick_records;
- is_best_covering= is_covering;
- best_key_direction= direction;
- }
- }
- }
- }
- }
+ test_if_cheaper_ordering(tab, order, table, usable_keys,
+ ref_key, select_limit,
+ &best_key, &best_key_direction,
+ &select_limit, &best_key_parts,
+ &saved_best_key_parts);
/*
filesort() and join cache are usually faster than reading in
@@ -13861,8 +13785,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
}
}
- used_key_parts= best_key_parts;
order_direction= best_key_direction;
+ /*
+ saved_best_key_parts is actual number of used keyparts found by the
+ test_if_order_by_key function. It could differ from keyinfo->key_parts,
+ thus we have to restore it in case of desc order as it affects
+ QUICK_SELECT_DESC behaviour.
+ */
+ used_key_parts= (order_direction == -1) ?
+ saved_best_key_parts : best_key_parts;
}
else
DBUG_RETURN(0);
@@ -13879,7 +13810,7 @@ check_reverse_order:
*/
if (!select->quick->reverse_sorted())
{
- QUICK_SELECT_DESC *tmp;
+ QUICK_SELECT_I *tmp;
int quick_type= select->quick->get_type();
if (quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE ||
quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT ||
@@ -13892,16 +13823,14 @@ check_reverse_order:
}
/* ORDER BY range_key DESC */
- tmp= new QUICK_SELECT_DESC((QUICK_RANGE_SELECT*)(select->quick),
- used_key_parts);
- if (!tmp || tmp->error)
+ tmp= select->quick->make_reverse(used_key_parts);
+ if (!tmp)
{
- delete tmp;
select->quick= save_quick;
tab->limit= 0;
DBUG_RETURN(0); // Reverse sort not supported
}
- select->quick=tmp;
+ select->set_quick(tmp);
}
}
else if (tab->type != JT_NEXT && tab->type != JT_REF_OR_NULL &&
@@ -14333,7 +14262,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
if (my_hash_init(&hash, &my_charset_bin, (uint) file->stats.records, 0,
key_length, (my_hash_get_key) 0, 0, 0))
{
- my_free((char*) key_buffer,MYF(0));
+ my_free(key_buffer);
DBUG_RETURN(1);
}
@@ -14385,14 +14314,14 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
}
key_pos+=extra_length;
}
- my_free((char*) key_buffer,MYF(0));
+ my_free(key_buffer);
my_hash_free(&hash);
file->extra(HA_EXTRA_NO_CACHE);
(void) file->ha_rnd_end();
DBUG_RETURN(0);
err:
- my_free((char*) key_buffer,MYF(0));
+ my_free(key_buffer);
my_hash_free(&hash);
file->extra(HA_EXTRA_NO_CACHE);
(void) file->ha_rnd_end();
@@ -14475,7 +14404,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
sizeof(CACHE_FIELD*))))
{
- my_free((uchar*) cache->buff,MYF(0)); /* purecov: inspected */
+ my_free(cache->buff); /* purecov: inspected */
cache->buff=0; /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
@@ -17439,5 +17368,357 @@ void JOIN::cache_const_exprs()
/**
+ Find a cheaper access key than a given @a key
+
+ @param tab NULL or JOIN_TAB of the accessed table
+ @param order Linked list of ORDER BY arguments
+ @param table Table if tab == NULL or tab->table
+ @param usable_keys Key map to find a cheaper key in
+ @param ref_key
+ * 0 <= key < MAX_KEY - key number (hint) to start the search
+ * -1 - no key number provided
+ @param select_limit LIMIT value
+ @param [out] new_key Key number if success, otherwise undefined
+ @param [out] new_key_direction Return -1 (reverse) or +1 if success,
+ otherwise undefined
+ @param [out] new_select_limit Return adjusted LIMIT
+ @param [out] new_used_key_parts NULL by default, otherwise return number
+ of new_key prefix columns if success
+ or undefined if the function fails
+ @param [out] saved_best_key_parts NULL by default, otherwise preserve the
+ value for further use in QUICK_SELECT_DESC
+
+ @note
+ This function takes into account table->quick_condition_rows statistic
+ (that is calculated by the make_join_statistics function).
+ However, single table procedures such as mysql_update() and mysql_delete()
+ never call make_join_statistics, so they have to update it manually
+ (@see get_index_for_order()).
+*/
+
+static bool
+test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
+ key_map usable_keys, int ref_key,
+ ha_rows select_limit,
+ int *new_key, int *new_key_direction,
+ ha_rows *new_select_limit, uint *new_used_key_parts,
+ uint *saved_best_key_parts)
+{
+ DBUG_ENTER("test_if_cheaper_ordering");
+ /*
+ Check whether there is an index compatible with the given order
+ usage of which is cheaper than usage of the ref_key index (ref_key>=0)
+ or a table scan.
+ It may be the case if ORDER/GROUP BY is used with LIMIT.
+ */
+ ha_rows best_select_limit= HA_POS_ERROR;
+ JOIN *join= tab ? tab->join : NULL;
+ uint nr;
+ key_map keys;
+ uint best_key_parts= 0;
+ int best_key_direction= 0;
+ ha_rows best_records= 0;
+ double read_time;
+ int best_key= -1;
+ bool is_best_covering= FALSE;
+ double fanout= 1;
+ ha_rows table_records= table->file->stats.records;
+ bool group= join && join->group && order == join->group_list;
+ ha_rows ref_key_quick_rows= HA_POS_ERROR;
+
+ /*
+ If not used with LIMIT, only use keys if the whole query can be
+ resolved with a key; This is because filesort() is usually faster than
+ retrieving all rows through an index.
+ */
+ if (select_limit >= table_records)
+ {
+ keys= *table->file->keys_to_use_for_scanning();
+ keys.merge(table->covering_keys);
+
+ /*
+ We are adding here also the index specified in FORCE INDEX clause,
+ if any.
+ This is to allow users to use index in ORDER BY.
+ */
+ if (table->force_index)
+ keys.merge(group ? table->keys_in_use_for_group_by :
+ table->keys_in_use_for_order_by);
+ keys.intersect(usable_keys);
+ }
+ else
+ keys= usable_keys;
+
+ if (ref_key >= 0 && table->covering_keys.is_set(ref_key))
+ ref_key_quick_rows= table->quick_rows[ref_key];
+
+ if (join)
+ {
+ uint tablenr= tab - join->join_tab;
+ read_time= join->best_positions[tablenr].read_time;
+ for (uint i= tablenr+1; i < join->tables; i++)
+ fanout*= join->best_positions[i].records_read; // fanout is always >= 1
+ }
+ else
+ read_time= table->file->scan_time();
+
+ for (nr=0; nr < table->s->keys ; nr++)
+ {
+ int direction;
+ uint used_key_parts;
+
+ if (keys.is_set(nr) &&
+ (direction= test_if_order_by_key(order, table, nr, &used_key_parts)))
+ {
+ /*
+ At this point we are sure that ref_key is a non-ordering
+ key (where "ordering key" is a key that will return rows
+ in the order required by ORDER BY).
+ */
+ DBUG_ASSERT (ref_key != (int) nr);
+
+ bool is_covering= table->covering_keys.is_set(nr) ||
+ (nr == table->s->primary_key &&
+ table->file->primary_key_is_clustered());
+
+ /*
+ Don't use an index scan with ORDER BY without limit.
+ For GROUP BY without limit always use index scan
+ if there is a suitable index.
+ Why we hold to this asymmetry hardly can be explained
+ rationally. It's easy to demonstrate that using
+ temporary table + filesort could be cheaper for grouping
+ queries too.
+ */
+ if (is_covering ||
+ select_limit != HA_POS_ERROR ||
+ (ref_key < 0 && (group || table->force_index)))
+ {
+ double rec_per_key;
+ double index_scan_time;
+ KEY *keyinfo= table->key_info+nr;
+ if (select_limit == HA_POS_ERROR)
+ select_limit= table_records;
+ if (group)
+ {
+ /*
+ Used_key_parts can be larger than keyinfo->key_parts
+ when using a secondary index clustered with a primary
+ key (e.g. as in Innodb).
+ See Bug #28591 for details.
+ */
+ rec_per_key= used_key_parts &&
+ used_key_parts <= keyinfo->key_parts ?
+ keyinfo->rec_per_key[used_key_parts-1] : 1;
+ set_if_bigger(rec_per_key, 1);
+ /*
+ With a grouping query each group containing on average
+ rec_per_key records produces only one row that will
+ be included into the result set.
+ */
+ if (select_limit > table_records/rec_per_key)
+ select_limit= table_records;
+ else
+ select_limit= (ha_rows) (select_limit*rec_per_key);
+ }
+ /*
+ If tab=tk is not the last joined table tn then to get first
+ L records from the result set we can expect to retrieve
+ only L/fanout(tk,tn) where fanout(tk,tn) says how many
+ rows in the record set on average will match each row tk.
+ Usually our estimates for fanouts are too pessimistic.
+ So the estimate for L/fanout(tk,tn) will be too optimistic
+ and as result we'll choose an index scan when using ref/range
+ access + filesort will be cheaper.
+ */
+ select_limit= (ha_rows) (select_limit < fanout ?
+ 1 : select_limit/fanout);
+ /*
+ We assume that each of the tested indexes is not correlated
+ with ref_key. Thus, to select first N records we have to scan
+ N/selectivity(ref_key) index entries.
+ selectivity(ref_key) = #scanned_records/#table_records =
+ table->quick_condition_rows/table_records.
+ In any case we can't select more than #table_records.
+ N/(table->quick_condition_rows/table_records) > table_records
+ <=> N > table->quick_condition_rows.
+ */
+ if (select_limit > table->quick_condition_rows)
+ select_limit= table_records;
+ else
+ select_limit= (ha_rows) (select_limit *
+ (double) table_records /
+ table->quick_condition_rows);
+ rec_per_key= keyinfo->rec_per_key[keyinfo->key_parts-1];
+ set_if_bigger(rec_per_key, 1);
+ /*
+ Here we take into account the fact that rows are
+ accessed in sequences rec_per_key records in each.
+ Rows in such a sequence are supposed to be ordered
+ by rowid/primary key. When reading the data
+ in a sequence we'll touch not more pages than the
+ table file contains.
+ TODO. Use the formula for a disk sweep sequential access
+ to calculate the cost of accessing data rows for one
+ index entry.
+ */
+ index_scan_time= select_limit/rec_per_key *
+ min(rec_per_key, table->file->scan_time());
+ if ((ref_key < 0 && is_covering) ||
+ (ref_key < 0 && (group || table->force_index)) ||
+ index_scan_time < read_time)
+ {
+ ha_rows quick_records= table_records;
+ if ((is_best_covering && !is_covering) ||
+ (is_covering && ref_key_quick_rows < select_limit))
+ continue;
+ if (table->quick_keys.is_set(nr))
+ quick_records= table->quick_rows[nr];
+ if (best_key < 0 ||
+ (select_limit <= min(quick_records,best_records) ?
+ keyinfo->key_parts < best_key_parts :
+ quick_records < best_records))
+ {
+ best_key= nr;
+ best_key_parts= keyinfo->key_parts;
+ if (saved_best_key_parts)
+ *saved_best_key_parts= used_key_parts;
+ best_records= quick_records;
+ is_best_covering= is_covering;
+ best_key_direction= direction;
+ best_select_limit= select_limit;
+ }
+ }
+ }
+ }
+ }
+
+ if (best_key < 0 || best_key == ref_key)
+ DBUG_RETURN(FALSE);
+
+ *new_key= best_key;
+ *new_key_direction= best_key_direction;
+ *new_select_limit= best_select_limit;
+ if (new_used_key_parts != NULL)
+ *new_used_key_parts= best_key_parts;
+
+ DBUG_RETURN(TRUE);
+}
+
+
+/**
+ Find a key to apply single table UPDATE/DELETE by a given ORDER
+
+ @param order Linked list of ORDER BY arguments
+ @param table Table to find a key
+ @param select Pointer to access/update select->quick (if any)
+ @param limit LIMIT clause parameter
+ @param [out] need_sort TRUE if filesort needed
+ @param [out] reverse
+ TRUE if the key is reversed again given ORDER (undefined if key == MAX_KEY)
+
+ @return
+ - MAX_KEY if no key found (need_sort == TRUE)
+ - MAX_KEY if quick select result order is OK (need_sort == FALSE)
+ - key number (either index scan or quick select) (need_sort == FALSE)
+
+ @note
+ Side effects:
+ - may deallocate or deallocate and replace select->quick;
+ - may set table->quick_condition_rows and table->quick_rows[...]
+ to table->file->stats.records.
+*/
+
+uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select,
+ ha_rows limit, bool *need_sort, bool *reverse)
+{
+ if (select && select->quick && select->quick->unique_key_range())
+ { // Single row select (always "ordered"): Ok to use with key field UPDATE
+ *need_sort= FALSE;
+ /*
+ Returning of MAX_KEY here prevents updating of used_key_is_modified
+ in mysql_update(). Use quick select "as is".
+ */
+ return MAX_KEY;
+ }
+
+ if (!order)
+ {
+ *need_sort= FALSE;
+ if (select && select->quick)
+ return select->quick->index; // index or MAX_KEY, use quick select as is
+ else
+ return table->file->key_used_on_scan; // MAX_KEY or index for some engines
+ }
+
+ if (!is_simple_order(order)) // just to cut further expensive checks
+ {
+ *need_sort= TRUE;
+ return MAX_KEY;
+ }
+
+ if (select && select->quick)
+ {
+ if (select->quick->index == MAX_KEY)
+ {
+ *need_sort= TRUE;
+ return MAX_KEY;
+ }
+
+ uint used_key_parts;
+ switch (test_if_order_by_key(order, table, select->quick->index,
+ &used_key_parts)) {
+ case 1: // desired order
+ *need_sort= FALSE;
+ return select->quick->index;
+ case 0: // unacceptable order
+ *need_sort= TRUE;
+ return MAX_KEY;
+ case -1: // desired order, but opposite direction
+ {
+ QUICK_SELECT_I *reverse_quick;
+ if ((reverse_quick=
+ select->quick->make_reverse(used_key_parts)))
+ {
+ select->set_quick(reverse_quick);
+ *need_sort= FALSE;
+ return select->quick->index;
+ }
+ else
+ {
+ *need_sort= TRUE;
+ return MAX_KEY;
+ }
+ }
+ }
+ DBUG_ASSERT(0);
+ }
+ else if (limit != HA_POS_ERROR)
+ { // check if some index scan & LIMIT is more efficient than filesort
+
+ /*
+ Update quick_condition_rows since single table UPDATE/DELETE procedures
+ don't call make_join_statistics() and leave this variable uninitialized.
+ */
+ table->quick_condition_rows= table->file->stats.records;
+
+ int key, direction;
+ if (test_if_cheaper_ordering(NULL, order, table,
+ table->keys_in_use_for_order_by, -1,
+ limit,
+ &key, &direction, &limit) &&
+ !is_key_used(table, key, table->write_set))
+ {
+ *need_sort= FALSE;
+ *reverse= (direction < 0);
+ return key;
+ }
+ }
+ *need_sort= TRUE;
+ return MAX_KEY;
+}
+
+
+/**
@} (end of group Query_Optimizer)
*/
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 2c44dba74c3..0496870bb3f 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -847,4 +847,12 @@ inline bool optimizer_flag(THD *thd, uint flag)
return (thd->variables.optimizer_switch & flag);
}
+uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select,
+ ha_rows limit, bool *need_sort, bool *reverse);
+ORDER *simple_remove_const(ORDER *order, COND *where);
+bool const_expression_in_where(COND *cond, Item *comp_item,
+ Field *comp_field= NULL,
+ Item **const_item= NULL);
+
+
#endif /* SQL_SELECT_INCLUDED */
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 99073ced693..a8ae5832a2a 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -18,7 +18,6 @@
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
-#include "debug_sync.h"
#include "unireg.h"
#include "sql_acl.h" // fill_schema_*_privileges
#include "sql_select.h" // For select_describe
@@ -28,7 +27,6 @@
// primary_key_name,
// build_table_filename
#include "repl_failsafe.h"
-#include "sql_view.h" // mysql_frm_type
#include "sql_parse.h" // check_access, check_table_access
#include "sql_partition.h" // partition_element
#include "sql_db.h" // check_db_dir_existence, load_db_opt_by_name
@@ -50,8 +48,9 @@
#include "event_data_objects.h"
#endif
#include <my_dir.h>
-#include "debug_sync.h"
#include "lock.h" // MYSQL_OPEN_IGNORE_FLUSH
+#include "debug_sync.h"
+#include "datadict.h" // dd_frm_type()
#define STR_OR_NIL(S) ((S) ? (S) : "<nil>")
@@ -1354,7 +1353,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE "));
packet->append(for_str, strlen(for_str));
packet->append(STRING_WITH_LEN(" STORAGE DISK */"));
- my_free(for_str, MYF(0));
+ my_free(for_str);
}
/*
@@ -1496,7 +1495,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
table->part_info->set_show_version_string(packet);
packet->append(part_syntax, part_syntax_len);
packet->append(STRING_WITH_LEN(" */"));
- my_free(part_syntax, MYF(0));
+ my_free(part_syntax);
}
}
#endif
@@ -2129,8 +2128,8 @@ static bool show_status_array(THD *thd, const char *wild,
bool ucase_names,
COND *cond)
{
- MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, long);
- char * const buff= (char *) &buff_data;
+ my_aligned_storage<SHOW_VAR_FUNC_BUFF_SIZE, MY_ALIGNOF(long)> buffer;
+ char * const buff= buffer.data;
char *prefix_end;
/* the variable name should not be longer than 64 characters */
char name_buffer[64];
@@ -2366,7 +2365,7 @@ int make_table_list(THD *thd, SELECT_LEX *sel,
Table_ident *table_ident;
table_ident= new Table_ident(thd, *db_name, *table_name, 1);
sel->init_query();
- if (!sel->add_table_to_list(thd, table_ident, 0, 0, TL_READ))
+ if (!sel->add_table_to_list(thd, table_ident, 0, 0, TL_READ, MDL_SHARED_READ))
return 1;
return 0;
}
@@ -2627,36 +2626,54 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
{
LEX *lex= thd->lex;
const char *wild= lex->wild ? lex->wild->ptr() : NullS;
+ bool rc= 0;
+
bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES));
switch (lex->sql_command) {
case SQLCOM_SHOW_DATABASES:
if (wild)
{
- lookup_field_values->db_value.str= (char*) wild;
- lookup_field_values->db_value.length= strlen(wild);
+ thd->make_lex_string(&lookup_field_values->db_value,
+ wild, strlen(wild), 0);
lookup_field_values->wild_db_value= 1;
}
- return 0;
+ break;
case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_TRIGGERS:
case SQLCOM_SHOW_EVENTS:
- lookup_field_values->db_value.str= lex->select_lex.db;
- lookup_field_values->db_value.length=strlen(lex->select_lex.db);
+ thd->make_lex_string(&lookup_field_values->db_value,
+ lex->select_lex.db, strlen(lex->select_lex.db), 0);
if (wild)
{
- lookup_field_values->table_value.str= (char*)wild;
- lookup_field_values->table_value.length= strlen(wild);
+ thd->make_lex_string(&lookup_field_values->table_value,
+ wild, strlen(wild), 0);
lookup_field_values->wild_table_value= 1;
}
- return 0;
+ break;
default:
/*
The "default" is for queries over I_S.
All previous cases handle SHOW commands.
*/
- return calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
+ rc= calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
+ break;
+ }
+
+ if (lower_case_table_names && !rc)
+ {
+ /*
+ We can safely do in-place upgrades here since all of the above cases
+ are allocating a new memory buffer for these strings.
+ */
+ if (lookup_field_values->db_value.str && lookup_field_values->db_value.str[0])
+ my_casedn_str(system_charset_info, lookup_field_values->db_value.str);
+ if (lookup_field_values->table_value.str &&
+ lookup_field_values->table_value.str[0])
+ my_casedn_str(system_charset_info, lookup_field_values->table_value.str);
}
+
+ return rc;
}
@@ -2858,9 +2875,15 @@ make_table_name_list(THD *thd, List<LEX_STRING> *table_names, LEX *lex,
{
if (with_i_schema)
{
- if (find_schema_table(thd, lookup_field_vals->table_value.str))
+ LEX_STRING *name;
+ ST_SCHEMA_TABLE *schema_table=
+ find_schema_table(thd, lookup_field_vals->table_value.str);
+ if (schema_table && !schema_table->hidden)
{
- if (table_names->push_back(&lookup_field_vals->table_value))
+ if (!(name=
+ thd->make_lex_string(NULL, schema_table->table_name,
+ strlen(schema_table->table_name), TRUE)) ||
+ table_names->push_back(name))
return 1;
}
}
@@ -2966,6 +2989,9 @@ fill_schema_show_cols_or_idxs(THD *thd, TABLE_LIST *tables,
(can_deadlock ?
MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)));
lex->sql_command= save_sql_command;
+
+ DEBUG_SYNC(thd, "after_open_table_ignore_flush");
+
/*
get_all_tables() returns 1 on failure and 0 on success thus
return only these and not the result code of ::process_table()
@@ -3025,7 +3051,7 @@ static int fill_schema_table_names(THD *thd, TABLE *table,
char path[FN_REFLEN + 1];
(void) build_table_filename(path, sizeof(path) - 1, db_name->str,
table_name->str, reg_ext, 0);
- switch (mysql_frm_type(thd, path, &not_used)) {
+ switch (dd_frm_type(thd, path, &not_used)) {
case FRMTYPE_ERROR:
table->field[3]->store(STRING_WITH_LEN("ERROR"),
system_charset_info);
@@ -3133,15 +3159,27 @@ try_acquire_high_prio_shared_mdl_lock(THD *thd, TABLE_LIST *table,
bool error;
table->mdl_request.init(MDL_key::TABLE, table->db, table->table_name,
MDL_SHARED_HIGH_PRIO);
- while (!(error=
- thd->mdl_context.try_acquire_lock(&table->mdl_request)) &&
- !table->mdl_request.ticket && !can_deadlock)
+
+ if (can_deadlock)
{
- if ((error=
- thd->mdl_context.wait_for_lock(&table->mdl_request,
- thd->variables.lock_wait_timeout)))
- break;
+ /*
+ When .FRM is being open in order to get data for an I_S table,
+ we might have some tables not only open but also locked.
+ E.g. this happens when a SHOW or I_S statement is run
+ under LOCK TABLES or inside a stored function.
+ By waiting for the conflicting metadata lock to go away we
+ might create a deadlock which won't entirely belong to the
+ MDL subsystem and thus won't be detectable by this subsystem's
+ deadlock detector. To avoid such situation, when there are
+ other locked tables, we prefer not to wait on a conflicting
+ lock.
+ */
+ error= thd->mdl_context.try_acquire_lock(&table->mdl_request);
}
+ else
+ error= thd->mdl_context.acquire_lock(&table->mdl_request,
+ thd->variables.lock_wait_timeout);
+
return error;
}
@@ -3309,7 +3347,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
res= schema_table->process_table(thd, &table_list, table,
res, db_name, table_name);
free_root(&tbl.mem_root, MYF(0));
- my_free((char*) tbl.alias, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((void *) tbl.alias);
}
end_share:
@@ -3425,6 +3463,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
error= 0;
goto err;
}
+
DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
STR_OR_NIL(lookup_field_vals.db_value.str),
STR_OR_NIL(lookup_field_vals.table_value.str)));
@@ -3983,10 +4022,13 @@ void store_column_type(TABLE *table, Field *field, CHARSET_INFO *cs,
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
- case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_INT24:
field_length= field->max_display_length() - 1;
break;
+ case MYSQL_TYPE_LONGLONG:
+ field_length= field->max_display_length() -
+ ((field->flags & UNSIGNED_FLAG) ? 0 : 1);
+ break;
case MYSQL_TYPE_BIT:
field_length= field->max_display_length();
decimals= -1; // return NULL
@@ -5361,7 +5403,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
if(ts)
{
table->field[24]->store(ts, strlen(ts), cs);
- my_free(ts, MYF(0));
+ my_free(ts);
}
else
table->field[24]->set_null();
@@ -6568,7 +6610,7 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
strlen(schema_table->table_name), 0);
if (schema_table->old_format(thd, schema_table) || /* Handle old syntax */
!sel->add_table_to_list(thd, new Table_ident(thd, db, table, 0),
- 0, 0, TL_READ))
+ 0, 0, TL_READ, MDL_SHARED_READ))
{
DBUG_RETURN(1);
}
@@ -7456,7 +7498,7 @@ int initialize_schema_table(st_plugin_int *plugin)
sql_print_error("Plugin '%s' init function returned error.",
plugin->name.str);
plugin->data= NULL;
- my_free(schema_table, MYF(0));
+ my_free(schema_table);
DBUG_RETURN(1);
}
@@ -7479,7 +7521,7 @@ int finalize_schema_table(st_plugin_int *plugin)
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
}
- my_free(schema_table, MYF(0));
+ my_free(schema_table);
}
DBUG_RETURN(0);
}
diff --git a/sql/sql_string.h b/sql/sql_string.h
index debfb7aa9c6..0ce67108423 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -205,7 +205,7 @@ public:
{
alloced=0;
Alloced_length=0;
- my_free(Ptr,MYF(0));
+ my_free(Ptr);
Ptr=0;
str_length=0; /* Safety */
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index dce23d1c09c..d28b4859ab5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -27,8 +27,8 @@
// start_waiting_global_read_lock,
// unlock_table_names, mysql_unlock_tables
#include "strfunc.h" // find_type2, find_set
-#include "sql_view.h" // mysql_frm_type, view_checksum, mysql_frm_type
-#include "sql_delete.h" // mysql_truncate
+#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
@@ -52,6 +52,7 @@
#include "sql_show.h"
#include "transaction.h"
#include "keycaches.h"
+#include "datadict.h" // dd_frm_type()
#ifdef __WIN__
#include <io.h>
@@ -84,19 +85,6 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
HA_CREATE_INFO *create_info,
Alter_info *alter_info);
-#ifndef DBUG_OFF
-
-/* Wait until we get a 'mysql_kill' signal */
-
-static void wait_for_kill_signal(THD *thd)
-{
- while (thd->killed == 0)
- sleep(1);
- // Reset signal and continue as if nothing happend
- thd->killed= THD::NOT_KILLED;
-}
-#endif
-
/**
@brief Helper function for explain_filename
@@ -1546,13 +1534,13 @@ void release_ddl_log()
while (used_list)
{
DDL_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry;
- my_free(used_list, MYF(0));
+ my_free(used_list);
used_list= tmp;
}
while (free_list)
{
DDL_LOG_MEMORY_ENTRY *tmp= free_list->next_log_entry;
- my_free(free_list, MYF(0));
+ my_free(free_list);
free_list= tmp;
}
close_ddl_log();
@@ -1708,8 +1696,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
if (readfrm(shadow_path, &data, &length) ||
packfrm(data, length, &lpt->pack_frm_data, &lpt->pack_frm_len))
{
- my_free(data, MYF(MY_ALLOW_ZERO_PTR));
- my_free(lpt->pack_frm_data, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(data);
+ my_free(lpt->pack_frm_data);
mem_alloc_error(length);
error= 1;
goto end;
@@ -2125,7 +2113,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
((access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias)) ||
(!drop_view &&
- mysql_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
+ dd_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
{
// Table was not found on disk and table can't be created from engine
if (if_exists)
@@ -2145,7 +2133,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
*/
if (frm_db_type == DB_TYPE_UNKNOWN)
{
- mysql_frm_type(thd, path, &frm_db_type);
+ dd_frm_type(thd, path, &frm_db_type);
DBUG_PRINT("info", ("frm_db_type %d from %s", frm_db_type, path));
}
table_type= ha_resolve_by_legacy_type(thd, frm_db_type);
@@ -2214,7 +2202,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (some_tables_deleted || tmp_table_deleted || !error)
{
query_cache_invalidate3(thd, tables, 0);
- if (!dont_log_query)
+ if (!dont_log_query && mysql_bin_log.is_open())
{
if (!thd->is_current_stmt_binlog_format_row() ||
(non_temp_tables_count > 0 && !tmp_table_deleted))
@@ -4454,10 +4442,10 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
char from[FN_REFLEN],tmp[FN_REFLEN+32];
const char **ext;
MY_STAT stat_info;
- Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+ Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_OPEN_HAS_MDL_LOCK |
+ MYSQL_LOCK_IGNORE_TIMEOUT));
DBUG_ENTER("prepare_for_repair");
- uint reopen_for_repair_flags= (MYSQL_OPEN_IGNORE_FLUSH |
- MYSQL_OPEN_HAS_MDL_LOCK);
if (!(check_opt->sql_flags & TT_USEFRM))
DBUG_RETURN(0);
@@ -4586,12 +4574,18 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
"Failed renaming data file");
goto end;
}
- if (mysql_truncate(thd, table_list, 1))
+ 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",
@@ -4606,8 +4600,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
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_unused, reopen_for_repair_flags))
+ 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");
@@ -4685,6 +4678,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
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;
@@ -4706,8 +4707,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (view_operator_func == NULL)
table->required_type=FRMTYPE_TABLE;
- open_error= open_and_lock_tables(thd, table, TRUE,
- MYSQL_OPEN_TAKE_UPGRADABLE_MDL);
+ 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;
@@ -4864,18 +4864,31 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
/* purecov: end */
}
- /* Close all instances of the table to allow repair to rename files */
- if (lock_type == TL_WRITE && table->table->s->version)
+ /*
+ 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;
- DBUG_EXECUTE_IF("wait_in_mysql_admin_table",
- wait_for_kill_signal(thd);
- if (thd->killed)
- 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;
}
@@ -4917,6 +4930,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
*/
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;
}
}
@@ -5047,12 +5062,14 @@ send_result_message:
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);
@@ -5134,20 +5151,25 @@ send_result_message:
}
if (table->table)
{
- if (fatal_error)
- table->table->s->version=0; // Force close of table
- else if (open_for_modify)
+ if (table->table->s->tmp_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
- {
- TABLE_LIST *save_next_global= table->next_global;
- table->next_global= 0;
- close_cached_tables(thd, table, FALSE, FALSE);
- table->next_global= save_next_global;
- }
- /* May be something modified consequently we have to invalidate cache */
+ }
+ 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);
}
}
@@ -5388,7 +5410,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
char buf[2048];
String query(buf, sizeof(buf), system_charset_info);
query.length(0); // Have to zero it since constructor doesn't
- Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+ Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
/*
The condition avoids a crash as described in BUG#48506. Other
@@ -5403,8 +5425,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
to work. The table will be closed by close_thread_table() at
the end of this branch.
*/
- if (open_table(thd, table, thd->mem_root, &ot_ctx_unused,
- MYSQL_OPEN_REOPEN))
+ if (open_table(thd, table, thd->mem_root, &ot_ctx))
goto err;
int result __attribute__((unused))=
@@ -5416,14 +5437,12 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
goto err;
DBUG_ASSERT(thd->open_tables == table->table);
- mysql_mutex_lock(&LOCK_open);
/*
When opening the table, we ignored the locked tables
(MYSQL_OPEN_GET_NEW_TABLE). Now we can close the table without
risking to close some locked table.
*/
close_thread_table(thd, &thd->open_tables);
- mysql_mutex_unlock(&LOCK_open);
}
}
else // Case 1
@@ -5490,6 +5509,7 @@ mysql_discard_or_import_tablespace(THD *thd,
not complain when we lock the table
*/
thd->tablespace_op= TRUE;
+ table_list->mdl_request.set_type(MDL_SHARED_WRITE);
if (!(table=open_ltable(thd, table_list, TL_WRITE, 0)))
{
thd->tablespace_op=FALSE;
@@ -6467,8 +6487,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
char reg_path[FN_REFLEN+1];
ha_rows copied,deleted;
handlerton *old_db_type, *new_db_type, *save_old_db_type;
- legacy_db_type table_type;
- frm_type_enum frm_type;
enum_alter_table_change_level need_copy_table= ALTER_TABLE_METADATA_ONLY;
#ifdef WITH_PARTITION_STORAGE_ENGINE
uint fast_alter_partition= 0;
@@ -6548,85 +6566,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* Conditionally writes to binlog. */
DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
alter_info->tablespace_op));
- strxnmov(new_name_buff, sizeof (new_name_buff) - 1, mysql_data_home, "/", db,
- "/", table_name, reg_ext, NullS);
- (void) unpack_filename(new_name_buff, new_name_buff);
- /*
- If this is just a rename of a view, short cut to the
- following scenario: 1) lock LOCK_open 2) do a RENAME
- 2) unlock LOCK_open.
- This is a copy-paste added to make sure
- ALTER (sic:) TABLE .. RENAME works for views. ALTER VIEW is handled
- as an independent branch in mysql_execute_command. The need
- for a copy-paste arose because the main code flow of ALTER TABLE
- ... RENAME tries to use open_ltable, which does not work for views
- (open_ltable was never modified to merge table lists of child tables
- into the main table list, like open_tables does).
- This code is wrong and will be removed, please do not copy.
- */
- frm_type= mysql_frm_type(thd, new_name_buff, &table_type);
- /* Rename a view */
- /* Sic: there is a race here */
- if (frm_type == FRMTYPE_VIEW && !(alter_info->flags & ~ALTER_RENAME))
- {
- /*
- The following branch handles "ALTER VIEW v1 /no arguments/;"
- This feature is not documented one.
- However, before "OPTIMIZE TABLE t1;" was implemented,
- ALTER TABLE with no alter_specifications was used to force-rebuild
- the table. That's why this grammar is allowed. That's why we ignore
- it for views. So just do nothing in such a case.
- */
- if (!new_name)
- {
- my_ok(thd);
- DBUG_RETURN(FALSE);
- }
-
- /*
- Avoid problems with a rename on a table that we have locked or
- if the user is trying to to do this in a transcation context
- */
-
- if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction())
- {
- my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
- ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
- DBUG_RETURN(TRUE);
- }
-
- if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
- DBUG_RETURN(TRUE);
- if (lock_table_names(thd, table_list))
- {
- error= 1;
- goto view_err;
- }
-
- mysql_mutex_lock(&LOCK_open);
-
- if (!do_rename(thd, table_list, new_db, new_name, new_name, 1))
- {
- if (mysql_bin_log.is_open())
- {
- thd->clear_error();
- Query_log_event qinfo(thd, thd->query(), thd->query_length(),
- FALSE, TRUE, FALSE, 0);
- if ((error= mysql_bin_log.write(&qinfo)))
- goto view_err_unlock;
- }
- my_ok(thd);
- }
-
-view_err_unlock:
- mysql_mutex_unlock(&LOCK_open);
- unlock_table_names(thd);
-
-view_err:
- thd->global_read_lock.start_waiting_global_read_lock(thd);
- DBUG_RETURN(error);
- }
-
/*
Code below can handle only base tables so ensure that we won't open a view.
@@ -6637,8 +6576,7 @@ view_err:
Alter_table_prelocking_strategy alter_prelocking_strategy(alter_info);
- error= open_and_lock_tables(thd, table_list, FALSE,
- MYSQL_OPEN_TAKE_UPGRADABLE_MDL,
+ error= open_and_lock_tables(thd, table_list, FALSE, 0,
&alter_prelocking_strategy);
if (error)
@@ -7241,14 +7179,14 @@ view_err:
{
if (table->s->tmp_table)
{
- Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+ Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_LOCK_IGNORE_TIMEOUT));
TABLE_LIST tbl;
bzero((void*) &tbl, sizeof(tbl));
tbl.db= new_db;
tbl.table_name= tbl.alias= tmp_name;
/* Table is in thd->temporary_tables */
- (void) open_table(thd, &tbl, thd->mem_root, &ot_ctx_unused,
- MYSQL_OPEN_IGNORE_FLUSH);
+ (void) open_table(thd, &tbl, thd->mem_root, &ot_ctx);
new_table= tbl.table;
}
else
@@ -7401,12 +7339,22 @@ view_err:
if (table->s->tmp_table != NO_TMP_TABLE)
{
/* Close lock if this is a transactional table */
- if (thd->lock &&
- ! (thd->locked_tables_mode == LTM_LOCK_TABLES ||
- thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES))
+ if (thd->lock)
{
- mysql_unlock_tables(thd, thd->lock);
- thd->lock=0;
+ if (thd->locked_tables_mode != LTM_LOCK_TABLES &&
+ thd->locked_tables_mode != LTM_PRELOCKED_UNDER_LOCK_TABLES)
+ {
+ mysql_unlock_tables(thd, thd->lock);
+ thd->lock=0;
+ }
+ else
+ {
+ /*
+ If LOCK TABLES list is not empty and contains this table,
+ unlock the table and remove the table from this list.
+ */
+ mysql_lock_remove(thd, thd->lock, table);
+ }
}
/* Remove link to old table and rename the new one */
close_temporary_table(thd, table, 1, 1);
@@ -7527,7 +7475,7 @@ view_err:
To do this we need to obtain a handler object for it.
NO need to tamper with MERGE tables. The real open is done later.
*/
- Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+ Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
TABLE *t_table;
if (new_name != table_name || new_db != db)
{
@@ -7547,8 +7495,7 @@ view_err:
*/
table_list->mdl_request.ticket= mdl_ticket;
}
- if (open_table(thd, table_list, thd->mem_root,
- &ot_ctx_unused, MYSQL_OPEN_REOPEN))
+ if (open_table(thd, table_list, thd->mem_root, &ot_ctx))
{
goto err_with_mdl;
}
@@ -7559,9 +7506,7 @@ view_err:
create_info);
DBUG_ASSERT(thd->open_tables == t_table);
- mysql_mutex_lock(&LOCK_open);
close_thread_table(thd, &thd->open_tables);
- mysql_mutex_unlock(&LOCK_open);
table_list->table= 0;
if (error)
@@ -7599,7 +7544,7 @@ view_err:
if (t_table)
{
intern_close_table(t_table);
- my_free(t_table, MYF(0));
+ my_free(t_table);
}
else
sql_print_warning("Could not open table %s.%s after rename\n",
@@ -7940,6 +7885,10 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list)
table_list->table= NULL;
/* Same applies to MDL ticket. */
table_list->mdl_request.ticket= NULL;
+ /* Set lock type which is appropriate for ALTER TABLE. */
+ table_list->lock_type= TL_READ_NO_INSERT;
+ /* Same applies to MDL request. */
+ table_list->mdl_request.set_type(MDL_SHARED_NO_WRITE);
bzero((char*) &create_info, sizeof(create_info));
create_info.row_type=ROW_TYPE_NOT_USED;
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 43d203e6498..501c4cf6a94 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -45,7 +45,6 @@ static const char *lock_descriptions[] =
/* TL_READ_HIGH_PRIORITY */ "High priority read lock",
/* TL_READ_NO_INSERT */ "Read lock without concurrent inserts",
/* TL_WRITE_ALLOW_WRITE */ "Write lock that allows other writers",
- /* TL_WRITE_ALLOW_READ */ "Write lock, but allow reading",
/* TL_WRITE_CONCURRENT_INSERT */ "Concurrent insert lock",
/* TL_WRITE_DELAYED */ "Lock used by delayed insert",
/* TL_WRITE_DEFAULT */ NULL,
@@ -556,11 +555,6 @@ Next alarm time: %lu\n",
#endif
display_table_locks();
fflush(stdout);
- my_checkmalloc();
- fprintf(stdout,"\nBegin safemalloc memory dump:\n"); // tag needed for test suite
- TERMINATE(stdout, 1); // Write malloc information
- fprintf(stdout,"\nEnd safemalloc memory dump.\n");
- fflush(stdout);
#ifdef HAVE_MALLINFO
struct mallinfo info= mallinfo();
printf("\nMemory status:\n\
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index c3266b5cbe2..2f084c369b6 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -489,8 +489,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
else
{
tables->table= open_n_lock_single_table(thd, tables,
- TL_WRITE_ALLOW_READ,
- MYSQL_OPEN_TAKE_UPGRADABLE_MDL);
+ TL_READ_NO_INSERT, 0);
if (! tables->table)
goto end;
tables->table->use_all_columns();
@@ -1666,7 +1665,8 @@ bool add_table_for_trigger(THD *thd,
DBUG_RETURN(TRUE);
*table= sp_add_to_query_tables(thd, lex, trg_name->m_db.str,
- tbl_name.str, TL_IGNORE);
+ tbl_name.str, TL_IGNORE,
+ MDL_SHARED_NO_WRITE);
DBUG_RETURN(*table ? FALSE : TRUE);
}
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
new file mode 100644
index 00000000000..c2482ef1ce0
--- /dev/null
+++ b/sql/sql_truncate.cc
@@ -0,0 +1,485 @@
+/* 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_truncate.h"
+#include "sql_priv.h"
+#include "transaction.h"
+#include "debug_sync.h"
+#include "records.h" // READ_RECORD
+#include "table.h" // TABLE
+#include "sql_class.h" // THD
+#include "sql_base.h" // open_and_lock_tables
+#include "sql_table.h" // write_bin_log
+#include "sql_handler.h" // mysql_ha_rm_tables
+#include "datadict.h" // dd_recreate_table()
+#include "lock.h" // MYSQL_OPEN_TEMPORARY_ONLY
+
+
+/*
+ Delete all rows of a locked table.
+
+ @param thd Thread context.
+ @param table_list Table list element for the table.
+ @param rows_deleted Whether rows might have been deleted.
+
+ @retval FALSE Success.
+ @retval TRUE Error.
+*/
+
+static bool
+delete_all_rows(THD *thd, TABLE *table)
+{
+ int error;
+ READ_RECORD info;
+ bool is_bulk_delete;
+ bool some_rows_deleted= FALSE;
+ bool save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
+ DBUG_ENTER("delete_all_rows");
+
+ /* Replication of truncate table must be statement based. */
+ thd->clear_current_stmt_binlog_format_row();
+
+ /*
+ Update handler statistics (e.g. table->file->stats.records).
+ Might be used by the storage engine to aggregate information
+ necessary to allow deletion. Currently, this seems to be
+ meaningful only to the archive storage engine, which uses
+ the info method to set the number of records. Although
+ archive does not support deletion, it becomes necessary in
+ order to return a error if the table is not empty.
+ */
+ error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+ if (error && error != HA_ERR_WRONG_COMMAND)
+ {
+ table->file->print_error(error, MYF(0));
+ goto end;
+ }
+
+ /*
+ Attempt to delete all rows in the table.
+ If it is unsupported, switch to row by row deletion.
+ */
+ if (! (error= table->file->ha_delete_all_rows()))
+ goto end;
+
+ if (error != HA_ERR_WRONG_COMMAND)
+ {
+ /*
+ If a transactional engine fails in the middle of deletion,
+ we expect it to be able to roll it back. Some reasons
+ for the engine to fail would be media failure or corrupted
+ data dictionary (i.e. in case of a partitioned table). We
+ have sufficiently strong metadata locks to rule out any
+ potential deadlocks.
+
+ If a non-transactional engine fails here (that would
+ not be MyISAM, since MyISAM does TRUNCATE by recreate),
+ and binlog is on, replication breaks, since nothing gets
+ written to the binary log. (XXX: is this a bug?)
+ */
+ table->file->print_error(error, MYF(0));
+ goto end;
+ }
+
+ /*
+ A workaround for Bug#53696 "Performance schema engine violates the
+ PSEA API by calling my_error()".
+ */
+ if (thd->is_error())
+ goto end;
+
+ /* Handler didn't support fast delete. Delete rows one by one. */
+
+ init_read_record(&info, thd, table, NULL, TRUE, TRUE, FALSE);
+
+ /*
+ Start bulk delete. If the engine does not support it, go on,
+ it's not an error.
+ */
+ is_bulk_delete= ! table->file->start_bulk_delete();
+
+ table->mark_columns_needed_for_delete();
+
+ while (!(error= info.read_record(&info)) && !thd->killed)
+ {
+ if ((error= table->file->ha_delete_row(table->record[0])))
+ {
+ table->file->print_error(error, MYF(0));
+ break;
+ }
+
+ some_rows_deleted= TRUE;
+ }
+
+ /* HA_ERR_END_OF_FILE */
+ if (error == -1)
+ error= 0;
+
+ /* Close down the bulk delete. */
+ if (is_bulk_delete)
+ {
+ int bulk_delete_error= table->file->end_bulk_delete();
+ if (bulk_delete_error && !error)
+ {
+ table->file->print_error(bulk_delete_error, MYF(0));
+ error= bulk_delete_error;
+ }
+ }
+
+ end_read_record(&info);
+
+ /*
+ Regardless of the error status, the query must be written to the
+ binary log if rows of the table is non-transactional.
+ */
+ if (some_rows_deleted && !table->file->has_transactions())
+ {
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
+ thd->transaction.all.modified_non_trans_table= TRUE;
+ }
+
+ if (error || thd->killed)
+ goto end;
+
+ /* Truncate resets the auto-increment counter. */
+ error= table->file->ha_reset_auto_increment(0);
+ if (error)
+ {
+ if (error != HA_ERR_WRONG_COMMAND)
+ table->file->print_error(error, MYF(0));
+ else
+ error= 0;
+ }
+
+end:
+ if (save_binlog_row_based)
+ thd->set_current_stmt_binlog_format_row();
+
+ DBUG_RETURN(error);
+}
+
+
+/*
+ Close and recreate a temporary table. In case of success,
+ write truncate statement into the binary log if in statement
+ mode.
+
+ @param thd Thread context.
+ @param table The temporary table.
+
+ @retval FALSE Success.
+ @retval TRUE Error.
+*/
+
+static bool recreate_temporary_table(THD *thd, TABLE *table)
+{
+ bool error= TRUE;
+ TABLE_SHARE *share= table->s;
+ HA_CREATE_INFO create_info;
+ handlerton *table_type= table->s->db_type();
+ DBUG_ENTER("recreate_temporary_table");
+
+ memset(&create_info, 0, sizeof(create_info));
+
+ table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
+
+ /* Don't free share. */
+ close_temporary_table(thd, table, FALSE, FALSE);
+
+ /*
+ We must use share->normalized_path.str since for temporary tables it
+ differs from what dd_recreate_table() would generate based
+ on table and schema names.
+ */
+ ha_create_table(thd, share->normalized_path.str, share->db.str,
+ share->table_name.str, &create_info, 1);
+
+ if (open_temporary_table(thd, share->path.str, share->db.str,
+ share->table_name.str, 1))
+ {
+ error= FALSE;
+ thd->thread_specific_used= TRUE;
+ }
+ else
+ rm_temporary_table(table_type, share->path.str);
+
+ free_table_share(share);
+ my_free(table);
+
+ DBUG_RETURN(error);
+}
+
+
+/*
+ Handle opening and locking if a base table for truncate.
+
+ @param[in] thd Thread context.
+ @param[in] table_ref Table list element for the table to
+ be truncated.
+ @param[out] hton_can_recreate Set to TRUE if table can be dropped
+ and recreated.
+ @param[out] ticket_downgrade Set if a lock must be downgraded after
+ truncate is done.
+
+ @retval FALSE Success.
+ @retval TRUE Error.
+*/
+
+static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
+ bool *hton_can_recreate,
+ MDL_ticket **ticket_downgrade)
+{
+ TABLE *table= NULL;
+ MDL_ticket *mdl_ticket= NULL;
+ DBUG_ENTER("open_and_lock_table_for_truncate");
+
+ /*
+ Before doing anything else, acquire a metadata lock on the table,
+ or ensure we have one. We don't use open_and_lock_tables()
+ right away because we want to be able to truncate (and recreate)
+ corrupted tables, those that we can't fully open.
+
+ MySQL manual documents that TRUNCATE can be used to repair a
+ damaged table, i.e. a table that can not be fully "opened".
+ In particular MySQL manual says: As long as the table format
+ file tbl_name.frm is valid, the table can be re-created as
+ an empty table with TRUNCATE TABLE, even if the data or index
+ files have become corrupted.
+ */
+ if (thd->locked_tables_mode)
+ {
+ if (!(table= find_table_for_mdl_upgrade(thd->open_tables, table_ref->db,
+ table_ref->table_name, FALSE)))
+ DBUG_RETURN(TRUE);
+
+ *hton_can_recreate= ha_check_storage_engine_flag(table->s->db_type(),
+ HTON_CAN_RECREATE);
+ }
+ else
+ {
+ /*
+ 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_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))
+ DBUG_RETURN(TRUE);
+ }
+
+ DEBUG_SYNC(thd, "lock_table_for_truncate");
+
+ if (*hton_can_recreate)
+ {
+ /*
+ Acquire an exclusive lock. The storage engine can recreate the
+ table only if there are no references to it from anywhere, i.e.
+ no cached TABLE in the table cache. To remove the table from the
+ cache we need an exclusive lock.
+ */
+ if (thd->locked_tables_mode)
+ {
+ if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
+ DBUG_RETURN(TRUE);
+ *ticket_downgrade= table->mdl_ticket;
+ close_all_tables_for_name(thd, table->s, FALSE);
+ }
+ else
+ {
+ ulong timeout= thd->variables.lock_wait_timeout;
+ if (thd->mdl_context.upgrade_shared_lock_to_exclusive(mdl_ticket, timeout))
+ DBUG_RETURN(TRUE);
+ mysql_mutex_lock(&LOCK_open);
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table_ref->db,
+ table_ref->table_name);
+ mysql_mutex_unlock(&LOCK_open);
+ }
+ }
+ else
+ {
+ /*
+ Can't recreate, we must mechanically delete all rows in
+ the table. Our metadata lock guarantees that no transaction
+ is reading or writing into the table. Yet, to open a write
+ cursor we need a thr_lock lock. Use open_and_lock_tables()
+ to do the necessary job.
+ */
+
+ /* Allow to open base tables only. */
+ 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);
+
+ /*
+ Open the table as it will handle some required preparations.
+ Ignore pending FLUSH TABLES since we don't want to release
+ the MDL lock taken above and otherwise there is no way to
+ wait for FLUSH TABLES in deadlock-free fashion.
+ */
+ if (open_and_lock_tables(thd, table_ref, FALSE,
+ MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_OPEN_SKIP_TEMPORARY))
+ DBUG_RETURN(TRUE);
+ }
+
+ DBUG_RETURN(FALSE);
+}
+
+
+/*
+ Optimized delete of all rows by doing a full generate of the table.
+
+ @remark Will work even if the .MYI and .MYD files are destroyed.
+ In other words, it works as long as the .FRM is intact and
+ the engine supports re-create.
+
+ @param thd Thread context.
+ @param table_ref Table list element for the table to be truncated.
+
+ @retval FALSE Success.
+ @retval TRUE Error.
+*/
+
+bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref)
+{
+ TABLE *table;
+ bool error= TRUE, binlog_stmt;
+ MDL_ticket *mdl_ticket= NULL;
+ DBUG_ENTER("mysql_truncate_table");
+
+ /* Remove tables from the HANDLER's hash. */
+ mysql_ha_rm_tables(thd, table_ref);
+
+ /* If it is a temporary table, no need to take locks. */
+ if ((table= find_temporary_table(thd, table_ref)))
+ {
+ /* In RBR, the statement is not binlogged if the table is temporary. */
+ binlog_stmt= !thd->is_current_stmt_binlog_format_row();
+
+ /* Note that a temporary table cannot be partitioned. */
+ if (ha_check_storage_engine_flag(table->s->db_type(), HTON_CAN_RECREATE))
+ {
+ if ((error= recreate_temporary_table(thd, table)))
+ binlog_stmt= FALSE; /* No need to binlog failed truncate-by-recreate. */
+
+ DBUG_ASSERT(! thd->transaction.stmt.modified_non_trans_table);
+ }
+ else
+ {
+ /*
+ The engine does not support truncate-by-recreate. Open the
+ table and delete all rows. In such a manner this can in fact
+ open several tables if it's a temporary MyISAMMRG table.
+ */
+ if (open_and_lock_tables(thd, table_ref, FALSE,
+ MYSQL_OPEN_TEMPORARY_ONLY))
+ DBUG_RETURN(TRUE);
+
+ error= delete_all_rows(thd, table_ref->table);
+ }
+
+ /*
+ No need to invalidate the query cache, queries with temporary
+ tables are not in the cache. No need to write to the binary
+ log a failed row-by-row delete even if under RBR as the table
+ might not exist on the slave.
+ */
+ }
+ else /* It's not a temporary table. */
+ {
+ bool hton_can_recreate;
+
+ if (open_and_lock_table_for_truncate(thd, table_ref,
+ &hton_can_recreate, &mdl_ticket))
+ DBUG_RETURN(TRUE);
+
+ if (hton_can_recreate)
+ {
+ /*
+ The storage engine can truncate the table by creating an
+ empty table with the same structure.
+ */
+ error= dd_recreate_table(thd, table_ref->db, table_ref->table_name);
+
+ if (thd->locked_tables_mode && thd->locked_tables_list.reopen_tables(thd))
+ thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
+
+ /* No need to binlog a failed truncate-by-recreate. */
+ binlog_stmt= !error;
+ }
+ else
+ {
+ error= delete_all_rows(thd, table_ref->table);
+
+ /*
+ Regardless of the error status, the query must be written to the
+ binary log if rows of a non-transactional table were deleted.
+ */
+ binlog_stmt= !error || thd->transaction.stmt.modified_non_trans_table;
+ }
+
+ query_cache_invalidate3(thd, table_ref, FALSE);
+ }
+
+ /* DDL is logged in statement format, regardless of binlog format. */
+ if (binlog_stmt)
+ error|= write_bin_log(thd, !error, thd->query(), thd->query_length());
+
+ /*
+ All effects of a TRUNCATE TABLE operation are rolled back if a row
+ by row deletion fails. Otherwise, it is automatically committed at
+ the end.
+ */
+ if (error)
+ {
+ trans_rollback_stmt(thd);
+ trans_rollback(thd);
+ }
+
+ /*
+ A locked table ticket was upgraded to a exclusive lock. After the
+ the query has been written to the binary log, downgrade the lock
+ to a shared one.
+ */
+ if (mdl_ticket)
+ mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_NO_READ_WRITE);
+
+ DBUG_PRINT("exit", ("error: %d", error));
+ DBUG_RETURN(test(error));
+}
+
diff --git a/include/help_end.h b/sql/sql_truncate.h
index 92953efe35a..11c07c7187c 100644
--- a/include/help_end.h
+++ b/sql/sql_truncate.h
@@ -1,7 +1,6 @@
-#ifndef HELP_END_INCLUDED
-#define HELP_END_INCLUDED
-
-/* Copyright (C) 2004-2005 MySQL AB
+#ifndef SQL_TRUNCATE_INCLUDED
+#define SQL_TRUNCATE_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
@@ -14,13 +13,11 @@
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 */
+
+class THD;
+struct TABLE_LIST;
+
+bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref);
-#ifdef __NETWARE__
-#undef printf
-#undef puts
-#undef fputs
-#undef fputc
-#undef putchar
#endif
-#endif /* HELP_END_INCLUDED */
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 9ec17a67533..3d197303fb1 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -248,7 +248,7 @@ void udf_init()
if (error > 0)
sql_print_error("Got unknown error: %d", my_errno);
end_read_record(&read_record_info);
- new_thd->version--; // Force close to free memory
+ table->m_needs_reopen= TRUE; // Force close to free memory
end:
close_thread_tables(new_thd);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 127368cef5c..c52467531a9 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -203,12 +203,13 @@ int mysql_update(THD *thd,
{
bool using_limit= limit != HA_POS_ERROR;
bool safe_update= test(thd->variables.option_bits & OPTION_SAFE_UPDATES);
- bool used_key_is_modified, transactional_table, will_batch;
+ bool used_key_is_modified= FALSE, transactional_table, will_batch;
bool can_compare_record;
int res;
int error, loc_error;
- uint used_index= MAX_KEY, dup_key_found;
+ uint used_index, dup_key_found;
bool need_sort= TRUE;
+ bool reverse= FALSE;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint want_privilege;
#endif
@@ -358,11 +359,7 @@ int mysql_update(THD *thd,
my_ok(thd); // No matching records
DBUG_RETURN(0);
}
- if (!select && limit != HA_POS_ERROR)
- {
- if ((used_index= get_index_for_order(table, order, limit)) != MAX_KEY)
- need_sort= FALSE;
- }
+
/* If running in safe sql mode, don't allow updates without keys */
if (table->quick_keys.is_clear_all())
{
@@ -378,24 +375,20 @@ int mysql_update(THD *thd,
table->mark_columns_needed_for_update();
- /* Check if we are modifying a key that we are used to search with */
-
- if (select && select->quick)
- {
- used_index= select->quick->index;
- used_key_is_modified= (!select->quick->unique_key_range() &&
- select->quick->is_keys_used(table->write_set));
+ table->update_const_key_parts(conds);
+ order= simple_remove_const(order, conds);
+
+ used_index= get_index_for_order(order, table, select, limit,
+ &need_sort, &reverse);
+ if (need_sort)
+ { // Assign table scan index to check below for modified key fields:
+ used_index= table->file->key_used_on_scan;
}
- else
- {
- used_key_is_modified= 0;
- if (used_index == MAX_KEY) // no index for sort order
- used_index= table->file->key_used_on_scan;
- if (used_index != MAX_KEY)
- used_key_is_modified= is_key_used(table, used_index, table->write_set);
+ if (used_index != MAX_KEY)
+ { // Check if we are modifying a key that we are used to search with:
+ used_key_is_modified= is_key_used(table, used_index, table->write_set);
}
-
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (used_key_is_modified || order ||
partition_key_modified(table, table->write_set))
@@ -414,7 +407,7 @@ int mysql_update(THD *thd,
table->use_all_columns();
}
- /* note: We avoid sorting avoid if we sort on the used index */
+ /* note: We avoid sorting if we sort on the used index */
if (order && (need_sort || used_key_is_modified))
{
/*
@@ -476,7 +469,7 @@ int mysql_update(THD *thd,
if (used_index == MAX_KEY || (select && select->quick))
init_read_record(&info, thd, table, select, 0, 1, FALSE);
else
- init_read_record_idx(&info, thd, table, 1, used_index);
+ init_read_record_idx(&info, thd, table, 1, used_index, reverse);
thd_proc_info(thd, "Searching rows for update");
ha_rows tmp_limit= limit;
@@ -484,7 +477,14 @@ int mysql_update(THD *thd,
while (!(error=info.read_record(&info)) && !thd->killed)
{
thd->examined_row_count++;
- if (!(select && select->skip_record()))
+ bool skip_record= FALSE;
+ if (select && select->skip_record(thd, &skip_record))
+ {
+ error= 1;
+ table->file->unlock_row();
+ break;
+ }
+ if (!skip_record)
{
if (table->file->was_semi_consistent_read())
continue; /* repeat the read of the same row if it still exists */
@@ -591,7 +591,8 @@ int mysql_update(THD *thd,
while (!(error=info.read_record(&info)) && !thd->killed)
{
thd->examined_row_count++;
- if (!(select && select->skip_record()))
+ bool skip_record;
+ if (!select || (!select->skip_record(thd, &skip_record) && !skip_record))
{
if (table->file->was_semi_consistent_read())
continue; /* repeat the read of the same row if it still exists */
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 8cb4df36cd5..69abe70e863 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -32,6 +32,7 @@
#include "sp.h"
#include "sp_head.h"
#include "sp_cache.h"
+#include "datadict.h" // dd_frm_type()
#define MD5_BUFF_LENGTH 33
@@ -433,7 +434,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
lex->link_first_table_back(view, link_to_local);
view->open_strategy= TABLE_LIST::OPEN_STUB;
- view->lock_strategy= TABLE_LIST::EXCLUSIVE_MDL;
+ view->lock_strategy= TABLE_LIST::OTLS_NONE;
view->open_type= OT_BASE_ONLY;
if (open_and_lock_tables(thd, lex->query_tables, TRUE, 0))
@@ -1663,7 +1664,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
view->db, view->table_name, reg_ext, 0);
if (access(path, F_OK) ||
- FRMTYPE_VIEW != (type= mysql_frm_type(thd, path, &not_used)))
+ FRMTYPE_VIEW != (type= dd_frm_type(thd, path, &not_used)))
{
char name[FN_REFLEN];
my_snprintf(name, sizeof(name), "%s.%s", view->db, view->table_name);
@@ -1742,54 +1743,6 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
/*
- Check type of .frm if we are not going to parse it
-
- SYNOPSIS
- mysql_frm_type()
- path path to file
-
- RETURN
- FRMTYPE_ERROR error
- FRMTYPE_TABLE table
- FRMTYPE_VIEW view
-*/
-
-frm_type_enum mysql_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
-{
- File file;
- uchar header[10]; //"TYPE=VIEW\n" it is 10 characters
- size_t error;
- DBUG_ENTER("mysql_frm_type");
-
- *dbt= DB_TYPE_UNKNOWN;
-
- if ((file= mysql_file_open(key_file_frm,
- path, O_RDONLY | O_SHARE, MYF(0))) < 0)
- DBUG_RETURN(FRMTYPE_ERROR);
- error= mysql_file_read(file, (uchar*) header, sizeof(header), MYF(MY_NABP));
- mysql_file_close(file, MYF(MY_WME));
-
- if (error)
- DBUG_RETURN(FRMTYPE_ERROR);
- if (!strncmp((char*) header, "TYPE=VIEW\n", sizeof(header)))
- DBUG_RETURN(FRMTYPE_VIEW);
-
- /*
- This is just a check for DB_TYPE. We'll return default unknown type
- if the following test is true (arg #3). This should not have effect
- on return value from this function (default FRMTYPE_TABLE)
- */
- if (header[0] != (uchar) 254 || header[1] != 1 ||
- (header[2] != FRM_VER && header[2] != FRM_VER+1 &&
- (header[2] < FRM_VER+3 || header[2] > FRM_VER+4)))
- DBUG_RETURN(FRMTYPE_TABLE);
-
- *dbt= (enum legacy_db_type) (uint) *(header + 3);
- DBUG_RETURN(FRMTYPE_TABLE); // Is probably a .frm table
-}
-
-
-/*
check of key (primary or unique) presence in updatable view
SYNOPSIS
diff --git a/sql/sql_view.h b/sql/sql_view.h
index 7d06abb9068..c15ecffccb8 100644
--- a/sql/sql_view.h
+++ b/sql/sql_view.h
@@ -43,8 +43,6 @@ bool check_key_in_view(THD *thd, TABLE_LIST * view);
bool insert_view_fields(THD *thd, List<Item> *list, TABLE_LIST *view);
-frm_type_enum mysql_frm_type(THD *thd, char *path, enum legacy_db_type *dbt);
-
int view_checksum(THD *thd, TABLE_LIST *view);
extern TYPELIB updatable_views_with_limit_typelib;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 2d5f7df6009..3ba67368565 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -696,7 +696,8 @@ static bool add_create_index_prepare (LEX *lex, Table_ident *table)
lex->sql_command= SQLCOM_CREATE_INDEX;
if (!lex->current_select->add_table_to_list(lex->thd, table, NULL,
TL_OPTION_UPDATING,
- TL_WRITE_ALLOW_READ))
+ TL_READ_NO_INSERT,
+ MDL_SHARED_NO_WRITE))
return TRUE;
lex->alter_info.reset();
lex->alter_info.flags= ALTER_ADD_INDEX;
@@ -765,6 +766,7 @@ static bool add_create_index (LEX *lex, Key::Keytype type,
enum index_hint_type index_hint;
enum enum_filetype filetype;
enum Foreign_key::fk_option m_fk_option;
+ enum enum_yes_no_unknown m_yes_no_unk;
Diag_condition_item_name diag_condition_item_name;
}
@@ -1432,12 +1434,15 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_option opt_if_not_exists opt_no_write_to_binlog
opt_temporary all_or_any opt_distinct
opt_ignore_leaves fulltext_options spatial_type union_option
- start_transaction_opts opt_chain opt_release
+ start_transaction_opts
union_opt select_derived_init option_type2
opt_natural_language_mode opt_query_expansion
opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment
ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt
+%type <m_yes_no_unk>
+ opt_chain opt_release
+
%type <m_fk_option>
delete_option
@@ -1927,11 +1932,9 @@ master_def:
{
const char format[]= "%d seconds";
char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)];
- my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD));
+ sprintf(buf, format, SLAVE_MAX_HEARTBEAT_PERIOD);
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
- MYF(0),
- " is negative or exceeds the maximum ",
- buf);
+ MYF(0), " is negative or exceeds the maximum ", buf);
MYSQL_YYABORT;
}
if (Lex->mi.heartbeat_period > slave_net_timeout)
@@ -2022,7 +2025,7 @@ create:
lex->sql_command= SQLCOM_CREATE_TABLE;
if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
TL_OPTION_UPDATING,
- TL_WRITE))
+ TL_WRITE, MDL_EXCLUSIVE))
MYSQL_YYABORT;
lex->alter_info.reset();
lex->col_list.empty();
@@ -4212,7 +4215,8 @@ create2:
lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
src_table= lex->select_lex.add_table_to_list(thd, $2, NULL, 0,
- TL_READ);
+ TL_READ,
+ MDL_SHARED_READ);
if (! src_table)
MYSQL_YYABORT;
/* CREATE TABLE ... LIKE is not allowed for views. */
@@ -4226,7 +4230,8 @@ create2:
lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
src_table= lex->select_lex.add_table_to_list(thd, $3, NULL, 0,
- TL_READ);
+ TL_READ,
+ MDL_SHARED_READ);
if (! src_table)
MYSQL_YYABORT;
/* CREATE TABLE ... LIKE is not allowed for views. */
@@ -6153,7 +6158,8 @@ alter:
lex->duplicates= DUP_ERROR;
if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
TL_OPTION_UPDATING,
- TL_WRITE_ALLOW_READ))
+ TL_READ_NO_INSERT,
+ MDL_SHARED_NO_WRITE))
MYSQL_YYABORT;
lex->col_list.empty();
lex->select_lex.init_order();
@@ -6845,6 +6851,8 @@ checksum:
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_CHECKSUM;
+ /* Will be overriden during execution. */
+ YYPS->m_lock_type= TL_UNLOCK;
}
table_list opt_checksum_type
{}
@@ -6864,6 +6872,8 @@ repair:
lex->no_write_to_binlog= $2;
lex->check_opt.init();
lex->alter_info.reset();
+ /* Will be overriden during execution. */
+ YYPS->m_lock_type= TL_UNLOCK;
}
table_list opt_mi_repair_type
{}
@@ -6893,6 +6903,8 @@ analyze:
lex->no_write_to_binlog= $2;
lex->check_opt.init();
lex->alter_info.reset();
+ /* Will be overriden during execution. */
+ YYPS->m_lock_type= TL_UNLOCK;
}
table_list
{}
@@ -6919,6 +6931,8 @@ check:
lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init();
lex->alter_info.reset();
+ /* Will be overriden during execution. */
+ YYPS->m_lock_type= TL_UNLOCK;
}
table_list opt_mi_check_type
{}
@@ -6951,6 +6965,8 @@ optimize:
lex->no_write_to_binlog= $2;
lex->check_opt.init();
lex->alter_info.reset();
+ /* Will be overriden during execution. */
+ YYPS->m_lock_type= TL_UNLOCK;
}
table_list
{}
@@ -6999,9 +7015,9 @@ table_to_table:
LEX *lex=Lex;
SELECT_LEX *sl= lex->current_select;
if (!sl->add_table_to_list(lex->thd, $1,NULL,TL_OPTION_UPDATING,
- TL_IGNORE) ||
+ TL_IGNORE, MDL_EXCLUSIVE) ||
!sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING,
- TL_IGNORE))
+ TL_IGNORE, MDL_EXCLUSIVE))
MYSQL_YYABORT;
}
;
@@ -7032,7 +7048,8 @@ keycache_list:
assign_to_keycache:
table_ident cache_keys_spec
{
- if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ,
+ if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ,
+ MDL_SHARED_READ,
Select->pop_index_hints()))
MYSQL_YYABORT;
}
@@ -7042,6 +7059,7 @@ assign_to_keycache_parts:
table_ident adm_partition cache_keys_spec
{
if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ,
+ MDL_SHARED_READ,
Select->pop_index_hints()))
MYSQL_YYABORT;
}
@@ -7077,6 +7095,7 @@ preload_keys:
table_ident cache_keys_spec opt_ignore_leaves
{
if (!Select->add_table_to_list(YYTHD, $1, NULL, $3, TL_READ,
+ MDL_SHARED_READ,
Select->pop_index_hints()))
MYSQL_YYABORT;
}
@@ -7086,6 +7105,7 @@ preload_keys_parts:
table_ident adm_partition cache_keys_spec opt_ignore_leaves
{
if (!Select->add_table_to_list(YYTHD, $1, NULL, $4, TL_READ,
+ MDL_SHARED_READ,
Select->pop_index_hints()))
MYSQL_YYABORT;
}
@@ -9217,6 +9237,7 @@ table_factor:
if (!($$= Select->add_table_to_list(YYTHD, $2, $3,
Select->get_table_join_options(),
YYPS->m_lock_type,
+ YYPS->m_mdl_type,
Select->pop_index_hints())))
MYSQL_YYABORT;
Select->add_joined_table($$);
@@ -9288,7 +9309,7 @@ table_factor:
MYSQL_YYABORT;
if (!($$= sel->add_table_to_list(lex->thd,
new Table_ident(unit), $5, 0,
- TL_READ)))
+ TL_READ, MDL_SHARED_READ)))
MYSQL_YYABORT;
sel->add_joined_table($$);
@@ -10123,13 +10144,17 @@ do:
*/
drop:
- DROP opt_temporary table_or_tables if_exists table_list opt_restrict
+ DROP opt_temporary table_or_tables if_exists
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_DROP_TABLE;
lex->drop_temporary= $2;
lex->drop_if_exists= $4;
+ YYPS->m_lock_type= TL_UNLOCK;
+ YYPS->m_mdl_type= MDL_EXCLUSIVE;
}
+ table_list opt_restrict
+ {}
| DROP INDEX_SYM ident ON table_ident {}
{
LEX *lex=Lex;
@@ -10142,7 +10167,8 @@ drop:
lex->alter_info.drop_list.push_back(ad);
if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,
TL_OPTION_UPDATING,
- TL_WRITE_ALLOW_READ))
+ TL_READ_NO_INSERT,
+ MDL_SHARED_NO_WRITE))
MYSQL_YYABORT;
}
| DROP DATABASE if_exists ident
@@ -10212,12 +10238,16 @@ drop:
{
Lex->sql_command = SQLCOM_DROP_USER;
}
- | DROP VIEW_SYM if_exists table_list opt_restrict
+ | DROP VIEW_SYM if_exists
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_DROP_VIEW;
lex->drop_if_exists= $3;
+ YYPS->m_lock_type= TL_UNLOCK;
+ YYPS->m_mdl_type= MDL_EXCLUSIVE;
}
+ table_list opt_restrict
+ {}
| DROP EVENT_SYM if_exists sp_name
{
Lex->drop_if_exists= $3;
@@ -10258,7 +10288,10 @@ table_list:
table_name:
table_ident
{
- if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING))
+ if (!Select->add_table_to_list(YYTHD, $1, NULL,
+ TL_OPTION_UPDATING,
+ YYPS->m_lock_type,
+ YYPS->m_mdl_type))
MYSQL_YYABORT;
}
;
@@ -10273,7 +10306,8 @@ table_alias_ref:
{
if (!Select->add_table_to_list(YYTHD, $1, NULL,
TL_OPTION_UPDATING | TL_OPTION_ALIAS,
- YYPS->m_lock_type))
+ YYPS->m_lock_type,
+ YYPS->m_mdl_type))
MYSQL_YYABORT;
}
;
@@ -10555,6 +10589,8 @@ delete:
lex->sql_command= SQLCOM_DELETE;
mysql_init_select(lex);
YYPS->m_lock_type= TL_WRITE_DEFAULT;
+ YYPS->m_mdl_type= MDL_SHARED_WRITE;
+
lex->ignore= 0;
lex->select_lex.init_order();
}
@@ -10565,9 +10601,11 @@ single_multi:
FROM table_ident
{
if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING,
- YYPS->m_lock_type))
+ YYPS->m_lock_type,
+ YYPS->m_mdl_type))
MYSQL_YYABORT;
YYPS->m_lock_type= TL_READ_DEFAULT;
+ YYPS->m_mdl_type= MDL_SHARED_READ;
}
where_clause opt_order_clause
delete_limit_clause {}
@@ -10575,6 +10613,7 @@ single_multi:
{
mysql_init_multi_delete(Lex);
YYPS->m_lock_type= TL_READ_DEFAULT;
+ YYPS->m_mdl_type= MDL_SHARED_READ;
}
FROM join_table_list where_clause
{
@@ -10585,6 +10624,7 @@ single_multi:
{
mysql_init_multi_delete(Lex);
YYPS->m_lock_type= TL_READ_DEFAULT;
+ YYPS->m_mdl_type= MDL_SHARED_READ;
}
USING join_table_list where_clause
{
@@ -10608,7 +10648,8 @@ table_wild_one:
ti,
NULL,
TL_OPTION_UPDATING | TL_OPTION_ALIAS,
- YYPS->m_lock_type))
+ YYPS->m_lock_type,
+ YYPS->m_mdl_type))
MYSQL_YYABORT;
}
| ident '.' ident opt_wild
@@ -10620,7 +10661,8 @@ table_wild_one:
ti,
NULL,
TL_OPTION_UPDATING | TL_OPTION_ALIAS,
- YYPS->m_lock_type))
+ YYPS->m_lock_type,
+ YYPS->m_mdl_type))
MYSQL_YYABORT;
}
;
@@ -10642,7 +10684,7 @@ opt_delete_option:
;
truncate:
- TRUNCATE_SYM opt_table_sym table_name
+ TRUNCATE_SYM opt_table_sym
{
LEX* lex= Lex;
lex->sql_command= SQLCOM_TRUNCATE;
@@ -10650,7 +10692,11 @@ truncate:
lex->select_lex.options= 0;
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;
}
+ table_name
+ {}
;
opt_table_sym:
@@ -11134,7 +11180,15 @@ flush:
flush_options:
table_or_tables
- { Lex->type|= REFRESH_TABLES; }
+ {
+ Lex->type|= REFRESH_TABLES;
+ /*
+ Set type of metadata and table locks for
+ FLUSH TABLES table_list WITH READ LOCK.
+ */
+ YYPS->m_lock_type= TL_READ_NO_INSERT;
+ YYPS->m_mdl_type= MDL_EXCLUSIVE;
+ }
opt_table_list {}
opt_with_read_lock {}
| flush_options_list
@@ -11298,7 +11352,7 @@ load:
{
LEX *lex=Lex;
if (!Select->add_table_to_list(YYTHD, $12, NULL, TL_OPTION_UPDATING,
- $4))
+ $4, MDL_SHARED_WRITE))
MYSQL_YYABORT;
lex->field_list.empty();
lex->update_list.empty();
@@ -13004,10 +13058,14 @@ table_lock:
table_ident opt_table_alias lock_option
{
thr_lock_type lock_type= (thr_lock_type) $3;
- if (!Select->add_table_to_list(YYTHD, $1, $2, 0, lock_type))
+ bool lock_for_write= (lock_type >= TL_WRITE_ALLOW_WRITE);
+ if (!Select->add_table_to_list(YYTHD, $1, $2, 0, lock_type,
+ (lock_for_write ?
+ MDL_SHARED_NO_READ_WRITE :
+ MDL_SHARED_READ)))
MYSQL_YYABORT;
/* If table is to be write locked, protect from a impending GRL. */
- if (lock_type >= TL_WRITE_ALLOW_WRITE)
+ if (lock_for_write)
Lex->protect_against_global_read_lock= TRUE;
}
;
@@ -13543,16 +13601,16 @@ opt_work:
opt_chain:
/* empty */
- { $$= (YYTHD->variables.completion_type == 1); }
- | AND_SYM NO_SYM CHAIN_SYM { $$=0; }
- | AND_SYM CHAIN_SYM { $$=1; }
+ { $$= TVL_UNKNOWN; }
+ | AND_SYM NO_SYM CHAIN_SYM { $$= TVL_NO; }
+ | AND_SYM CHAIN_SYM { $$= TVL_YES; }
;
opt_release:
/* empty */
- { $$= (YYTHD->variables.completion_type == 2); }
- | RELEASE_SYM { $$=1; }
- | NO_SYM RELEASE_SYM { $$=0; }
+ { $$= TVL_UNKNOWN; }
+ | RELEASE_SYM { $$= TVL_YES; }
+ | NO_SYM RELEASE_SYM { $$= TVL_NO; }
;
opt_savepoint:
@@ -13565,7 +13623,9 @@ commit:
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_COMMIT;
- lex->tx_chain= $3;
+ /* Don't allow AND CHAIN RELEASE. */
+ MYSQL_YYABORT_UNLESS($3 != TVL_YES || $4 != TVL_YES);
+ lex->tx_chain= $3;
lex->tx_release= $4;
}
;
@@ -13575,7 +13635,9 @@ rollback:
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_ROLLBACK;
- lex->tx_chain= $3;
+ /* Don't allow AND CHAIN RELEASE. */
+ MYSQL_YYABORT_UNLESS($3 != TVL_YES || $4 != TVL_YES);
+ lex->tx_chain= $3;
lex->tx_release= $4;
}
| ROLLBACK_SYM opt_work
@@ -13762,6 +13824,7 @@ query_expression_option:
if (check_simple_select())
MYSQL_YYABORT;
YYPS->m_lock_type= TL_READ_HIGH_PRIORITY;
+ YYPS->m_mdl_type= MDL_SHARED_READ;
Select->options|= SELECT_HIGH_PRIORITY;
}
| DISTINCT { Select->options|= SELECT_DISTINCT; }
@@ -13891,7 +13954,10 @@ view_tail:
LEX *lex= thd->lex;
lex->sql_command= SQLCOM_CREATE_VIEW;
/* first table in list is target VIEW name */
- if (!lex->select_lex.add_table_to_list(thd, $3, NULL, TL_OPTION_UPDATING))
+ if (!lex->select_lex.add_table_to_list(thd, $3, NULL,
+ TL_OPTION_UPDATING,
+ TL_IGNORE,
+ MDL_EXCLUSIVE))
MYSQL_YYABORT;
}
view_list_opt AS view_select
@@ -14031,7 +14097,8 @@ trigger_tail:
if (!lex->select_lex.add_table_to_list(YYTHD, $9,
(LEX_STRING*) 0,
TL_OPTION_UPDATING,
- TL_IGNORE))
+ TL_READ_NO_INSERT,
+ MDL_SHARED_NO_WRITE))
MYSQL_YYABORT;
}
;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 856f4c6f771..6e95961ebb0 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -875,7 +875,7 @@ static Sys_var_uint Sys_large_page_size(
static Sys_var_mybool Sys_large_pages(
"large_pages", "Enable support for large pages",
- READ_ONLY GLOBAL_VAR(opt_large_files),
+ READ_ONLY GLOBAL_VAR(opt_large_pages),
IF_WIN(NO_CMD_LINE, CMD_LINE(OPT_ARG)), DEFAULT(FALSE));
static Sys_var_charptr Sys_language(
@@ -942,10 +942,10 @@ static bool update_cached_long_query_time(sys_var *self, THD *thd,
{
if (type == OPT_SESSION)
thd->variables.long_query_time=
- thd->variables.long_query_time_double * 1e6;
+ double2ulonglong(thd->variables.long_query_time_double * 1e6);
else
global_system_variables.long_query_time=
- global_system_variables.long_query_time_double * 1e6;
+ double2ulonglong(global_system_variables.long_query_time_double * 1e6);
return false;
}
@@ -1630,7 +1630,7 @@ static Sys_var_ulong Sys_thread_stack(
static Sys_var_charptr Sys_tmpdir(
"tmpdir", "Path for temporary files. Several paths may "
"be specified, separated by a "
-#if defined(__WIN__) || defined(__NETWARE__)
+#if defined(__WIN__)
"semicolon (;)"
#else
"colon (:)"
@@ -2029,24 +2029,38 @@ static bool check_tx_isolation(sys_var *self, THD *thd, set_var *var)
return FALSE;
}
-/*
- If one doesn't use the SESSION modifier, the isolation level
- is only active for the next command.
-*/
-static bool fix_tx_isolation(sys_var *self, THD *thd, enum_var_type type)
+
+bool Sys_var_tx_isolation::session_update(THD *thd, set_var *var)
{
- if (type == OPT_SESSION)
- thd->session_tx_isolation= (enum_tx_isolation)thd->variables.tx_isolation;
- return false;
+ if (var->type == OPT_SESSION && Sys_var_enum::session_update(thd, var))
+ return TRUE;
+ if (var->type == OPT_DEFAULT || !thd->in_active_multi_stmt_transaction())
+ {
+ /*
+ Update the isolation level of the next transaction.
+ I.e. if one did:
+ COMMIT;
+ SET SESSION ISOLATION LEVEL ...
+ BEGIN; <-- this transaction has the new isolation
+ Note, that in case of:
+ COMMIT;
+ SET TRANSACTION ISOLATION LEVEL ...
+ SET SESSION ISOLATION LEVEL ...
+ BEGIN; <-- the session isolation level is used, not the
+ result of SET TRANSACTION statement.
+ */
+ thd->tx_isolation= (enum_tx_isolation) var->save_result.ulonglong_value;
+ }
+ return FALSE;
}
+
// NO_CMD_LINE - different name of the option
-static Sys_var_enum Sys_tx_isolation(
+static Sys_var_tx_isolation Sys_tx_isolation(
"tx_isolation", "Default transaction isolation level",
SESSION_VAR(tx_isolation), NO_CMD_LINE,
tx_isolation_names, DEFAULT(ISO_REPEATABLE_READ),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_tx_isolation),
- ON_UPDATE(fix_tx_isolation));
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_tx_isolation));
static Sys_var_ulonglong Sys_tmp_table_size(
"tmp_table_size",
@@ -2365,7 +2379,7 @@ static Sys_var_harows Sys_select_limit(
"sql_select_limit",
"The maximum number of rows to return from SELECT statements",
SESSION_VAR(select_limit), NO_CMD_LINE,
- VALID_RANGE(1, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1));
+ VALID_RANGE(0, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1));
static bool update_timestamp(THD *thd, set_var *var)
{
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index c4855ef4fd3..ca3fc99deba 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -388,7 +388,7 @@ public:
~Sys_var_charptr()
{
if (flags & ALLOCATED)
- my_free(global_var(char*), MYF(MY_ALLOW_ZERO_PTR));
+ my_free(global_var(char*));
flags&= ~ALLOCATED;
}
bool do_check(THD *thd, set_var *var)
@@ -435,7 +435,7 @@ public:
else
new_val= 0;
if (flags & ALLOCATED)
- my_free(global_var(char*), MYF(MY_ALLOW_ZERO_PTR));
+ my_free(global_var(char*));
flags|= ALLOCATED;
global_var(char*)= new_val;
return false;
@@ -741,13 +741,13 @@ public:
uint deprecated_version=0, const char *substitute=0,
int parse_flag= PARSE_NORMAL)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
- getopt.arg_type, SHOW_DOUBLE, def_val, lock, binlog_status_arg,
- on_check_func, on_update_func, deprecated_version, substitute,
- parse_flag)
+ getopt.arg_type, SHOW_DOUBLE, (longlong) double2ulonglong(def_val),
+ lock, binlog_status_arg, on_check_func, on_update_func,
+ deprecated_version, substitute, parse_flag)
{
option.var_type= GET_DOUBLE;
- option.min_value= min_val;
- option.max_value= max_val;
+ option.min_value= (longlong) double2ulonglong(min_val);
+ option.max_value= (longlong) double2ulonglong(max_val);
global_var(double)= (double)option.def_value;
DBUG_ASSERT(min_val < max_val);
DBUG_ASSERT(min_val <= def_val);
@@ -1599,6 +1599,22 @@ public:
{ return type != STRING_RESULT; }
};
+
+class Sys_var_tx_isolation: public Sys_var_enum
+{
+public:
+ Sys_var_tx_isolation(const char *name_arg,
+ const char *comment, int flag_args, ptrdiff_t off, size_t size,
+ CMD_LINE getopt,
+ const char *values[], uint def_val, PolyLock *lock,
+ enum binlog_status_enum binlog_status_arg,
+ on_check_function on_check_func)
+ :Sys_var_enum(name_arg, comment, flag_args, off, size, getopt,
+ values, def_val, lock, binlog_status_arg, on_check_func)
+ {}
+ virtual bool session_update(THD *thd, set_var *var);
+};
+
/****************************************************************************
Used templates
****************************************************************************/
diff --git a/sql/table.cc b/sql/table.cc
index 3143db78520..a58623f0036 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -33,6 +33,7 @@
#include "sql_base.h" // release_table_share
#include <m_ctype.h>
#include "my_md5.h"
+#include "sql_select.h"
/* INFORMATION_SCHEMA name */
LEX_STRING INFORMATION_SCHEMA_NAME= {C_STRING_WITH_LEN("information_schema")};
@@ -895,7 +896,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (mysql_file_pread(file, buff, n_length, record_offset + share->reclength,
MYF(MY_NABP)))
{
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
share->connect_string.length= uint2korr(buff);
@@ -904,7 +905,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->connect_string.
length)))
{
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
next_chunk+= share->connect_string.length + 2;
@@ -925,7 +926,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
plugin_data(tmp_plugin, handlerton *)))
{
/* bad file, legacy_db_type did not match the name */
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
/*
@@ -955,7 +956,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
error= 8;
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
"--skip-partition");
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
plugin_unlock(NULL, share->db_plugin);
@@ -971,7 +972,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
error= 8;
name.str[name.length]=0;
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str);
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
/* purecov: end */
}
@@ -988,7 +989,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
memdup_root(&share->mem_root, next_chunk + 4,
partition_info_str_len + 1)))
{
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
}
@@ -996,7 +997,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (partition_info_str_len)
{
DBUG_PRINT("info", ("WITH_PARTITION_STORAGE_ENGINE is not defined"));
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
#endif
@@ -1034,7 +1035,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
DBUG_PRINT("error",
("fulltext key uses parser that is not defined in .frm"));
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
parser_name.str= (char*) next_chunk;
@@ -1045,7 +1046,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (! keyinfo->parser)
{
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), parser_name.str);
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
}
@@ -1057,19 +1058,19 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
DBUG_PRINT("error",
("long table comment is not defined in .frm"));
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
share->comment.length = uint2korr(next_chunk);
if (! (share->comment.str= strmake_root(&share->mem_root,
(char*)next_chunk + 2, share->comment.length)))
{
- my_free(buff, MYF(0));
+ my_free(buff);
goto err;
}
next_chunk+= 2 + share->comment.length;
}
- my_free(buff, MYF(0));
+ my_free(buff);
}
share->key_block_size= uint2korr(head+62);
@@ -1585,7 +1586,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
}
else
share->primary_key= MAX_KEY;
- x_free((uchar*) disk_buff);
+ my_free(disk_buff);
disk_buff=0;
if (new_field_pack_flag <= 1)
{
@@ -1657,7 +1658,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->error= error;
share->open_errno= my_errno;
share->errarg= errarg;
- x_free((uchar*) disk_buff);
+ my_free(disk_buff);
delete crypted;
delete handler_file;
my_hash_free(&share->name_hash);
@@ -2009,7 +2010,7 @@ partititon_err:
outparam->file= 0; // For easier error checking
outparam->db_stat=0;
free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root
- my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((void *) outparam->alias);
DBUG_RETURN (error);
}
@@ -2031,7 +2032,7 @@ int closefrm(register TABLE *table, bool free_share)
if (table->db_stat)
error=table->file->close();
- my_free((char*) table->alias, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((void *) table->alias);
table->alias= 0;
if (table->field)
{
@@ -2126,14 +2127,14 @@ static ulong get_form_pos(File file, uchar *head)
if (mysql_file_read(file, buf, length+names*4, MYF(MY_NABP)))
{
- x_free(buf);
+ my_free(buf);
DBUG_RETURN(0);
}
pos= buf+length;
ret_value= uint4korr(pos);
- my_free(buf, MYF(0));
+ my_free(buf);
DBUG_RETURN(ret_value);
}
@@ -2150,11 +2151,11 @@ int read_string(File file, uchar**to, size_t length)
{
DBUG_ENTER("read_string");
- x_free(*to);
+ my_free(*to);
if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) ||
mysql_file_read(file, *to, length, MYF(MY_NABP)))
{
- x_free(*to); /* purecov: inspected */
+ my_free(*to); /* purecov: inspected */
*to= 0; /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
@@ -2770,9 +2771,10 @@ bool check_db_name(LEX_STRING *org_name)
returns 1 on error
*/
-bool check_table_name(const char *name, uint length, bool check_for_path_chars)
+bool check_table_name(const char *name, size_t length, bool check_for_path_chars)
{
- uint name_length= 0; // name length in symbols
+ // name length in symbols
+ size_t name_length= 0;
const char *end= name+length;
if (!length || length > NAME_LEN)
return 1;
@@ -2805,18 +2807,19 @@ bool check_table_name(const char *name, uint length, bool check_for_path_chars)
name_length++;
}
#if defined(USE_MB) && defined(USE_MB_IDENT)
- return (last_char_is_space || name_length > NAME_CHAR_LEN) ;
+ return last_char_is_space || (name_length > NAME_CHAR_LEN);
#else
- return 0;
+ return FALSE;
#endif
}
bool check_column_name(const char *name)
{
- uint name_length= 0; // name length in symbols
+ // name length in symbols
+ size_t name_length= 0;
bool last_char_is_space= TRUE;
-
+
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
@@ -2841,7 +2844,7 @@ bool check_column_name(const char *name)
name_length++;
}
/* Error if empty or too long column name */
- return last_char_is_space || (uint) name_length > NAME_CHAR_LEN;
+ return last_char_is_space || (name_length > NAME_CHAR_LEN);
}
@@ -4676,13 +4679,6 @@ void TABLE_LIST::reinit_before_use(THD *thd)
parent_embedding->nested_join->join_list.head() == embedded);
mdl_request.ticket= NULL;
- /*
- Since we manipulate with the metadata lock type in open_table(),
- we need to reset it to the parser default, to restore things back
- to first-execution state.
- */
- mdl_request.set_type((lock_type >= TL_WRITE_ALLOW_WRITE) ?
- MDL_SHARED_WRITE : MDL_SHARED_READ);
}
/*
@@ -4921,6 +4917,61 @@ void init_mdl_requests(TABLE_LIST *table_list)
}
+/**
+ Update TABLE::const_key_parts for single table UPDATE/DELETE query
+
+ @param conds WHERE clause expression
+
+ @retval TRUE error (OOM)
+ @retval FALSE success
+
+ @note
+ Set const_key_parts bits if key fields are equal to constants in
+ the WHERE expression.
+*/
+
+bool TABLE::update_const_key_parts(COND *conds)
+{
+ bzero((char*) const_key_parts, sizeof(key_part_map) * s->keys);
+
+ if (conds == NULL)
+ return FALSE;
+
+ for (uint index= 0; index < s->keys; index++)
+ {
+ KEY_PART_INFO *keyinfo= key_info[index].key_part;
+ KEY_PART_INFO *keyinfo_end= keyinfo + key_info[index].key_parts;
+
+ for (key_part_map part_map= (key_part_map)1;
+ keyinfo < keyinfo_end;
+ keyinfo++, part_map<<= 1)
+ {
+ if (const_expression_in_where(conds, NULL, keyinfo->field))
+ const_key_parts[index]|= part_map;
+ }
+ }
+ return FALSE;
+}
+
+/**
+ Test if the order list consists of simple field expressions
+
+ @param order Linked list of ORDER BY arguments
+
+ @return TRUE if @a order is empty or consist of simple field expressions
+*/
+
+bool is_simple_order(ORDER *order)
+{
+ for (ORDER *ord= order; ord; ord= ord->next)
+ {
+ if (ord->item[0]->real_item()->type() != Item::FIELD_ITEM)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
/*****************************************************************************
** Instansiate templates
*****************************************************************************/
diff --git a/sql/table.h b/sql/table.h
index cef547ae830..2bf390aee4d 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -20,6 +20,7 @@
#include "sql_plist.h"
#include "sql_list.h" /* Sql_alloc */
#include "mdl.h"
+#include "datadict.h"
#ifndef MYSQL_CLIENT
@@ -305,14 +306,6 @@ enum tmp_table_type
NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE
};
-
-enum frm_type_enum
-{
- FRMTYPE_ERROR= 0,
- FRMTYPE_TABLE,
- FRMTYPE_VIEW
-};
-
enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
typedef struct st_filesort_info
@@ -580,9 +573,7 @@ struct TABLE_SHARE
key_map keys_for_keyread;
ha_rows min_rows, max_rows; /* create information */
ulong avg_row_length; /* create information */
- ulong raid_chunksize;
ulong version, mysql_version;
- ulong timestamp_offset; /* Set to offset+1 of record */
ulong reclength; /* Recordlength */
plugin_ref db_plugin; /* storage engine plugin */
@@ -593,11 +584,8 @@ struct TABLE_SHARE
}
enum row_type row_type; /* How rows are stored */
enum tmp_table_type tmp_table;
- enum enum_ha_unused unused1;
- enum enum_ha_unused unused2;
uint ref_count; /* How many TABLE objects uses this */
- uint open_count; /* Number of tables in open list */
uint blob_ptr_size; /* 4 or 8 */
uint key_block_size; /* create key_block_size, if used */
uint null_bytes, last_null_bit_pos;
@@ -613,7 +601,6 @@ struct TABLE_SHARE
uint db_create_options; /* Create options from database */
uint db_options_in_use; /* Options in use */
uint db_record_offset; /* if HA_REC_IN_SEQ */
- uint raid_type, raid_chunks;
uint rowid_field_offset; /* Field_nr +1 to rowid field */
/* Index of auto-updated TIMESTAMP field in field array */
uint primary_key;
@@ -747,7 +734,7 @@ struct TABLE_SHARE
/*
Must all TABLEs be reopened?
*/
- inline bool needs_reopen()
+ inline bool needs_reopen() const
{
return version != refresh_version;
}
@@ -1117,6 +1104,8 @@ public:
file->extra(HA_EXTRA_NO_KEYREAD);
}
}
+
+ bool update_const_key_parts(COND *conds);
};
@@ -1600,20 +1589,21 @@ struct TABLE_LIST
OPEN_STUB
} open_strategy;
/**
- Indicates the locking strategy for the object being opened:
- whether the associated metadata lock is shared or exclusive.
+ Indicates the locking strategy for the object being opened.
*/
enum
{
- /* Take a shared metadata lock before the object is opened. */
- SHARED_MDL= 0,
/*
- Take a exclusive metadata lock before the object is opened.
- If opening is successful, downgrade to a shared lock.
+ Take metadata lock specified by 'mdl_request' member before
+ the object is opened. Do nothing after that.
+ */
+ OTLS_NONE= 0,
+ /*
+ Take (exclusive) metadata lock specified by 'mdl_request' member
+ before object is opened. If opening is successful, downgrade to
+ a shared lock.
*/
- EXCLUSIVE_DOWNGRADABLE_MDL,
- /* Take a exclusive metadata lock before the object is opened. */
- EXCLUSIVE_MDL
+ OTLS_DOWNGRADE_IF_EXISTS
} lock_strategy;
/* For transactional locking. */
int lock_timeout; /* NOWAIT or WAIT [X] */
@@ -2039,7 +2029,7 @@ void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
bool check_and_convert_db_name(LEX_STRING *db, bool preserve_lettercase);
bool check_db_name(LEX_STRING *db);
bool check_column_name(const char *name);
-bool check_table_name(const char *name, uint length, bool check_for_path_chars);
+bool check_table_name(const char *name, size_t length, bool check_for_path_chars);
int rename_file_ext(const char * from,const char * to,const char * ext);
char *get_field(MEM_ROOT *mem, Field *field);
bool get_field(MEM_ROOT *mem, Field *field, class String *res);
@@ -2100,6 +2090,8 @@ inline void mark_as_null_row(TABLE *table)
bfill(table->null_flags,table->s->null_bytes,255);
}
+bool is_simple_order(ORDER *order);
+
#endif /* MYSQL_CLIENT */
#endif /* TABLE_INCLUDED */
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 5047de1ccdc..f6786f20dcf 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -96,7 +96,18 @@ bool trans_begin(THD *thd, uint flags)
DBUG_ASSERT(!thd->locked_tables_mode);
- if (trans_commit_implicit(thd))
+ if (thd->in_multi_stmt_transaction_mode() ||
+ (thd->variables.option_bits & OPTION_TABLE_LOCK))
+ {
+ thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
+ thd->server_status&= ~SERVER_STATUS_IN_TRANS;
+ res= test(ha_commit_trans(thd, TRUE));
+ }
+
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
+ thd->transaction.all.modified_non_trans_table= FALSE;
+
+ if (res)
DBUG_RETURN(TRUE);
/*
@@ -182,6 +193,14 @@ bool trans_commit_implicit(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
+ /*
+ Upon implicit commit, reset the current transaction
+ isolation level. We do not care about
+ @@session.completion_type since it's documented
+ to not have any effect on implicit commit.
+ */
+ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
+
DBUG_RETURN(res);
}
@@ -234,7 +253,11 @@ bool trans_commit_stmt(THD *thd)
DBUG_ENTER("trans_commit_stmt");
int res= FALSE;
if (thd->transaction.stmt.ha_list)
+ {
res= ha_commit_trans(thd, FALSE);
+ if (! thd->in_active_multi_stmt_transaction())
+ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
+ }
if (res)
/*
@@ -265,6 +288,8 @@ bool trans_rollback_stmt(THD *thd)
ha_rollback_trans(thd, FALSE);
if (thd->transaction_rollback_request && !thd->in_sub_stmt)
ha_rollback_trans(thd, TRUE);
+ if (! thd->in_active_multi_stmt_transaction())
+ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
}
RUN_HOOK(transaction, after_rollback, (thd, FALSE));
@@ -394,9 +419,13 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name)
thd->transaction.savepoints= sv;
/*
- Release metadata locks that were acquired during this savepoint unit.
+ Release metadata locks that were acquired during this savepoint unit
+ unless binlogging is on. Releasing locks with binlogging on can break
+ replication as it allows other connections to drop these tables before
+ rollback to savepoint is written to the binlog.
*/
- if (!res)
+ bool binlog_on= mysql_bin_log.is_open() && thd->variables.sql_log_bin;
+ if (!res && !binlog_on)
thd->mdl_context.rollback_to_savepoint(sv->mdl_savepoint);
DBUG_RETURN(test(res));
diff --git a/sql/tztime.cc b/sql/tztime.cc
index b23456b5465..af8574c38f1 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1692,7 +1692,11 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
}
for (TABLE_LIST *tl= tz_tables; tl; tl= tl->next_global)
+ {
tl->table->use_all_columns();
+ /* Force close at the end of the function to free memory. */
+ tl->table->m_needs_reopen= TRUE;
+ }
/*
Now we are going to load leap seconds descriptions that are shared
@@ -1781,7 +1785,6 @@ end_with_setting_default_tz:
end_with_close:
if (time_zone_tables_exist)
{
- thd->version--; /* Force close to free memory */
close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();
}
@@ -2548,7 +2551,6 @@ scan_tz_dir(char * name_end)
int
main(int argc, char **argv)
{
-#ifndef __NETWARE__
MY_INIT(argv[0]);
if (argc != 2 && argc != 3)
@@ -2607,10 +2609,6 @@ main(int argc, char **argv)
free_root(&tz_storage, MYF(0));
}
-#else
- fprintf(stderr, "This tool has not been ported to NetWare\n");
-#endif /* __NETWARE__ */
-
return 0;
}
diff --git a/sql/udf_example.c b/sql/udf_example.c
index fa1b44178ac..284689d329f 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -146,7 +146,9 @@ typedef long long longlong;
#ifdef HAVE_DLOPEN
+#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
static pthread_mutex_t LOCK_hostname;
+#endif
/* These must be right or mysqld will not find the symbol! */
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 7b5a6d1ce4f..690b310bde5 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -566,7 +566,7 @@ bool Unique::walk(tree_walk_action action, void *walk_action_arg)
(BUFFPEK *) file_ptrs.buffer + file_ptrs.elements,
action, walk_action_arg,
tree.compare, tree.custom_arg, &file);
- my_free((char*) merge_buffer, MYF(0));
+ my_free(merge_buffer);
return res;
}
@@ -642,7 +642,7 @@ bool Unique::get(TABLE *table)
goto err;
error=0;
err:
- x_free(sort_buffer);
+ my_free(sort_buffer);
if (flush_io_cache(outfile))
error=1;
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 802e5b7429c..6433b8bc7c2 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -148,7 +148,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
if (error)
{
- my_free(screen_buff, MYF(0));
+ my_free(screen_buff);
if (! pack_header_error_handler.is_handled)
DBUG_RETURN(1);
@@ -159,7 +159,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
create_fields,info_length,
screens, create_info->table_options, data_offset, db_file))
{
- my_free(screen_buff, MYF(0));
+ my_free(screen_buff);
DBUG_RETURN(1);
}
}
@@ -228,7 +228,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
{
my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0),
real_table_name, (uint) TABLE_COMMENT_MAXLEN);
- my_free(screen_buff,MYF(0));
+ my_free(screen_buff);
DBUG_RETURN(1);
}
char warn_buff[MYSQL_ERRMSG_SIZE];
@@ -259,7 +259,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
create_info, keys, key_info)) < 0)
{
- my_free(screen_buff, MYF(0));
+ my_free(screen_buff);
DBUG_RETURN(1);
}
@@ -374,15 +374,15 @@ bool mysql_create_frm(THD *thd, const char *file_name,
delete crypted;
if (mysql_file_pwrite(file, disk_buff, read_length, filepos+256, MYF_RW))
{
- my_free(disk_buff,MYF(0));
+ my_free(disk_buff);
goto err;
}
- my_free(disk_buff,MYF(0));
+ my_free(disk_buff);
}
#endif
- my_free(screen_buff,MYF(0));
- my_free(keybuff, MYF(0));
+ my_free(screen_buff);
+ my_free(keybuff);
if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
(mysql_file_sync(file, MYF(MY_WME)) ||
@@ -411,8 +411,8 @@ bool mysql_create_frm(THD *thd, const char *file_name,
DBUG_RETURN(0);
err:
- my_free(screen_buff, MYF(0));
- my_free(keybuff, MYF(0));
+ my_free(screen_buff);
+ my_free(keybuff);
err2:
(void) mysql_file_close(file, MYF(MY_WME));
err3:
@@ -1095,7 +1095,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
error= mysql_file_write(file, buff, (size_t) reclength, MYF_RW) != 0;
err:
- my_free(buff, MYF(MY_FAE));
+ my_free(buff);
thd->count_cuted_fields= old_count_cuted_fields;
DBUG_RETURN(error);
} /* make_empty_rec */
diff --git a/sql/unireg.h b/sql/unireg.h
index dbbeea077a9..b897c887c89 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -77,8 +77,8 @@ typedef struct st_ha_create_information HA_CREATE_INFO;
#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */
/* Extern defines */
-#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
-#define restore_record(A,B) bmove_align((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
+#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
+#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
#define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
#define empty_record(A) { \
restore_record((A),s->default_values); \
diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am
index adc11358df6..8b08105cef3 100644
--- a/storage/archive/Makefile.am
+++ b/storage/archive/Makefile.am
@@ -37,14 +37,14 @@ noinst_PROGRAMS = archive_test archive_reader
EXTRA_LTLIBRARIES = ha_archive.la
pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@
ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir)
-ha_archive_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+ha_archive_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_archive_la_SOURCES = ha_archive.cc azio.c
EXTRA_LIBRARIES = libarchive.a
noinst_LIBRARIES = @plugin_archive_static_target@
-libarchive_a_CXXFLAGS = $(AM_CFLAGS)
+libarchive_a_CXXFLAGS = $(AM_CXXFLAGS)
libarchive_a_CFLAGS = $(AM_CFLAGS)
libarchive_a_SOURCES = ha_archive.cc azio.c
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c
index bad02835d86..ce4be92a521 100644
--- a/storage/archive/archive_reader.c
+++ b/storage/archive/archive_reader.c
@@ -201,7 +201,7 @@ int main(int argc, char *argv[])
ptr= (char *)my_malloc(sizeof(char) * reader_handle.frm_length, MYF(0));
azread_frm(&reader_handle, ptr);
azwrite_frm(&writer_handle, ptr, reader_handle.frm_length);
- my_free(ptr, MYF(0));
+ my_free(ptr);
}
if (reader_handle.comment_length)
@@ -210,7 +210,7 @@ int main(int argc, char *argv[])
ptr= (char *)my_malloc(sizeof(char) * reader_handle.comment_length, MYF(0));
azread_comment(&reader_handle, ptr);
azwrite_comment(&writer_handle, ptr, reader_handle.comment_length);
- my_free(ptr, MYF(0));
+ my_free(ptr);
}
while ((read= azread(&reader_handle, (uchar *)size_buffer,
@@ -265,7 +265,7 @@ int main(int argc, char *argv[])
azread_frm(&reader_handle, ptr);
my_write(frm_file, (uchar*) ptr, reader_handle.frm_length, MYF(0));
my_close(frm_file, MYF(0));
- my_free(ptr, MYF(0));
+ my_free(ptr);
}
end:
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 2bcfc3ff672..63848370ff1 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -387,7 +387,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
{
*rc= my_errno ? my_errno : -1;
mysql_mutex_unlock(&archive_mutex);
- my_free(share, MYF(0));
+ my_free(share);
DBUG_RETURN(NULL);
}
stats.auto_increment_value= archive_tmp.auto_increment + 1;
@@ -447,7 +447,7 @@ int ha_archive::free_share()
if (azclose(&(share->archive_write)))
rc= 1;
}
- my_free((uchar*) share, MYF(0));
+ my_free(share);
}
mysql_mutex_unlock(&archive_mutex);
@@ -706,7 +706,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
{
my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0));
azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size);
- my_free((uchar*)frm_ptr, MYF(0));
+ my_free(frm_ptr);
}
}
my_close(frm_file, MYF(0));
@@ -932,8 +932,7 @@ int ha_archive::write_row(uchar *buf)
rc= real_write_row(buf, &(share->archive_write));
error:
mysql_mutex_unlock(&share->mutex);
- if (read_buf)
- my_free((uchar*) read_buf, MYF(0));
+ my_free(read_buf);
DBUG_RETURN(rc);
}
@@ -1696,7 +1695,7 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length)
if (!(r->buffer= (uchar*) my_malloc(r->length,
MYF(MY_WME))))
{
- my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(r);
DBUG_RETURN(NULL); /* purecov: inspected */
}
@@ -1706,8 +1705,8 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length)
void ha_archive::destroy_record_buffer(archive_record_buffer *r)
{
DBUG_ENTER("ha_archive::destroy_record_buffer");
- my_free((char*) r->buffer, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(r->buffer);
+ my_free(r);
DBUG_VOID_RETURN;
}
diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am
index f3bdbdbd070..38c2f354844 100644
--- a/storage/blackhole/Makefile.am
+++ b/storage/blackhole/Makefile.am
@@ -35,14 +35,14 @@ noinst_HEADERS = ha_blackhole.h
EXTRA_LTLIBRARIES = ha_blackhole.la
pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@
ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir)
-ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+ha_blackhole_la_CXXFLAGS=$(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_blackhole_la_SOURCES=ha_blackhole.cc
EXTRA_LIBRARIES = libblackhole.a
noinst_LIBRARIES = @plugin_blackhole_static_target@
-libblackhole_a_CXXFLAGS=$(AM_CFLAGS)
+libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS)
libblackhole_a_CFLAGS = $(AM_CFLAGS)
libblackhole_a_SOURCES= ha_blackhole.cc
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 7ec60aad88a..6591c3a2c78 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -335,7 +335,7 @@ static st_blackhole_share *get_share(const char *table_name)
if (my_hash_insert(&blackhole_open_tables, (uchar*) share))
{
- my_free((uchar*) share, MYF(0));
+ my_free(share);
share= NULL;
goto error;
}
@@ -360,7 +360,7 @@ static void free_share(st_blackhole_share *share)
static void blackhole_free_key(st_blackhole_share *share)
{
thr_lock_delete(&share->lock);
- my_free((uchar*) share, MYF(0));
+ my_free(share);
}
static uchar* blackhole_get_key(st_blackhole_share *share, size_t *length,
diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am
index 36d6b464fcc..5e3587c893f 100644
--- a/storage/csv/Makefile.am
+++ b/storage/csv/Makefile.am
@@ -32,12 +32,12 @@ noinst_HEADERS = ha_tina.h transparent_file.h
EXTRA_LTLIBRARIES = ha_csv.la
pkglib_LTLIBRARIES = @plugin_csv_shared_target@
ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
-ha_csv_la_CXXFLAGS = $(AM_CFLAGS) -DMYSQL_PLUGIN
+ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN
ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc
EXTRA_LIBRARIES = libcsv.a
noinst_LIBRARIES = @plugin_csv_static_target@
-libcsv_a_CXXFLAGS = $(AM_CFLAGS)
+libcsv_a_CXXFLAGS = $(AM_CXXFLAGS)
libcsv_a_SOURCES = transparent_file.cc ha_tina.cc
EXTRA_DIST = CMakeLists.txt plug.in
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 11edf690f2a..30c4c4d58ca 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -251,7 +251,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
error:
mysql_mutex_unlock(&tina_mutex);
- my_free((uchar*) share, MYF(0));
+ my_free(share);
return NULL;
}
@@ -429,7 +429,7 @@ static int free_share(TINA_SHARE *share)
my_hash_delete(&tina_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->mutex);
- my_free((uchar*) share, MYF(0));
+ my_free(share);
}
mysql_mutex_unlock(&tina_mutex);
@@ -1529,7 +1529,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
free_root(&blobroot, MYF(0));
- my_free((char*)buf, MYF(0));
+ my_free(buf);
if (rc == HA_ERR_END_OF_FILE)
{
@@ -1735,7 +1735,7 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
free_root(&blobroot, MYF(0));
- my_free((char*)buf, MYF(0));
+ my_free(buf);
thd_proc_info(thd, old_proc_info);
if ((rc != HA_ERR_END_OF_FILE) || count)
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index 7bb80170e87..845b50e3869 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -95,7 +95,7 @@ public:
~ha_tina()
{
if (chain_alloced)
- my_free(chain, 0);
+ my_free(chain);
if (file_buff)
delete file_buff;
free_root(&blobroot, MYF(0));
diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc
index 44ca2df026f..f92746c7b93 100644
--- a/storage/csv/transparent_file.cc
+++ b/storage/csv/transparent_file.cc
@@ -29,7 +29,7 @@ Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
Transparent_file::~Transparent_file()
{
- my_free((uchar*)buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buff);
}
void Transparent_file::init_buff(File filedes_arg)
diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am
index 47d95d4663c..c79fbe97cc3 100644
--- a/storage/example/Makefile.am
+++ b/storage/example/Makefile.am
@@ -35,14 +35,14 @@ noinst_HEADERS = ha_example.h
EXTRA_LTLIBRARIES = ha_example.la
pkgplugin_LTLIBRARIES = @plugin_example_shared_target@
ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
-ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+ha_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_example_la_SOURCES = ha_example.cc
EXTRA_LIBRARIES = libexample.a
noinst_LIBRARIES = @plugin_example_static_target@
-libexample_a_CXXFLAGS = $(AM_CFLAGS)
+libexample_a_CXXFLAGS = $(AM_CXXFLAGS)
libexample_a_CFLAGS = $(AM_CFLAGS)
libexample_a_SOURCES= ha_example.cc
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 2fbb17e46bd..899f55a33f7 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -232,7 +232,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
error:
mysql_mutex_destroy(&share->mutex);
- my_free(share, MYF(0));
+ my_free(share);
return NULL;
}
@@ -252,7 +252,7 @@ static int free_share(EXAMPLE_SHARE *share)
my_hash_delete(&example_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->mutex);
- my_free(share, MYF(0));
+ my_free(share);
}
mysql_mutex_unlock(&example_mutex);
diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am
index f4cd634567d..e07b0d95b97 100644
--- a/storage/federated/Makefile.am
+++ b/storage/federated/Makefile.am
@@ -36,14 +36,14 @@ noinst_HEADERS = ha_federated.h
EXTRA_LTLIBRARIES = ha_federated.la
pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@
ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir)
-ha_federated_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+ha_federated_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_federated_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_federated_la_SOURCES = ha_federated.cc
EXTRA_LIBRARIES = libfederated.a
noinst_LIBRARIES = @plugin_federated_static_target@
-libfederated_a_CXXFLAGS = $(AM_CFLAGS)
+libfederated_a_CXXFLAGS = $(AM_CXXFLAGS)
libfederated_a_CFLAGS = $(AM_CFLAGS)
libfederated_a_SOURCES= ha_federated.cc
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 5534c520604..d17b56bd4b1 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -594,7 +594,6 @@ static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num)
int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share)
{
int error_num= ER_FOREIGN_SERVER_DOESNT_EXIST;
- char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
FOREIGN_SERVER *server, server_buffer;
DBUG_ENTER("ha_federated::get_connection");
@@ -646,10 +645,8 @@ int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share)
DBUG_RETURN(0);
error:
- my_sprintf(error_buffer,
- (error_buffer, "server name: '%s' doesn't exist!",
- share->connection_string));
- my_error(error_num, MYF(0), error_buffer);
+ my_printf_error(error_num, "server name: '%s' doesn't exist!",
+ MYF(0), share->connection_string);
DBUG_RETURN(error_num);
}
@@ -2443,8 +2440,8 @@ int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index,
if (real_query(sql_query.ptr(), sql_query.length()))
{
- my_sprintf(error_buffer, (error_buffer, "error: %d '%s'",
- mysql_errno(mysql), mysql_error(mysql)));
+ sprintf(error_buffer, "error: %d '%s'",
+ mysql_errno(mysql), mysql_error(mysql));
retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
goto error;
}
@@ -2841,7 +2838,6 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos)
int ha_federated::info(uint flag)
{
- char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
char status_buf[FEDERATED_QUERY_BUFFER_SIZE];
int error;
uint error_code;
@@ -2925,9 +2921,8 @@ error:
mysql_free_result(result);
if (mysql)
{
- my_sprintf(error_buffer, (error_buffer, ": %d : %s",
- mysql_errno(mysql), mysql_error(mysql)));
- my_error(error_code, MYF(0), error_buffer);
+ my_printf_error(error_code, ": %d : %s", MYF(0),
+ mysql_errno(mysql), mysql_error(mysql));
}
else
if (remote_error_number != -1 /* error already reported */)
diff --git a/storage/heap/CMakeLists.txt b/storage/heap/CMakeLists.txt
index 32359759abc..2c0b65b0cc4 100755..100644
--- a/storage/heap/CMakeLists.txt
+++ b/storage/heap/CMakeLists.txt
@@ -23,3 +23,9 @@ SET(HEAP_SOURCES _check.c _rectest.c hp_block.c hp_clear.c hp_close.c hp_create
hp_rrnd.c hp_rsame.c hp_scan.c hp_static.c hp_update.c hp_write.c)
MYSQL_ADD_PLUGIN(heap ${HEAP_SOURCES} STORAGE_ENGINE MANDATORY RECOMPILE_FOR_EMBEDDED)
+
+ADD_EXECUTABLE(hp_test1 hp_test1.c)
+TARGET_LINK_LIBRARIES(hp_test1 mysys heap dbug strings)
+
+ADD_EXECUTABLE(hp_test2 hp_test2.c)
+TARGET_LINK_LIBRARIES(hp_test2 mysys heap dbug strings)
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index 3abffc7087f..350958f8230 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -29,6 +29,10 @@
static handler *heap_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
+static int
+heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
+ HP_CREATE_INFO *hp_create_info);
+
int heap_panic(handlerton *hton, ha_panic_function flag)
{
@@ -96,43 +100,48 @@ const char **ha_heap::bas_ext() const
int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
- if ((test_if_locked & HA_OPEN_INTERNAL_TABLE) ||
- (!(file= heap_open(name, mode)) && my_errno == ENOENT))
+ internal_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE);
+ if (internal_table || (!(file= heap_open(name, mode)) && my_errno == ENOENT))
{
- HA_CREATE_INFO create_info;
- internal_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE);
- bzero(&create_info, sizeof(create_info));
+ HP_CREATE_INFO create_info;
+ my_bool created_new_share;
+ int rc;
file= 0;
- if (!create(name, table, &create_info))
+ if (heap_prepare_hp_create_info(table, internal_table, &create_info))
+ goto end;
+ create_info.pin_share= TRUE;
+
+ rc= heap_create(name, &create_info, &internal_share, &created_new_share);
+ my_free(create_info.keydef);
+ if (rc)
+ goto end;
+
+ implicit_emptied= test(created_new_share);
+ if (internal_table)
+ file= heap_open_from_share(internal_share, mode);
+ else
+ file= heap_open_from_share_and_register(internal_share, mode);
+
+ if (!file)
{
- file= internal_table ?
- heap_open_from_share(internal_share, mode) :
- heap_open_from_share_and_register(internal_share, mode);
- if (!file)
- {
- /* Couldn't open table; Remove the newly created table */
- mysql_mutex_lock(&THR_LOCK_heap);
- hp_free(internal_share);
- mysql_mutex_unlock(&THR_LOCK_heap);
- }
- implicit_emptied= 1;
+ heap_release_share(internal_share, internal_table);
+ goto end;
}
}
+
ref_length= sizeof(HEAP_PTR);
- if (file)
- {
- /* Initialize variables for the opened table */
- set_keys_for_scanning();
- /*
- We cannot run update_key_stats() here because we do not have a
- lock on the table. The 'records' count might just be changed
- temporarily at this moment and we might get wrong statistics (Bug
- #10178). Instead we request for update. This will be done in
- ha_heap::info(), which is always called before key statistics are
- used.
+ /* Initialize variables for the opened table */
+ set_keys_for_scanning();
+ /*
+ We cannot run update_key_stats() here because we do not have a
+ lock on the table. The 'records' count might just be changed
+ temporarily at this moment and we might get wrong statistics (Bug
+ #10178). Instead we request for update. This will be done in
+ ha_heap::info(), which is always called before key statistics are
+ used.
*/
- key_stat_version= file->s->key_stat_version-1;
- }
+ key_stat_version= file->s->key_stat_version-1;
+end:
return (file ? 0 : 1);
}
@@ -624,18 +633,20 @@ ha_rows ha_heap::records_in_range(uint inx, key_range *min_key,
}
-int ha_heap::create(const char *name, TABLE *table_arg,
- HA_CREATE_INFO *create_info)
+static int
+heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
+ HP_CREATE_INFO *hp_create_info)
{
uint key, parts, mem_per_row= 0, keys= table_arg->s->keys;
uint auto_key= 0, auto_key_type= 0;
ha_rows max_rows;
HP_KEYDEF *keydef;
HA_KEYSEG *seg;
- int error;
TABLE_SHARE *share= table_arg->s;
bool found_real_auto_increment= 0;
+ bzero(hp_create_info, sizeof(*hp_create_info));
+
for (key= parts= 0; key < keys; key++)
parts+= table_arg->key_info[key].key_parts;
@@ -715,29 +726,45 @@ int ha_heap::create(const char *name, TABLE *table_arg,
}
}
mem_per_row+= MY_ALIGN(share->reclength + 1, sizeof(char*));
- max_rows = (ha_rows) (table_arg->in_use->variables.max_heap_table_size /
- (ulonglong) mem_per_row);
if (table_arg->found_next_number_field)
{
keydef[share->next_number_index].flag|= HA_AUTO_KEY;
found_real_auto_increment= share->next_number_key_offset == 0;
}
+ hp_create_info->auto_key= auto_key;
+ hp_create_info->auto_key_type= auto_key_type;
+ hp_create_info->max_table_size=current_thd->variables.max_heap_table_size;
+ hp_create_info->with_auto_increment= found_real_auto_increment;
+ hp_create_info->internal_table= internal_table;
+
+ max_rows= (ha_rows) (hp_create_info->max_table_size / mem_per_row);
+ if (share->max_rows && share->max_rows < max_rows)
+ max_rows= share->max_rows;
+
+ hp_create_info->max_records= (ulong) max_rows;
+ hp_create_info->min_records= (ulong) share->min_rows;
+ hp_create_info->keys= share->keys;
+ hp_create_info->reclength= share->reclength;
+ hp_create_info->keydef= keydef;
+ return 0;
+}
+
+
+int ha_heap::create(const char *name, TABLE *table_arg,
+ HA_CREATE_INFO *create_info)
+{
+ int error;
+ my_bool created;
HP_CREATE_INFO hp_create_info;
- hp_create_info.auto_key= auto_key;
- hp_create_info.auto_key_type= auto_key_type;
+
+ error= heap_prepare_hp_create_info(table_arg, internal_table,
+ &hp_create_info);
+ if (error)
+ return error;
hp_create_info.auto_increment= (create_info->auto_increment_value ?
create_info->auto_increment_value - 1 : 0);
- hp_create_info.max_table_size=current_thd->variables.max_heap_table_size;
- hp_create_info.with_auto_increment= found_real_auto_increment;
- hp_create_info.internal_table= internal_table;
- max_rows = (ha_rows) (hp_create_info.max_table_size / mem_per_row);
- error= heap_create(name,
- keys, keydef, share->reclength,
- (ulong) ((share->max_rows < max_rows &&
- share->max_rows) ?
- share->max_rows : max_rows),
- (ulong) share->min_rows, &hp_create_info, &internal_share);
- my_free((uchar*) keydef, MYF(0));
+ error= heap_create(name, &hp_create_info, &internal_share, &created);
+ my_free(hp_create_info.keydef);
DBUG_ASSERT(file == 0);
return (error);
}
diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c
index c622a9e52f8..7f6cc1ef90a 100644
--- a/storage/heap/hp_block.c
+++ b/storage/heap/hp_block.c
@@ -145,7 +145,7 @@ uchar *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, uchar *last_pos)
}
if ((uchar*) pos != last_pos)
{
- my_free((uchar*) pos,MYF(0));
+ my_free(pos);
return last_pos;
}
return next_ptr; /* next memory position */
diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c
index 49d8ec376bb..e5a826423db 100644
--- a/storage/heap/hp_close.c
+++ b/storage/heap/hp_close.c
@@ -46,6 +46,6 @@ int hp_close(register HP_INFO *info)
heap_open_list=list_delete(heap_open_list,&info->open_list);
if (!--info->s->open_count && info->s->delete_on_close)
hp_free(info->s); /* Table was deleted */
- my_free((uchar*) info,MYF(0));
+ my_free(info);
DBUG_RETURN(error);
}
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c
index 85e632e5aad..bbf649c5e46 100644
--- a/storage/heap/hp_create.c
+++ b/storage/heap/hp_create.c
@@ -21,24 +21,30 @@ static void init_block(HP_BLOCK *block,uint reclength,ulong min_records,
/* Create a heap table */
-int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
- uint reclength, ulong max_records, ulong min_records,
- HP_CREATE_INFO *create_info, HP_SHARE **res)
+int heap_create(const char *name, HP_CREATE_INFO *create_info,
+ HP_SHARE **res, my_bool *created_new_share)
{
uint i, j, key_segs, max_length, length;
HP_SHARE *share= 0;
HA_KEYSEG *keyseg;
+ HP_KEYDEF *keydef= create_info->keydef;
+ uint reclength= create_info->reclength;
+ uint keys= create_info->keys;
+ ulong min_records= create_info->min_records;
+ ulong max_records= create_info->max_records;
DBUG_ENTER("heap_create");
if (!create_info->internal_table)
{
mysql_mutex_lock(&THR_LOCK_heap);
- if ((share= hp_find_named_heap(name)) && share->open_count == 0)
+ share= hp_find_named_heap(name);
+ if (share && share->open_count == 0)
{
hp_free(share);
share= 0;
}
- }
+ }
+ *created_new_share= (share == NULL);
if (!share)
{
@@ -183,7 +189,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
/* Must be allocated separately for rename to work */
if (!(share->name= my_strdup(name,MYF(0))))
{
- my_free((uchar*) share,MYF(0));
+ my_free(share);
goto err;
}
#ifdef THREAD
@@ -200,7 +206,11 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
share->delete_on_close= 1;
}
if (!create_info->internal_table)
+ {
+ if (create_info->pin_share)
+ ++share->open_count;
mysql_mutex_unlock(&THR_LOCK_heap);
+ }
*res= share;
DBUG_RETURN(0);
@@ -295,7 +305,7 @@ void hp_free(HP_SHARE *share)
thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->intern_lock);
#endif
- my_free((uchar*) share->name, MYF(0));
- my_free((uchar*) share, MYF(0));
+ my_free(share->name);
+ my_free(share);
return;
}
diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c
index aaaa0fe833f..f56df42aab3 100644
--- a/storage/heap/hp_hash.c
+++ b/storage/heap/hp_hash.c
@@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
}
else
{
- if (bcmp(rec1+seg->start,rec2+seg->start,seg->length))
+ if (memcmp(rec1+seg->start,rec2+seg->start,seg->length))
return 1;
}
}
@@ -660,7 +660,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
}
else
{
- if (bcmp(rec+seg->start,key,seg->length))
+ if (memcmp(rec+seg->start,key,seg->length))
return 1;
}
}
diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c
index feafa5d5cf1..12d9bfe1ed3 100644
--- a/storage/heap/hp_open.c
+++ b/storage/heap/hp_open.c
@@ -16,10 +16,6 @@
/* open a heap-database */
#include "heapdef.h"
-#ifdef VMS
-#include "hp_static.c" /* Stupid vms-linker */
-#endif
-
#include "my_sys.h"
/*
@@ -74,12 +70,33 @@ HP_INFO *heap_open_from_share_and_register(HP_SHARE *share, int mode)
{
info->open_list.data= (void*) info;
heap_open_list= list_add(heap_open_list,&info->open_list);
+ /* Unpin the share, it is now pinned by the file. */
+ share->open_count--;
}
mysql_mutex_unlock(&THR_LOCK_heap);
DBUG_RETURN(info);
}
+/**
+ Dereference a HEAP share and free it if it's not referenced.
+ We don't check open_count for internal tables since they
+ are always thread-local, i.e. referenced by a single thread.
+*/
+void heap_release_share(HP_SHARE *share, my_bool internal_table)
+{
+ /* Couldn't open table; Remove the newly created table */
+ if (internal_table)
+ hp_free(share);
+ else
+ {
+ mysql_mutex_lock(&THR_LOCK_heap);
+ if (--share->open_count == 0)
+ hp_free(share);
+ mysql_mutex_unlock(&THR_LOCK_heap);
+ }
+}
+
/*
Open heap table based on name
diff --git a/storage/heap/hp_rename.c b/storage/heap/hp_rename.c
index c4e8390cc43..cf0d2b2b387 100644
--- a/storage/heap/hp_rename.c
+++ b/storage/heap/hp_rename.c
@@ -33,7 +33,7 @@ int heap_rename(const char *old_name, const char *new_name)
mysql_mutex_unlock(&THR_LOCK_heap);
DBUG_RETURN(my_errno);
}
- my_free(info->name,MYF(0));
+ my_free(info->name);
info->name=name_buff;
}
mysql_mutex_unlock(&THR_LOCK_heap);
diff --git a/storage/heap/hp_test1.c b/storage/heap/hp_test1.c
index 911e3a285a2..535db60e237 100644
--- a/storage/heap/hp_test1.c
+++ b/storage/heap/hp_test1.c
@@ -38,6 +38,7 @@ int main(int argc, char **argv)
HA_KEYSEG keyseg[4];
HP_CREATE_INFO hp_create_info;
HP_SHARE *tmp_share;
+ my_bool unused;
MY_INIT(argv[0]);
filename= "test1";
@@ -45,6 +46,11 @@ int main(int argc, char **argv)
bzero(&hp_create_info, sizeof(hp_create_info));
hp_create_info.max_table_size= 1024L*1024L;
+ hp_create_info.keys= 1;
+ hp_create_info.keydef= keyinfo;
+ hp_create_info.reclength= 30;
+ hp_create_info.max_records= (ulong) flag*100000L;
+ hp_create_info.min_records= 10UL;
keyinfo[0].keysegs=1;
keyinfo[0].seg=keyseg;
@@ -55,13 +61,12 @@ int main(int argc, char **argv)
keyinfo[0].seg[0].charset= &my_charset_latin1;
keyinfo[0].seg[0].null_bit= 0;
keyinfo[0].flag = HA_NOSAME;
-
+
deleted=0;
bzero((uchar*) flags,sizeof(flags));
printf("- Creating heap-file\n");
- if (heap_create(filename,1,keyinfo,30,(ulong) flag*100000L,10L,
- &hp_create_info, &tmp_share) ||
+ if (heap_create(filename, &hp_create_info, &tmp_share, &unused) ||
!(file= heap_open(filename, 2)))
goto err;
printf("- Writing records:s\n");
diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c
index 8216c7360b4..1571fc98402 100644
--- a/storage/heap/hp_test2.c
+++ b/storage/heap/hp_test2.c
@@ -15,16 +15,6 @@
/* Test av isam-databas: stor test */
-#ifndef USE_MY_FUNC /* We want to be able to dbug this !! */
-#define USE_MY_FUNC
-#endif
-#ifdef DBUG_OFF
-#undef DBUG_OFF
-#endif
-#ifndef SAFEMALLOC
-#define SAFEMALLOC
-#endif
-
#include "heapdef.h" /* Because of hp_find_block */
#include <signal.h>
@@ -65,15 +55,21 @@ int main(int argc, char *argv[])
HEAP_PTR UNINIT_VAR(position);
HP_CREATE_INFO hp_create_info;
CHARSET_INFO *cs= &my_charset_latin1;
+ my_bool unused;
MY_INIT(argv[0]); /* init my_sys library & pthreads */
filename= "test2";
filename2= "test2_2";
file=file2=0;
get_options(argc,argv);
-
+
bzero(&hp_create_info, sizeof(hp_create_info));
hp_create_info.max_table_size= 1024L*1024L;
+ hp_create_info.keys= keys;
+ hp_create_info.keydef= keyinfo;
+ hp_create_info.reclength= reclength;
+ hp_create_info.max_records= (ulong) flag*100000L;
+ hp_create_info.min_records= (ulong) recant/2;
write_count=update=opt_delete=0;
key_check=0;
@@ -125,8 +121,7 @@ int main(int argc, char *argv[])
bzero((char*) key3,sizeof(key3));
printf("- Creating heap-file\n");
- if (heap_create(filename,keys,keyinfo,reclength,(ulong) flag*100000L,
- (ulong) recant/2, &hp_create_info, &tmp_share) ||
+ if (heap_create(filename, &hp_create_info, &tmp_share, &unused) ||
!(file= heap_open(filename, 2)))
goto err;
signal(SIGINT,endprog);
@@ -406,7 +401,7 @@ int main(int argc, char *argv[])
bmove(record2,record,reclength);
if (heap_rsame(file,record,-1) || heap_rsame(file,record2,2))
goto err;
- if (bcmp(record2,record,reclength))
+ if (memcmp(record2,record,reclength))
{
puts("heap_rsame didn't find right record");
goto end;
@@ -415,7 +410,7 @@ int main(int argc, char *argv[])
puts("- Test of read through position");
if (heap_rrnd(file,record,position))
goto err;
- if (bcmp(record3,record,reclength))
+ if (memcmp(record3,record,reclength))
{
puts("heap_frnd didn't find right record");
goto end;
@@ -563,8 +558,10 @@ int main(int argc, char *argv[])
heap_close(file2);
printf("- Creating output heap-file 2\n");
- if (heap_create(filename2, 1, keyinfo, reclength, 0L, 0L, &hp_create_info,
- &tmp_share) ||
+ hp_create_info.keys= 1;
+ hp_create_info.max_records= 0;
+ hp_create_info.min_records= 0;
+ if (heap_create(filename2, &hp_create_info, &tmp_share, &unused) ||
!(file2= heap_open_from_share_and_register(tmp_share, 2)))
goto err;
diff --git a/storage/ibmdb2i/Makefile.am b/storage/ibmdb2i/Makefile.am
index 041bdc270e4..a9977de895d 100644
--- a/storage/ibmdb2i/Makefile.am
+++ b/storage/ibmdb2i/Makefile.am
@@ -34,7 +34,7 @@ EXTRA_LTLIBRARIES = ha_ibmdb2i.la
pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@
ha_ibmdb2i_la_LIBADD = -liconv
ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
-ha_ibmdb2i_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+ha_ibmdb2i_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \
db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \
@@ -44,7 +44,7 @@ ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \
EXTRA_LIBRARIES = libibmdb2i.a
noinst_LIBRARIES = @plugin_ibmdb2i_static_target@
-libibmdb2i_a_CXXFLAGS = $(AM_CFLAGS)
+libibmdb2i_a_CXXFLAGS = $(AM_CXXFLAGS)
libibmdb2i_a_CFLAGS = $(AM_CFLAGS)
libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES)
diff --git a/storage/ibmdb2i/db2i_constraints.cc b/storage/ibmdb2i/db2i_constraints.cc
index cc2821238b6..3afa12032d0 100644
--- a/storage/ibmdb2i/db2i_constraints.cc
+++ b/storage/ibmdb2i/db2i_constraints.cc
@@ -421,7 +421,7 @@ void ha_ibmdb2i::free_foreign_key_create_info(char* info)
if (info)
{
- my_free(info, MYF(0));
+ my_free(info);
}
DBUG_VOID_RETURN;
}
diff --git a/storage/ibmdb2i/db2i_conversion.cc b/storage/ibmdb2i/db2i_conversion.cc
index 9a85eb01c9b..71a30802bf9 100644
--- a/storage/ibmdb2i/db2i_conversion.cc
+++ b/storage/ibmdb2i/db2i_conversion.cc
@@ -292,7 +292,7 @@ static void get_field_default_value(Field *field,
if (iconv(iconvD, (char**)&tempIn, &ilen, &tempOut, &olen, &substitutedChars) < 0)
{
warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- my_free(out, MYF(0));
+ my_free(out);
return;
}
// Now we process the converted string to represent it as
@@ -310,7 +310,7 @@ static void get_field_default_value(Field *field,
if (length > 16370)
{
warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name);
- my_free(out, MYF(0));
+ my_free(out);
return;
}
@@ -335,7 +335,7 @@ static void get_field_default_value(Field *field,
if (field->charset() == &my_charset_bin)
defaultClause.append(")");
- my_free(out, MYF(0));
+ my_free(out);
}
}
else
diff --git a/storage/ibmdb2i/db2i_file.cc b/storage/ibmdb2i/db2i_file.cc
index a16aa927527..2d83248eea7 100644
--- a/storage/ibmdb2i/db2i_file.cc
+++ b/storage/ibmdb2i/db2i_file.cc
@@ -280,12 +280,9 @@ void db2i_table::renameAssocFiles(const char* from, const char* to)
db2i_table::~db2i_table()
{
- if (blobFieldActualSizes)
- my_free(blobFieldActualSizes, MYF(0));
+ my_free(blobFieldActualSizes);
+ my_free(conversionDefinitions[toMySQL]);
- if (conversionDefinitions[toMySQL])
- my_free(conversionDefinitions[toMySQL], MYF(0));
-
if (logicalFiles)
{
for (int k = 0; k < logicalFileCount; ++k)
@@ -296,8 +293,8 @@ db2i_table::~db2i_table()
delete[] logicalFiles;
}
delete physicalFile;
-
- my_free(db2LibNameEbcdic, 0);
+
+ my_free(db2LibNameEbcdic);
}
void db2i_table::getDB2QualifiedName(char* to)
@@ -334,14 +331,14 @@ size_t db2i_table::smartFilenameToTableName(const char *in, char* out, size_t ou
if ((*cur <= 0x20) || (*cur >= 0x80))
{
strncpy(out, in, outlen);
- my_free(test, MYF(0));
+ my_free(test);
return min(outlen, strlen(out));
}
++cur;
}
strncpy(out, test, outlen);
- my_free(test, MYF(0));
+ my_free(test);
return min(outlen, strlen(out));
}
diff --git a/storage/ibmdb2i/db2i_file.h b/storage/ibmdb2i/db2i_file.h
index ff35a473b05..6cc6ae8947b 100644
--- a/storage/ibmdb2i/db2i_file.h
+++ b/storage/ibmdb2i/db2i_file.h
@@ -353,7 +353,7 @@ public:
db2i_ileBridge::getBridgeForThread()->deallocateFile(masterDefn);
if (db2FileName != (char*)db2Table->getDB2TableName(db2i_table::EBCDIC_NATIVE))
- my_free(db2FileName, MYF(0));
+ my_free(db2FileName);
}
// This is roughly equivalent to an "open". It tells ILE to allocate a descriptor
diff --git a/storage/ibmdb2i/db2i_global.h b/storage/ibmdb2i/db2i_global.h
index d201fbd8124..1cf8a9a7c61 100644
--- a/storage/ibmdb2i/db2i_global.h
+++ b/storage/ibmdb2i/db2i_global.h
@@ -131,7 +131,7 @@ void free_aligned(void* p)
{
if (likely(p))
{
- my_free(*(char**)((char*)p-sizeof(void*)), MYF(0));
+ my_free(*(char**)((char*)p-sizeof(void*)));
}
}
diff --git a/storage/ibmdb2i/db2i_ileBridge.cc b/storage/ibmdb2i/db2i_ileBridge.cc
index 68ae2c2bb72..fac98dd7107 100644
--- a/storage/ibmdb2i/db2i_ileBridge.cc
+++ b/storage/ibmdb2i/db2i_ileBridge.cc
@@ -102,7 +102,7 @@ db2i_ileBridge* db2i_ileBridge::createNewBridge(CONNECTION_HANDLE connID)
void db2i_ileBridge::destroyBridge(db2i_ileBridge* bridge)
{
bridge->freeErrorStorage();
- my_free(bridge, MYF(0));
+ my_free(bridge);
}
@@ -1306,7 +1306,7 @@ FILE_HANDLE db2i_ileBridge::PreservedHandleList::findAndRemove(const char* fileN
prev->next = next;
if (current == head)
head = next;
- my_free(current, MYF(0));
+ my_free(current);
DBUG_PRINT("db2i_ileBridge", ("Found handle %d for %s", uint32(tmp), fileName));
return tmp;
}
diff --git a/storage/ibmdb2i/db2i_ileBridge.h b/storage/ibmdb2i/db2i_ileBridge.h
index 10b9820d983..3a3ca141f69 100644
--- a/storage/ibmdb2i/db2i_ileBridge.h
+++ b/storage/ibmdb2i/db2i_ileBridge.h
@@ -320,7 +320,7 @@ public:
{
if (likely(connErrText))
{
- my_free(connErrText, MYF(0));
+ my_free(connErrText);
connErrText = NULL;
}
}
diff --git a/storage/ibmdb2i/ha_ibmdb2i.cc b/storage/ibmdb2i/ha_ibmdb2i.cc
index 81d7e59d8e3..947df8ad2fe 100644
--- a/storage/ibmdb2i/ha_ibmdb2i.cc
+++ b/storage/ibmdb2i/ha_ibmdb2i.cc
@@ -404,7 +404,7 @@ IBMDB2I_SHARE *ha_ibmdb2i::get_share(const char *table_name, TABLE *table)
error:
pthread_mutex_destroy(&share->mutex);
- my_free((uchar*) share, MYF(0));
+ my_free(share);
pthread_mutex_unlock(&ibmdb2i_mutex);
return NULL;
@@ -423,7 +423,7 @@ int ha_ibmdb2i::free_share(IBMDB2I_SHARE *share)
my_hash_delete(&ibmdb2i_open_tables, (uchar*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
- my_free(share, MYF(0));
+ my_free(share);
pthread_mutex_unlock(&ibmdb2i_mutex);
return 1;
}
@@ -571,9 +571,9 @@ ha_ibmdb2i::~ha_ibmdb2i()
DBUG_ASSERT(activeReferences == 0 || outstanding_start_bulk_insert);
if (indexHandles)
- my_free(indexHandles, MYF(0));
+ my_free(indexHandles);
if (indexReadSizeEstimates)
- my_free(indexReadSizeEstimates, MYF(0));
+ my_free(indexReadSizeEstimates);
cleanupBuffers();
}
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index fbb59b07dfe..218dbad2df0 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -101,7 +101,7 @@ IF(NOT CMAKE_CROSSCOMPILING)
#include <pthread.h>
#include <string.h>
- int main(int argc, char** argv) {
+ int main() {
pthread_t x1;
pthread_t x2;
pthread_t x3;
@@ -274,6 +274,7 @@ ELSEIF (MYSQL_VERSION_ID LESS "50137")
ELSE()
# New plugin support, cross-platform , base name for shared module is "ha_innodb"
MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
+ DEFAULT
MODULE_OUTPUT_NAME ha_innodb
LINK_LIBRARIES ${ZLIB_LIBRARY})
ENDIF()
diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am
index c15c46abaf0..7a6103d9e79 100644
--- a/storage/innobase/Makefile.am
+++ b/storage/innobase/Makefile.am
@@ -323,14 +323,14 @@ libinnobase_a_SOURCES= \
ut/ut0vec.c \
ut/ut0wqueue.c
-libinnobase_a_CXXFLAGS= $(AM_CFLAGS)
+libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS)
libinnobase_a_CFLAGS= $(AM_CFLAGS)
EXTRA_LTLIBRARIES= ha_innodb.la
pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@
ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir)
-ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
+ha_innodb_la_CXXFLAGS= $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS)
ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES)
diff --git a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c
index 5c4c8507a39..6824d0fa9f9 100644
--- a/storage/innobase/dict/dict0crea.c
+++ b/storage/innobase/dict/dict0crea.c
@@ -240,17 +240,29 @@ dict_build_table_def_step(
ibool is_path;
mtr_t mtr;
ulint space = 0;
+ ibool file_per_table;
ut_ad(mutex_own(&(dict_sys->mutex)));
table = node->table;
- dict_hdr_get_new_id(&table->id, NULL,
- srv_file_per_table ? &space : NULL);
+ /* Cache the global variable "srv_file_per_table" to
+ a local variable before using it. Please note
+ "srv_file_per_table" is not under dict_sys mutex
+ protection, and could be changed while executing
+ this function. So better to cache the current value
+ to a local variable, and all future reference to
+ "srv_file_per_table" should use this local variable. */
+ file_per_table = srv_file_per_table;
+
+ dict_hdr_get_new_id(&table->id, NULL, NULL);
thr_get_trx(thr)->table_id = table->id;
- if (srv_file_per_table) {
+ if (file_per_table) {
+ /* Get a new space id if srv_file_per_table is set */
+ dict_hdr_get_new_id(NULL, NULL, &space);
+
if (UNIV_UNLIKELY(space == ULINT_UNDEFINED)) {
return(DB_ERROR);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 3fc9865ffbf..bf0c5528933 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -187,10 +187,6 @@ static ulong innobase_active_counter = 0;
static hash_table_t* innobase_open_tables;
-#ifdef __NETWARE__ /* some special cleanup for NetWare */
-bool nw_panic = FALSE;
-#endif
-
/** Allowed values of innodb_change_buffering */
static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = {
"none", /* IBUF_USE_NONE */
@@ -429,7 +425,7 @@ static MYSQL_THDVAR_BOOL(table_locks, PLUGIN_VAR_OPCMDARG,
static MYSQL_THDVAR_BOOL(strict_mode, PLUGIN_VAR_OPCMDARG,
"Use strict mode when evaluating create options.",
- NULL, NULL, FALSE);
+ NULL, NULL, TRUE);
static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG,
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
@@ -2201,8 +2197,7 @@ innobase_init(
"InnoDB: syntax error in innodb_data_file_path");
mem_free_and_error:
srv_free_paths_and_sizes();
- my_free(internal_innobase_data_file_path,
- MYF(MY_ALLOW_ZERO_PTR));
+ my_free(internal_innobase_data_file_path);
goto error;
}
@@ -2473,11 +2468,6 @@ innobase_end(
DBUG_ENTER("innobase_end");
DBUG_ASSERT(hton == innodb_hton_ptr);
-#ifdef __NETWARE__ /* some special cleanup for NetWare */
- if (nw_panic) {
- set_panic_flag_for_netware();
- }
-#endif
if (innodb_inited) {
srv_fast_shutdown = (ulint) innobase_fast_shutdown;
@@ -2488,8 +2478,7 @@ innobase_end(
err = 1;
}
srv_free_paths_and_sizes();
- my_free(internal_innobase_data_file_path,
- MYF(MY_ALLOW_ZERO_PTR));
+ my_free(internal_innobase_data_file_path);
mysql_mutex_destroy(&innobase_share_mutex);
mysql_mutex_destroy(&prepare_commit_mutex);
mysql_mutex_destroy(&commit_threads_m);
@@ -3442,7 +3431,7 @@ innobase_build_index_translation(
func_exit:
if (!ret) {
/* Build translation table failed. */
- my_free(index_mapping, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(index_mapping);
share->idx_trans_tbl.array_size = 0;
share->idx_trans_tbl.index_count = 0;
@@ -3676,7 +3665,7 @@ retry:
"how you can resolve the problem.\n",
norm_name);
free_share(share);
- my_free(upd_buff, MYF(0));
+ my_free(upd_buff);
my_errno = ENOENT;
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
@@ -3692,7 +3681,7 @@ retry:
"how you can resolve the problem.\n",
norm_name);
free_share(share);
- my_free(upd_buff, MYF(0));
+ my_free(upd_buff);
my_errno = ENOENT;
dict_table_decrement_handle_count(ib_table, FALSE);
@@ -3886,7 +3875,7 @@ ha_innobase::close(void)
row_prebuilt_free(prebuilt, FALSE);
- my_free(upd_buff, MYF(0));
+ my_free(upd_buff);
free_share(share);
/* Tell InnoDB server that there might be work for
@@ -4142,6 +4131,11 @@ get_innobase_type_from_mysql_type(
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_LONG_BLOB:
return(DATA_BLOB);
+ case MYSQL_TYPE_NULL:
+ /* MySQL currently accepts "NULL" datatype, but will
+ reject such datatype in the next release. We will cope
+ with it and not trigger assertion failure in 5.1 */
+ break;
default:
ut_error;
}
@@ -6190,7 +6184,22 @@ create_table_def(
field = form->field[i];
col_type = get_innobase_type_from_mysql_type(&unsigned_type,
- field);
+ field);
+
+ if (!col_type) {
+ push_warning_printf(
+ (THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_CREATE_TABLE,
+ "Error creating table '%s' with "
+ "column '%s'. Please check its "
+ "column type and try to re-create "
+ "the table with an appropriate "
+ "column type.",
+ table->name, (char*) field->field_name);
+ goto err_col;
+ }
+
if (field->null_ptr) {
nulls_allowed = 0;
} else {
@@ -6248,7 +6257,7 @@ create_table_def(
if (dict_col_name_is_reserved(field->field_name)){
my_error(ER_WRONG_COLUMN_NAME, MYF(0),
field->field_name);
-
+err_col:
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
@@ -6408,7 +6417,7 @@ create_index(
error = convert_error_code_to_mysql(error, flags, NULL);
- my_free(field_lengths, MYF(0));
+ my_free(field_lengths);
DBUG_RETURN(error);
}
@@ -7220,7 +7229,7 @@ innobase_drop_database(
trx = innobase_trx_allocate(thd);
#endif
error = row_drop_database_for_mysql(namebuf, trx);
- my_free(namebuf, MYF(0));
+ my_free(namebuf);
/* Flush the log to reduce probability that the .frm files and
the InnoDB data dictionary get out-of-sync if the user runs
@@ -7296,8 +7305,8 @@ innobase_rename_table(
log_buffer_flush_to_disk();
}
- my_free(norm_to, MYF(0));
- my_free(norm_from, MYF(0));
+ my_free(norm_to);
+ my_free(norm_from);
return error;
}
@@ -7464,7 +7473,7 @@ ha_innobase::records_in_range(
mem_heap_free(heap);
func_exit:
- my_free(key_val_buff2, MYF(0));
+ my_free(key_val_buff2);
prebuilt->trx->op_info = (char*)"";
@@ -8473,7 +8482,7 @@ ha_innobase::free_foreign_key_create_info(
char* str) /*!< in, own: create info string to free */
{
if (str) {
- my_free(str, MYF(0));
+ my_free(str);
}
}
@@ -9017,7 +9026,7 @@ innodb_show_status(
STRING_WITH_LEN(""), str, flen)) {
result= TRUE;
}
- my_free(str, MYF(0));
+ my_free(str);
DBUG_RETURN(FALSE);
}
@@ -9288,10 +9297,9 @@ static void free_share(INNOBASE_SHARE* share)
thr_lock_delete(&share->lock);
/* Free any memory from index translation table */
- my_free(share->idx_trans_tbl.index_mapping,
- MYF(MY_ALLOW_ZERO_PTR));
+ my_free(share->idx_trans_tbl.index_mapping);
- my_free(share, MYF(0));
+ my_free(share);
/* TODO: invoke HASH_MIGRATE if innobase_open_tables
shrinks too much */
@@ -10806,25 +10814,19 @@ static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads,
static MYSQL_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown,
PLUGIN_VAR_OPCMDARG,
"Speeds up the shutdown process of the InnoDB storage engine. Possible "
- "values are 0, 1 (faster)"
- /*
- NetWare can't close unclosed files, can't automatically kill remaining
- threads, etc, so on this OS we disable the crash-like InnoDB shutdown.
- */
- IF_NETWARE("", " or 2 (fastest - crash-like)")
- ".",
- NULL, NULL, 1, 0, IF_NETWARE(1,2), 0);
+ "values are 0, 1 (faster) or 2 (fastest - crash-like).",
+ NULL, NULL, 1, 0, 2, 0);
static MYSQL_SYSVAR_BOOL(file_per_table, srv_file_per_table,
PLUGIN_VAR_NOCMDARG,
"Stores each InnoDB table to an .ibd file in the database dir.",
- NULL, NULL, FALSE);
+ NULL, NULL, TRUE);
static MYSQL_SYSVAR_STR(file_format, innobase_file_format_name,
PLUGIN_VAR_RQCMDARG,
"File format to use for new tables in .ibd files.",
innodb_file_format_name_validate,
- innodb_file_format_name_update, "Antelope");
+ innodb_file_format_name_update, "Barracuda");
/* "innobase_file_format_check" decides whether we would continue
booting the server if the file format stamped on the system
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index 7a9b4cffa2b..6d95b280330 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -201,12 +201,12 @@ various file I/O operations with performance schema.
used to register file creation, opening, closing and renaming.
2) register_pfs_file_io_begin() and register_pfs_file_io_end() are
used to register actual file read, write and flush */
-# define register_pfs_file_open_begin(locker, key, op, name, \
+# define register_pfs_file_open_begin(state, locker, key, op, name, \
src_file, src_line) \
do { \
if (PSI_server) { \
locker = PSI_server->get_thread_file_name_locker( \
- key, op, name, &locker); \
+ state, key, op, name, &locker); \
if (locker) { \
PSI_server->start_file_open_wait( \
locker, src_file, src_line); \
@@ -222,12 +222,12 @@ do { \
} \
} while (0)
-# define register_pfs_file_io_begin(locker, file, count, op, \
+# define register_pfs_file_io_begin(state, locker, file, count, op, \
src_file, src_line) \
do { \
if (PSI_server) { \
locker = PSI_server->get_thread_file_descriptor_locker( \
- file, op); \
+ state, file, op); \
if (locker) { \
PSI_server->start_file_wait( \
locker, count, src_file, src_line); \
@@ -391,8 +391,6 @@ os_io_init_simple(void);
/***********************************************************************//**
Creates a temporary file. This function is like tmpfile(3), but
the temporary file is created in the MySQL temporary directory.
-On Netware, this function is like tmpfile(3), because the C run-time
-library of Netware does not expose the delete-on-close flag.
@return temporary file handle, or NULL on error */
FILE*
@@ -1174,7 +1172,7 @@ os_file_get_status(
os_file_stat_t* stat_info); /*!< information of a file in a
directory */
-#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__)
+#if !defined(UNIV_HOTBACKUP)
/*********************************************************************//**
Creates a temporary file that will be deleted on close.
This function is defined in ha_innodb.cc.
@@ -1183,7 +1181,7 @@ UNIV_INTERN
int
innobase_mysql_tmpfile(void);
/*========================*/
-#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */
+#endif /* !UNIV_HOTBACKUP */
#if defined(LINUX_NATIVE_AIO)
diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic
index 32f0e7cf666..648070c6909 100644
--- a/storage/innobase/include/os0file.ic
+++ b/storage/innobase/include/os0file.ic
@@ -55,9 +55,10 @@ pfs_os_file_create_simple_func(
{
os_file_t file;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
/* register a file open or creation depending on "create_mode" */
- register_pfs_file_open_begin(locker, key,
+ register_pfs_file_open_begin(&state, locker, key,
((create_mode == OS_FILE_CREATE)
? PSI_FILE_CREATE
: PSI_FILE_OPEN),
@@ -101,9 +102,10 @@ pfs_os_file_create_simple_no_error_handling_func(
{
os_file_t file;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
/* register a file open or creation depending on "create_mode" */
- register_pfs_file_open_begin(locker, key,
+ register_pfs_file_open_begin(&state, locker, key,
((create_mode == OS_FILE_CREATE)
? PSI_FILE_CREATE
: PSI_FILE_OPEN),
@@ -153,9 +155,10 @@ pfs_os_file_create_func(
{
os_file_t file;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
/* register a file open or creation depending on "create_mode" */
- register_pfs_file_open_begin(locker, key,
+ register_pfs_file_open_begin(&state, locker, key,
((create_mode == OS_FILE_CREATE)
? PSI_FILE_CREATE
: PSI_FILE_OPEN),
@@ -183,9 +186,10 @@ pfs_os_file_close_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
/* register the file close */
- register_pfs_file_io_begin(locker, file, 0, PSI_FILE_CLOSE,
+ register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE,
src_file, src_line);
result = os_file_close_func(file);
@@ -230,9 +234,10 @@ pfs_os_aio_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
/* Register the read or write I/O depending on "type" */
- register_pfs_file_io_begin(locker, file, n,
+ register_pfs_file_io_begin(&state, locker, file, n,
(type == OS_FILE_WRITE)
? PSI_FILE_WRITE
: PSI_FILE_READ,
@@ -268,8 +273,9 @@ pfs_os_file_read_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
- register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ,
+ register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
src_file, src_line);
result = os_file_read_func(file, buf, offset, offset_high, n);
@@ -303,8 +309,9 @@ pfs_os_file_read_no_error_handling_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
- register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ,
+ register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
src_file, src_line);
result = os_file_read_no_error_handling_func(file, buf, offset,
@@ -339,8 +346,9 @@ pfs_os_file_write_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
- register_pfs_file_io_begin(locker, file, n, PSI_FILE_WRITE,
+ register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE,
src_file, src_line);
result = os_file_write_func(name, file, buf, offset, offset_high, n);
@@ -366,8 +374,9 @@ pfs_os_file_flush_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
- register_pfs_file_io_begin(locker, file, 0, PSI_FILE_SYNC,
+ register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC,
src_file, src_line);
result = os_file_flush_func(file);
@@ -395,8 +404,9 @@ pfs_os_file_rename_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
- register_pfs_file_open_begin(locker, key, PSI_FILE_RENAME, newpath,
+ register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath,
src_file, src_line);
result = os_file_rename_func(oldpath, newpath);
diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
index 8abf15da9c1..796d2cade3b 100644
--- a/storage/innobase/include/srv0start.h
+++ b/storage/innobase/include/srv0start.h
@@ -91,10 +91,6 @@ extern ib_uint64_t srv_shutdown_lsn;
/** Log sequence number immediately after startup */
extern ib_uint64_t srv_start_lsn;
-#ifdef __NETWARE__
-void set_panic_flag_for_netware(void);
-#endif
-
#ifdef HAVE_DARWIN_THREADS
/** TRUE if the F_FULLFSYNC option is available */
extern ibool srv_have_fullfsync;
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
index 73405759bce..2ffd9fdafb5 100644
--- a/storage/innobase/include/sync0rw.ic
+++ b/storage/innobase/include/sync0rw.ic
@@ -675,12 +675,13 @@ pfs_rw_lock_x_lock_func(
const char* file_name,/*!< in: file name where lock requested */
ulint line) /*!< in: line where requested */
{
- struct PSI_rwlock_locker* locker = NULL;
+ struct PSI_rwlock_locker* locker = NULL;
+ PSI_rwlock_locker_state state;
/* Record the entry of rw x lock request in performance schema */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
locker = PSI_server->get_thread_rwlock_locker(
- lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
+ &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
if (locker) {
PSI_server->start_rwlock_wrwait(locker,
@@ -709,13 +710,14 @@ pfs_rw_lock_x_lock_func_nowait(
requested */
ulint line) /*!< in: line where requested */
{
- struct PSI_rwlock_locker* locker = NULL;
+ struct PSI_rwlock_locker* locker = NULL;
+ PSI_rwlock_locker_state state;
ibool ret;
/* Record the entry of rw x lock request in performance schema */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
locker = PSI_server->get_thread_rwlock_locker(
- lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
+ &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
if (locker) {
PSI_server->start_rwlock_wrwait(locker,
@@ -764,12 +766,13 @@ pfs_rw_lock_s_lock_func(
requested */
ulint line) /*!< in: line where requested */
{
- struct PSI_rwlock_locker* locker = NULL;
+ struct PSI_rwlock_locker* locker = NULL;
+ PSI_rwlock_locker_state state;
/* Instrumented to inform we are aquiring a shared rwlock */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
locker = PSI_server->get_thread_rwlock_locker(
- lock->pfs_psi, PSI_RWLOCK_READLOCK);
+ &state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
if (locker) {
PSI_server->start_rwlock_rdwait(locker,
file_name, line);
@@ -798,14 +801,14 @@ pfs_rw_lock_s_lock_low(
const char* file_name, /*!< in: file name where lock requested */
ulint line) /*!< in: line where requested */
{
-
- struct PSI_rwlock_locker* locker = NULL;
+ struct PSI_rwlock_locker* locker = NULL;
+ PSI_rwlock_locker_state state;
ibool ret;
/* Instrumented to inform we are aquiring a shared rwlock */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
locker = PSI_server->get_thread_rwlock_locker(
- lock->pfs_psi, PSI_RWLOCK_READLOCK);
+ &state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
if (locker) {
PSI_server->start_rwlock_rdwait(locker,
file_name, line);
@@ -838,11 +841,7 @@ pfs_rw_lock_x_unlock_func(
{
/* Inform performance schema we are unlocking the lock */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
- struct PSI_thread* thread;
- thread = PSI_server->get_thread();
- if (thread) {
- PSI_server->unlock_rwlock(thread, lock->pfs_psi);
- }
+ PSI_server->unlock_rwlock(lock->pfs_psi);
}
rw_lock_x_unlock_func(
@@ -869,11 +868,7 @@ pfs_rw_lock_s_unlock_func(
{
/* Inform performance schema we are unlocking the lock */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
- struct PSI_thread* thread;
- thread = PSI_server->get_thread();
- if (thread) {
- PSI_server->unlock_rwlock(thread, lock->pfs_psi);
- }
+ PSI_server->unlock_rwlock(lock->pfs_psi);
}
rw_lock_s_unlock_func(
diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic
index cf080e2e3ce..2977f71154a 100644
--- a/storage/innobase/include/sync0sync.ic
+++ b/storage/innobase/include/sync0sync.ic
@@ -237,11 +237,12 @@ pfs_mutex_enter_func(
ulint line) /*!< in: line where locked */
{
struct PSI_mutex_locker* locker = NULL;
+ PSI_mutex_locker_state state;
int result = 0;
if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
locker = PSI_server->get_thread_mutex_locker(
- mutex->pfs_psi, PSI_MUTEX_LOCK);
+ &state, mutex->pfs_psi, PSI_MUTEX_LOCK);
if (locker) {
PSI_server->start_mutex_wait(locker, file_name, line);
}
@@ -270,11 +271,12 @@ pfs_mutex_enter_nowait_func(
{
ulint ret;
struct PSI_mutex_locker* locker = NULL;
+ PSI_mutex_locker_state state;
int result = 0;
if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
locker = PSI_server->get_thread_mutex_locker(
- mutex->pfs_psi, PSI_MUTEX_LOCK);
+ &state, mutex->pfs_psi, PSI_MUTEX_LOCK);
if (locker) {
PSI_server->start_mutex_wait(locker, file_name, line);
}
@@ -300,12 +302,7 @@ pfs_mutex_exit_func(
mutex_t* mutex) /*!< in: pointer to mutex */
{
if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
- struct PSI_thread* thread;
- thread = PSI_server->get_thread();
-
- if (thread) {
- PSI_server->unlock_mutex(thread, mutex->pfs_psi);
- }
+ PSI_server->unlock_mutex(mutex->pfs_psi);
}
mutex_exit_func(mutex);
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 8ca1c272b5d..863d8300438 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -115,7 +115,7 @@ if we are compiling on Windows. */
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
# include <sys/stat.h>
-# if !defined(__NETWARE__) && !defined(__WIN__)
+# if !defined(__WIN__)
# include <sys/mman.h> /* mmap() for os0proc.c */
# endif
diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h
index 78b525c38ab..d7ec90db0fb 100644
--- a/storage/innobase/include/ut0dbg.h
+++ b/storage/innobase/include/ut0dbg.h
@@ -54,29 +54,18 @@ ut_dbg_assertion_failed(
const char* file, /*!< in: source file containing the assertion */
ulint line); /*!< in: line number of the assertion */
-#ifdef __NETWARE__
-/** Flag for ignoring further assertion failures. This is set to TRUE
-when on NetWare there happens an InnoDB assertion failure or other
-fatal error condition that requires an immediate shutdown. */
-extern ibool panic_shutdown;
-/* Abort the execution. */
-void ut_dbg_panic(void);
-# define UT_DBG_PANIC ut_dbg_panic()
-/* Stop threads in ut_a(). */
-# define UT_DBG_STOP do {} while (0) /* We do not do this on NetWare */
-#else /* __NETWARE__ */
-# if defined(__WIN__) || defined(__INTEL_COMPILER)
-# undef UT_DBG_USE_ABORT
-# elif defined(__GNUC__) && (__GNUC__ > 2)
-# define UT_DBG_USE_ABORT
-# endif
-
-# ifndef UT_DBG_USE_ABORT
+#if defined(__WIN__) || defined(__INTEL_COMPILER)
+# undef UT_DBG_USE_ABORT
+#elif defined(__GNUC__) && (__GNUC__ > 2)
+# define UT_DBG_USE_ABORT
+#endif
+
+#ifndef UT_DBG_USE_ABORT
/** A null pointer that will be dereferenced to trigger a memory trap */
extern ulint* ut_dbg_null_ptr;
-# endif
+#endif
-# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
+#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/** If this is set to TRUE by ut_dbg_assertion_failed(), all threads
will stop at the next ut_a() or ut_ad(). */
extern ibool ut_dbg_stop_threads;
@@ -89,24 +78,23 @@ ut_dbg_stop_thread(
/*===============*/
const char* file,
ulint line);
-# endif
+#endif
-# ifdef UT_DBG_USE_ABORT
+#ifdef UT_DBG_USE_ABORT
/** Abort the execution. */
-# define UT_DBG_PANIC abort()
+# define UT_DBG_PANIC abort()
/** Stop threads (null operation) */
-# define UT_DBG_STOP do {} while (0)
-# else /* UT_DBG_USE_ABORT */
+# define UT_DBG_STOP do {} while (0)
+#else /* UT_DBG_USE_ABORT */
/** Abort the execution. */
-# define UT_DBG_PANIC \
+# define UT_DBG_PANIC \
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL
/** Stop threads in ut_a(). */
-# define UT_DBG_STOP do \
+# define UT_DBG_STOP do \
if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \
ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \
} while (0)
-# endif /* UT_DBG_USE_ABORT */
-#endif /* __NETWARE__ */
+#endif /* UT_DBG_USE_ABORT */
/** Abort execution if EXPR does not evaluate to nonzero.
@param EXPR assertion expression that should hold */
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index 6b17dccd2bf..65c5d65f860 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -632,7 +632,7 @@ os_file_handle_error_no_exit(
#undef USE_FILE_LOCK
#define USE_FILE_LOCK
-#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__)
+#if defined(UNIV_HOTBACKUP) || defined(__WIN__)
/* InnoDB Hot Backup does not lock the data files.
* On Windows, mandatory locking is used.
*/
@@ -692,35 +692,27 @@ os_io_init_simple(void)
/***********************************************************************//**
Creates a temporary file. This function is like tmpfile(3), but
the temporary file is created in the MySQL temporary directory.
-On Netware, this function is like tmpfile(3), because the C run-time
-library of Netware does not expose the delete-on-close flag.
@return temporary file handle, or NULL on error */
UNIV_INTERN
FILE*
os_file_create_tmpfile(void)
/*========================*/
{
-#ifdef __NETWARE__
- FILE* file = tmpfile();
-#else /* __NETWARE__ */
FILE* file = NULL;
int fd = innobase_mysql_tmpfile();
if (fd >= 0) {
file = fdopen(fd, "w+b");
}
-#endif /* __NETWARE__ */
if (!file) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: unable to create temporary file;"
" errno: %d\n", errno);
-#ifndef __NETWARE__
if (fd >= 0) {
close(fd);
}
-#endif /* !__NETWARE__ */
}
return(file);
@@ -1462,7 +1454,11 @@ try_again:
/* When srv_file_per_table is on, file creation failure may not
be critical to the whole instance. Do not crash the server in
- case of unknown errors. */
+ case of unknown errors.
+ Please note "srv_file_per_table" is a global variable with
+ no explicit synchronization protection. It could be
+ changed during this execution path. It might not have the
+ same value as the one when building the table definition */
if (srv_file_per_table) {
retry = os_file_handle_error_no_exit(name,
create_mode == OS_FILE_CREATE ?
@@ -1549,7 +1545,11 @@ try_again:
/* When srv_file_per_table is on, file creation failure may not
be critical to the whole instance. Do not crash the server in
- case of unknown errors. */
+ case of unknown errors.
+ Please note "srv_file_per_table" is a global variable with
+ no explicit synchronization protection. It could be
+ changed during this execution path. It might not have the
+ same value as the one when building the table definition */
if (srv_file_per_table) {
retry = os_file_handle_error_no_exit(name,
create_mode == OS_FILE_CREATE ?
diff --git a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c
index 48922886f23..0f56a608f38 100644
--- a/storage/innobase/os/os0proc.c
+++ b/storage/innobase/os/os0proc.c
@@ -145,7 +145,7 @@ skip:
os_fast_mutex_unlock(&ut_list_mutex);
UNIV_MEM_ALLOC(ptr, size);
}
-#elif defined __NETWARE__ || !defined OS_MAP_ANON
+#elif !defined OS_MAP_ANON
size = *n;
ptr = ut_malloc_low(size, TRUE, FALSE);
#else
@@ -213,7 +213,7 @@ os_mem_free_large(
os_fast_mutex_unlock(&ut_list_mutex);
UNIV_MEM_FREE(ptr, size);
}
-#elif defined __NETWARE__ || !defined OS_MAP_ANON
+#elif !defined OS_MAP_ANON
ut_free(ptr);
#else
if (munmap(ptr, size)) {
diff --git a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c
index b41d873a129..adc876be5d5 100644
--- a/storage/innobase/os/os0thread.c
+++ b/storage/innobase/os/os0thread.c
@@ -163,16 +163,6 @@ os_thread_create(
exit(1);
}
#endif
-#ifdef __NETWARE__
- ret = pthread_attr_setstacksize(&attr,
- (size_t) NW_THD_STACKSIZE);
- if (ret) {
- fprintf(stderr,
- "InnoDB: Error: pthread_attr_setstacksize"
- " returned %d\n", ret);
- exit(1);
- }
-#endif
os_mutex_enter(os_sync_mutex);
os_thread_count++;
os_mutex_exit(os_sync_mutex);
@@ -275,8 +265,6 @@ os_thread_sleep(
{
#ifdef __WIN__
Sleep((DWORD) tm / 1000);
-#elif defined(__NETWARE__)
- delay(tm / 1000);
#else
struct timeval t;
diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
index 417e125375a..38ec4bff08f 100644
--- a/storage/innobase/row/row0merge.c
+++ b/storage/innobase/row/row0merge.c
@@ -2169,8 +2169,9 @@ row_merge_file_create(
/* This temp file open does not go through normal
file APIs, add instrumentation to register with
performance schema */
- struct PSI_file_locker* locker = NULL;
- register_pfs_file_open_begin(locker, innodb_file_temp_key,
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+ register_pfs_file_open_begin(&state, locker, innodb_file_temp_key,
PSI_FILE_OPEN,
"Innodb Merge Temp File",
__FILE__, __LINE__);
@@ -2192,8 +2193,9 @@ row_merge_file_destroy(
merge_file_t* merge_file) /*!< out: merge file structure */
{
#ifdef UNIV_PFS_IO
- struct PSI_file_locker* locker = NULL;
- register_pfs_file_io_begin(locker, merge_file->fd, 0, PSI_FILE_CLOSE,
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+ register_pfs_file_io_begin(&state, locker, merge_file->fd, 0, PSI_FILE_CLOSE,
__FILE__, __LINE__);
#endif
if (merge_file->fd != -1) {
diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index d6ad554d41e..3d4aaa9d5d4 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -1239,14 +1239,6 @@ innobase_start_or_create_for_mysql(void)
maximum number of threads that can wait in the 'srv_conc array' for
their time to enter InnoDB. */
-#if defined(__NETWARE__)
-
- /* Create less event semaphores because Win 98/ME had
- difficulty creating 40000 event semaphores. Comment from
- Novell, Inc.: also, these just take a lot of memory on
- NetWare. */
- srv_max_n_threads = 1000;
-#else
if (srv_buf_pool_size >= 1000 * 1024 * 1024) {
/* If buffer pool is less than 1000 MB,
assume fewer threads. Also use only one
@@ -1263,7 +1255,7 @@ innobase_start_or_create_for_mysql(void)
especially in 64-bit
computers */
}
-#endif
+
err = srv_boot();
if (err != DB_SUCCESS) {
@@ -1940,9 +1932,6 @@ innobase_shutdown_for_mysql(void)
/*=============================*/
{
ulint i;
-#ifdef __NETWARE__
- extern ibool panic_shutdown;
-#endif
if (!srv_was_started) {
if (srv_is_being_started) {
ut_print_timestamp(stderr);
@@ -1971,10 +1960,7 @@ innobase_shutdown_for_mysql(void)
"InnoDB will do a crash recovery!\n");
}
-#ifdef __NETWARE__
- if (!panic_shutdown)
-#endif
- logs_empty_and_mark_files_at_shutdown();
+ logs_empty_and_mark_files_at_shutdown();
if (srv_conc_n_threads != 0) {
fprintf(stderr,
@@ -2141,12 +2127,4 @@ innobase_shutdown_for_mysql(void)
return((int) DB_SUCCESS);
}
-
-#ifdef __NETWARE__
-void set_panic_flag_for_netware()
-{
- extern ibool panic_shutdown;
- panic_shutdown = TRUE;
-}
-#endif /* __NETWARE__ */
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c
index 4484e6c36de..e79217d5b86 100644
--- a/storage/innobase/ut/ut0dbg.c
+++ b/storage/innobase/ut/ut0dbg.c
@@ -37,12 +37,7 @@ UNIV_INTERN ulint ut_dbg_zero = 0;
will stop at the next ut_a() or ut_ad(). */
UNIV_INTERN ibool ut_dbg_stop_threads = FALSE;
#endif
-#ifdef __NETWARE__
-/** Flag for ignoring further assertion failures. This is set to TRUE
-when on NetWare there happens an InnoDB assertion failure or other
-fatal error condition that requires an immediate shutdown. */
-UNIV_INTERN ibool panic_shutdown = FALSE;
-#elif !defined(UT_DBG_USE_ABORT)
+#ifndef UT_DBG_USE_ABORT
/** A null pointer that will be dereferenced to trigger a memory trap */
UNIV_INTERN ulint* ut_dbg_null_ptr = NULL;
#endif
@@ -86,22 +81,7 @@ ut_dbg_assertion_failed(
#endif
}
-#ifdef __NETWARE__
-/*************************************************************//**
-Shut down MySQL/InnoDB after assertion failure. */
-UNIV_INTERN
-void
-ut_dbg_panic(void)
-/*==============*/
-{
- if (!panic_shutdown) {
- panic_shutdown = TRUE;
- innobase_shutdown_for_mysql();
- }
- exit(1);
-}
-#else /* __NETWARE__ */
-# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
+#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/*************************************************************//**
Stop a thread after assertion failure. */
UNIV_INTERN
@@ -117,8 +97,7 @@ ut_dbg_stop_thread(
os_thread_sleep(1000000000);
#endif /* !UNIV_HOTBACKUP */
}
-# endif
-#endif /* __NETWARE__ */
+#endif
#ifdef UNIV_COMPILE_TEST_FUNCS
diff --git a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c
index f2baab67f09..53f15029e1b 100644
--- a/storage/innobase/ut/ut0mem.c
+++ b/storage/innobase/ut/ut0mem.c
@@ -179,9 +179,6 @@ retry:
/* Make an intentional seg fault so that we get a stack
trace */
- /* Intentional segfault on NetWare causes an abend. Avoid this
- by graceful exit handling in ut_a(). */
-#if (!defined __NETWARE__)
if (assert_on_error) {
ut_print_timestamp(stderr);
@@ -194,9 +191,6 @@ retry:
} else {
return(NULL);
}
-#else
- ut_a(0);
-#endif
}
if (set_to_zero) {
diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt
index b057a62a6dd..b057a62a6dd 100755..100644
--- a/storage/myisam/CMakeLists.txt
+++ b/storage/myisam/CMakeLists.txt
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 52ad6b11aa1..33c1e092a00 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -608,7 +608,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query,
return ftb;
err:
free_root(& ftb->mem_root, MYF(0));
- my_free((uchar*)ftb,MYF(0));
+ my_free(ftb);
return 0;
}
@@ -1032,7 +1032,7 @@ void ft_boolean_close_search(FT_INFO *ftb)
delete_tree(& ftb->no_dupes);
}
free_root(& ftb->mem_root, MYF(0));
- my_free((uchar*)ftb,MYF(0));
+ my_free(ftb);
}
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index 5317da78ee4..7d9b13b7714 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -357,7 +357,7 @@ float ft_nlq_find_relevance(FT_INFO *handler,
void ft_nlq_close_search(FT_INFO *handler)
{
- my_free((uchar*)handler,MYF(0));
+ my_free(handler);
}
diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c
index 9838b15af34..1467cc56759 100644
--- a/storage/myisam/ft_stopwords.c
+++ b/storage/myisam/ft_stopwords.c
@@ -38,7 +38,7 @@ static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action,
void *arg __attribute__((unused)))
{
if (action == free_free)
- my_free((uchar*) w->pos, MYF(0));
+ my_free((void*)w->pos);
}
static int ft_add_stopword(const char *w)
@@ -87,7 +87,7 @@ int ft_init_stopwords()
}
error=0;
err1:
- my_free(buffer, MYF(0));
+ my_free(buffer);
err0:
my_close(fd, MYF(MY_WME));
return error;
@@ -121,7 +121,7 @@ void ft_free_stopwords()
if (stopwords3)
{
delete_tree(stopwords3); /* purecov: inspected */
- my_free((char*) stopwords3,MYF(0));
+ my_free(stopwords3);
stopwords3=0;
}
ft_stopword_file= 0;
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index e0e104a4878..87de58076cd 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -756,7 +756,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
recinfo must be freed.
*/
if (recinfo)
- my_free((uchar*) recinfo, MYF(0));
+ my_free(recinfo);
return my_errno;
}
@@ -1883,7 +1883,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
records, recinfo,
0, (MI_UNIQUEDEF*) 0,
&create_info, create_flags);
- my_free((uchar*) recinfo, MYF(0));
+ my_free(recinfo);
DBUG_RETURN(error);
}
@@ -2069,7 +2069,7 @@ mysql_declare_plugin(myisam)
&myisam_storage_engine,
"MyISAM",
"MySQL AB",
- "Default engine as of MySQL 3.23 with great performance",
+ "MyISAM storage engine",
PLUGIN_LICENSE_GPL,
myisam_init, /* Plugin Init */
NULL, /* Plugin Deinit */
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 0bcc022a0dc..13427130069 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -1369,12 +1369,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
printf("Lost space: %12s Linkdata: %10s\n",
llstr(empty,llbuff),llstr(link_used,llbuff2));
}
- my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
+ my_free(mi_get_rec_buff_ptr(info, record));
DBUG_RETURN (error);
err:
mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff));
err2:
- my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
+ my_free(mi_get_rec_buff_ptr(info, record));
param->testflag|=T_RETRY_WITHOUT_QUICK;
DBUG_RETURN(1);
} /* chk_data_link */
@@ -1736,6 +1736,21 @@ err:
{
mysql_file_close(new_file, MYF(0));
info->dfile=new_file= -1;
+ /*
+ On Windows, the old data file cannot be deleted if it is either
+ open, or memory mapped. Closing the file won't remove the memory
+ map implicilty on Windows. We closed the data file, but we keep
+ the MyISAM table open. A memory map will be closed on the final
+ mi_close() only. So we need to unmap explicitly here. After
+ renaming the new file under the hook, we couldn't use the map of
+ the old file any more anyway.
+ */
+ if (info->s->file_map)
+ {
+ (void) my_munmap((char*) info->s->file_map,
+ (size_t) info->s->mmaped_length);
+ info->s->file_map= NULL;
+ }
if (change_to_newfile(share->data_file_name,MI_NAME_DEXT,
DATA_TMP_EXT, share->base.raid_chunks,
(param->testflag & T_BACKUP_DATA ?
@@ -1759,11 +1774,9 @@ err:
}
mi_mark_crashed_on_repair(info);
}
- my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff),
- MYF(MY_ALLOW_ZERO_PTR));
- my_free(mi_get_rec_buff_ptr(info, sort_param.record),
- MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff));
+ my_free(mi_get_rec_buff_ptr(info, sort_param.record));
+ my_free(sort_info.buff);
(void) end_io_cache(&param->read_cache);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
(void) end_io_cache(&info->rec_cache);
@@ -2193,11 +2206,11 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
mysql_file_write(to, (uchar*) buff, (uint) length, param->myf_rw))
goto err;
if (buff != tmp_buff)
- my_free(buff,MYF(0));
+ my_free(buff);
DBUG_RETURN(0);
err:
if (buff != tmp_buff)
- my_free(buff,MYF(0));
+ my_free(buff);
mi_check_print_error(param,"Can't copy %s to tempfile, error %d",
type,my_errno);
DBUG_RETURN(1);
@@ -2580,13 +2593,11 @@ err:
share->state.changed&= ~STATE_NOT_OPTIMIZED_KEYS;
share->state.changed|=STATE_NOT_SORTED_PAGES;
- my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff),
- MYF(MY_ALLOW_ZERO_PTR));
- my_free(mi_get_rec_buff_ptr(info, sort_param.record),
- MYF(MY_ALLOW_ZERO_PTR));
- my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
- my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff));
+ my_free(mi_get_rec_buff_ptr(info, sort_param.record));
+ my_free(sort_info.key_block);
+ my_free(sort_info.ft_buf);
+ my_free(sort_info.buff);
(void) end_io_cache(&param->read_cache);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
if (!got_error && (param->testflag & T_UNPACK))
@@ -3127,10 +3138,10 @@ err:
mysql_mutex_destroy(&param->print_msg_mutex);
param->need_print_msg_lock= 0;
- my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
- my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
- my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sort_info.ft_buf);
+ my_free(sort_info.key_block);
+ my_free(sort_param);
+ my_free(sort_info.buff);
(void) end_io_cache(&param->read_cache);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
if (!got_error && (param->testflag & T_UNPACK))
@@ -4536,7 +4547,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
if (my_errno != HA_ERR_END_OF_FILE)
{
mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
- my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
+ my_free(mi_get_rec_buff_ptr(info, record));
mi_check_print_error(param,"%d when reading last record",my_errno);
DBUG_VOID_RETURN;
}
@@ -4551,7 +4562,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
set_if_bigger(info->s->state.auto_increment, param->auto_increment_value);
}
mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
- my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
+ my_free(mi_get_rec_buff_ptr(info, record));
update_state_info(param, info, UPDATE_AUTO_INC);
DBUG_VOID_RETURN;
}
diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c
index 8ec0bf14e0a..51408ab191c 100644
--- a/storage/myisam/mi_close.c
+++ b/storage/myisam/mi_close.c
@@ -57,7 +57,7 @@ int mi_close(register MI_INFO *info)
myisam_open_list=list_delete(myisam_open_list,&info->open_list);
mysql_mutex_unlock(&share->intern_lock);
- my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mi_get_rec_buff_ptr(info, info->rec_buff));
if (flag)
{
DBUG_EXECUTE_IF("crash_before_flush_keys",
@@ -88,8 +88,8 @@ int mi_close(register MI_INFO *info)
#endif
if (share->decode_trees)
{
- my_free((uchar*) share->decode_trees,MYF(0));
- my_free((uchar*) share->decode_tables,MYF(0));
+ my_free(share->decode_trees);
+ my_free(share->decode_tables);
}
#ifdef THREAD
thr_lock_delete(&share->lock);
@@ -103,19 +103,19 @@ int mi_close(register MI_INFO *info)
}
}
#endif
- my_free((uchar*) info->s,MYF(0));
+ my_free(info->s);
}
mysql_mutex_unlock(&THR_LOCK_myisam);
if (info->ftparser_param)
{
- my_free((uchar*)info->ftparser_param, MYF(0));
+ my_free(info->ftparser_param);
info->ftparser_param= 0;
}
if (info->dfile >= 0 && mysql_file_close(info->dfile, MYF(0)))
error = my_errno;
myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error);
- my_free((uchar*) info,MYF(0));
+ my_free(info);
if (error)
{
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 3db03e23637..4a91c2d939b 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -19,12 +19,8 @@
#include "sp_defs.h"
#include <my_bit.h>
-#if defined(MSDOS) || defined(__WIN__)
#ifdef __WIN__
#include <fcntl.h>
-#else
-#include <process.h> /* Prototype for getpid */
-#endif
#endif
#include <m_ctype.h>
@@ -834,7 +830,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
mysql_mutex_unlock(&THR_LOCK_myisam);
if (mysql_file_close(file, MYF(0)))
goto err;
- my_free((char*) rec_per_key_part,MYF(0));
+ my_free(rec_per_key_part);
DBUG_RETURN(0);
err:
@@ -860,7 +856,7 @@ err:
MY_UNPACK_FILENAME | MY_APPEND_EXT),
MYF(0));
}
- my_free((char*) rec_per_key_part, MYF(0));
+ my_free(rec_per_key_part);
DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */
}
diff --git a/storage/myisam/mi_dbug.c b/storage/myisam/mi_dbug.c
index 45882eda6af..e450e81cecb 100644
--- a/storage/myisam/mi_dbug.c
+++ b/storage/myisam/mi_dbug.c
@@ -164,7 +164,19 @@ void _mi_print_key(FILE *stream, register HA_KEYSEG *keyseg,
} /* print_key */
-#ifdef EXTRA_DEBUG
+#ifdef EXTRA_DEBUG
+/**
+ Check if the named table is in the open list.
+
+ @param[in] name table path as in MYISAM_SHARE::unique_file_name
+ @param[in] where verbal description of caller
+
+ @retval TRUE table is in open list
+ @retval FALSE table is not in open list
+
+ @note This function takes THR_LOCK_myisam. Do not call it when
+ this mutex is locked by this thread already.
+*/
my_bool check_table_is_closed(const char *name, const char *where)
{
@@ -173,6 +185,7 @@ my_bool check_table_is_closed(const char *name, const char *where)
DBUG_ENTER("check_table_is_closed");
(void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32);
+ mysql_mutex_lock(&THR_LOCK_myisam);
for (pos=myisam_open_list ; pos ; pos=pos->next)
{
MI_INFO *info=(MI_INFO*) pos->data;
@@ -181,12 +194,14 @@ my_bool check_table_is_closed(const char *name, const char *where)
{
if (share->last_version)
{
+ mysql_mutex_unlock(&THR_LOCK_myisam);
fprintf(stderr,"Warning: Table: %s is open on %s\n", name,where);
DBUG_PRINT("warning",("Table: %s is open on %s", name,where));
DBUG_RETURN(1);
}
}
}
+ mysql_mutex_unlock(&THR_LOCK_myisam);
DBUG_RETURN(0);
}
#endif /* EXTRA_DEBUG */
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index 02a8f21e3e2..59b895b5e64 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -44,7 +44,7 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
#undef my_alloca
#undef my_afree
#define my_alloca(A) my_malloc((A),MYF(0))
-#define my_afree(A) my_free((A),MYF(0))
+#define my_afree(A) my_free((A))
#endif
/* Interface function from MI_INFO */
@@ -1575,7 +1575,7 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
error=mi_unique_comp(def, record, old_record, def->null_are_equal);
if (info->s->base.blobs)
{
- my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mi_get_rec_buff_ptr(info, info->rec_buff));
info->rec_buff=rec_buff;
}
my_afree(old_record);
diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c
index 54498393f15..f6bbaab1f87 100644
--- a/storage/myisam/mi_log.c
+++ b/storage/myisam/mi_log.c
@@ -19,14 +19,8 @@
*/
#include "myisamdef.h"
-#if defined(MSDOS) || defined(__WIN__)
+#ifdef __WIN__
#include <fcntl.h>
-#ifndef __WIN__
-#include <process.h>
-#endif
-#endif
-#ifdef VMS
-#include <processes.h>
#endif
#undef GETPID /* For HPUX */
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 1d877748b31..5b3da9841b8 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -20,15 +20,8 @@
#include "rt_index.h"
#include <m_ctype.h>
-#if defined(MSDOS) || defined(__WIN__)
#ifdef __WIN__
#include <fcntl.h>
-#else
-#include <process.h> /* Prototype for getpid */
-#endif
-#endif
-#ifdef VMS
-#include "static.c"
#endif
static void setup_key_functions(MI_KEYDEF *keyinfo);
@@ -676,7 +669,7 @@ err:
mi_report_error(save_errno, name);
switch (errpos) {
case 6:
- my_free((uchar*) m_info,MYF(0));
+ my_free(m_info);
/* fall through */
case 5:
(void) mysql_file_close(info.dfile, MYF(0));
@@ -684,7 +677,7 @@ err:
break; /* Don't remove open table */
/* fall through */
case 4:
- my_free((uchar*) share,MYF(0));
+ my_free(share);
/* fall through */
case 3:
if (! lock_error)
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index 580c58e6ea1..0ba495fdd68 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -298,9 +298,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
err3:
my_errno=HA_ERR_WRONG_IN_RECORD;
err2:
- my_free((uchar*) share->decode_tables,MYF(0));
+ my_free(share->decode_tables);
err1:
- my_free((uchar*) share->decode_trees,MYF(0));
+ my_free(share->decode_trees);
err0:
DBUG_RETURN(1);
}
diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c
index ae45014eab5..31537f7054b 100644
--- a/storage/myisam/mi_preload.c
+++ b/storage/myisam/mi_preload.c
@@ -113,11 +113,11 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
}
while (pos != key_file_length);
- my_free((char*) buff, MYF(0));
+ my_free(buff);
DBUG_RETURN(0);
err:
- my_free((char*) buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buff);
DBUG_RETURN(my_errno= errno);
}
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index c7ebf9ae220..24456e3d8fa 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -84,7 +84,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,
test(!(nextflag & SEARCH_SAVE_BUFF)))))
goto err;
- DBUG_DUMP("page",(uchar*) buff,mi_getint(buff));
+ DBUG_DUMP("page", buff, mi_getint(buff));
flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag,
&keypos,lastkey, &last_key);
@@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_PRINT("error",
("Found too long null packed key: %u of %u at 0x%lx",
length, keyseg->length, (long) *page_pos));
- DBUG_DUMP("key",(uchar*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
return 0;
@@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
{
DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx",
length, keyseg->length, (long) *page_pos));
- DBUG_DUMP("key",(uchar*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
return 0; /* Error */
@@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_PRINT("error",
("Found too long binary packed key: %u of %u at 0x%lx",
length, keyinfo->maxlength, (long) *page_pos));
- DBUG_DUMP("key",(uchar*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); /* Wrong key */
diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c
index 81d063a58fd..baa01a507eb 100644
--- a/storage/myisam/mi_static.c
+++ b/storage/myisam/mi_static.c
@@ -23,9 +23,9 @@
#endif
LIST *myisam_open_list=0;
-uchar NEAR myisam_file_magic[]=
+uchar myisam_file_magic[]=
{ (uchar) 254, (uchar) 254,'\007', '\001', };
-uchar NEAR myisam_pack_file_magic[]=
+uchar myisam_pack_file_magic[]=
{ (uchar) 254, (uchar) 254,'\010', '\002', };
char * myisam_log_filename=(char*) "myisam.log";
File myisam_log_file= -1;
@@ -55,7 +55,7 @@ int (*myisam_test_invalid_symlink)(const char *filename)= always_valid;
Position is , == , >= , <= , > , <
*/
-uint NEAR myisam_read_vec[]=
+uint myisam_read_vec[]=
{
SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER,
SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER,
@@ -63,7 +63,7 @@ uint NEAR myisam_read_vec[]=
MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL
};
-uint NEAR myisam_readnext_vec[]=
+uint myisam_readnext_vec[]=
{
SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER,
SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c
index 63525b08820..513b390ee68 100644
--- a/storage/myisam/mi_test2.c
+++ b/storage/myisam/mi_test2.c
@@ -21,9 +21,6 @@
#ifdef DBUG_OFF
#undef DBUG_OFF
#endif
-#ifndef SAFEMALLOC
-#define SAFEMALLOC
-#endif
#include "myisamdef.h"
#include <m_ctype.h>
#include <my_bit.h>
@@ -31,7 +28,7 @@
#define STANDARD_LENGTH 37
#define MYISAM_KEYS 6
#define MAX_PARTS 4
-#if !defined(MSDOS) && !defined(labs)
+#if !defined(labs)
#define labs(a) abs(a)
#endif
@@ -415,7 +412,7 @@ int main(int argc, char *argv[])
}
ant=0;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys)
{
printf("prev: Found: %d records of %d\n",ant,dupp_keys);
@@ -453,7 +450,7 @@ int main(int argc, char *argv[])
goto end;
}
if (mi_rlast(file,read_record2,0) ||
- bcmp(read_record2,read_record3,reclength))
+ memcmp(read_record2,read_record3,reclength))
{
printf("Can't find last record\n");
DBUG_DUMP("record2",(uchar*) read_record2,reclength);
@@ -468,7 +465,7 @@ int main(int argc, char *argv[])
printf("prev: I found: %d records of %d\n",ant,write_count);
goto end;
}
- if (bcmp(read_record,read_record3,reclength))
+ if (memcmp(read_record,read_record3,reclength))
{
printf("Can't find first record\n");
goto end;
@@ -483,7 +480,7 @@ int main(int argc, char *argv[])
mi_rprev(file,read_record3,0) == 0 ||
mi_rnext(file,read_record3,0))
goto err;
- if (bcmp(read_record,read_record3,reclength) != 0)
+ if (memcmp(read_record,read_record3,reclength) != 0)
printf("Can't find first record\n");
if (!silent)
@@ -495,7 +492,7 @@ int main(int argc, char *argv[])
mi_rnext(file,read_record3,0) == 0 ||
mi_rprev(file,read_record3,0))
goto err;
- if (bcmp(read_record2,read_record3,reclength))
+ if (memcmp(read_record2,read_record3,reclength))
printf("Can't find last record\n");
#ifdef NOT_ANYMORE
if (!silent)
@@ -509,7 +506,7 @@ int main(int argc, char *argv[])
bzero((char*) file->lastkey,file->s->base.max_key_length*2);
if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX))
goto err;
- if (bcmp(read_record+start,key,(uint) i))
+ if (memcmp(read_record+start,key,(uint) i))
{
puts("Didn't find right record");
goto end;
@@ -528,7 +525,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=1;
while (mi_rnext(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-1)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-1);
@@ -546,7 +543,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=1;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-2)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-2);
@@ -566,7 +563,7 @@ int main(int argc, char *argv[])
if (mi_rnext(file,read_record,0))
goto err; /* Skall finnas poster */
while (mi_rnext(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-3)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-3);
@@ -581,7 +578,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=0;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-4)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-4);
@@ -604,7 +601,7 @@ int main(int argc, char *argv[])
for (i=min(2,keys) ; i-- > 0 ;)
{
if (mi_rsame(file,read_record2,(int) i)) goto err;
- if (bcmp(read_record,read_record2,reclength) != 0)
+ if (memcmp(read_record,read_record2,reclength) != 0)
{
printf("is_rsame didn't find same record\n");
goto end;
@@ -856,7 +853,7 @@ reads: %10lu\n",
}
end_key_cache(dflt_key_cache,1);
if (blob_buffer)
- my_free(blob_buffer,MYF(0));
+ my_free(blob_buffer);
my_end(silent ? MY_CHECK_ERROR : MY_CHECK_ERROR | MY_GIVE_INFO);
return(0);
err:
diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c
index 7b16d6c05d6..bf36d8df7f4 100644
--- a/storage/myisam/mi_test3.c
+++ b/storage/myisam/mi_test3.c
@@ -15,8 +15,6 @@
/* Test av locking */
-#ifndef __NETWARE__
-
#include "myisam.h"
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
@@ -489,15 +487,3 @@ int test_update(MI_INFO *file,int id,int lock_type)
}
#include "mi_extrafunc.h"
-
-#else /* __NETWARE__ */
-
-#include <stdio.h>
-
-main()
-{
- fprintf(stderr,"this test has not been ported to NetWare\n");
- return 0;
-}
-
-#endif /* __NETWARE__ */
diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c
index 02fcd9289dd..fdba84a2e67 100644
--- a/storage/myisam/mi_unique.c
+++ b/storage/myisam/mi_unique.c
@@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record,
if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey,
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
info->s->state.key_root[def->key]) ||
- bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH))
+ memcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH))
{
info->page_changed=1; /* Can't optimize read next */
info->lastpos=lastpos;
diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c
index 5b46db111b3..f2d43585eef 100644
--- a/storage/myisam/mi_write.c
+++ b/storage/myisam/mi_write.c
@@ -286,7 +286,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr, uchar *key,
if (!error)
error= _mi_ft_convert_to_ft2(info, keynr, key);
delete_dynamic(info->ft1_to_ft2);
- my_free((uchar*)info->ft1_to_ft2, MYF(0));
+ my_free(info->ft1_to_ft2);
info->ft1_to_ft2=0;
}
DBUG_RETURN(error);
@@ -1045,7 +1045,7 @@ void mi_end_bulk_insert(MI_INFO *info)
delete_tree(& info->bulk_insert[i]);
}
}
- my_free((void *)info->bulk_insert, MYF(0));
+ my_free(info->bulk_insert);
info->bulk_insert=0;
}
}
diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c
index 74fa506a5b5..4718abc3481 100644
--- a/storage/myisam/myisam_ftdump.c
+++ b/storage/myisam/myisam_ftdump.c
@@ -253,18 +253,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return 0;
}
-#include <help_start.h>
static void usage()
{
printf("Use: myisam_ftdump <table_name> <index_num>\n");
my_print_help(my_long_options);
my_print_variables(my_long_options);
- NETWARE_SET_SCREEN_MODE(1);
exit(1);
}
-#include <help_end.h>
static void complain(int val) /* Kinda assert :-) */
{
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 11ec52fd123..e1cedf6bc31 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -148,7 +148,7 @@ enum options_mc {
OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE,
OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN,
OPT_FT_MAX_WORD_LEN, OPT_FT_STOPWORD_FILE,
- OPT_MAX_RECORD_LENGTH, OPT_AUTO_CLOSE, OPT_STATS_METHOD
+ OPT_MAX_RECORD_LENGTH, OPT_STATS_METHOD
};
static struct my_option my_long_options[] =
@@ -156,10 +156,6 @@ static struct my_option my_long_options[] =
{"analyze", 'a',
"Analyze distribution of keys. Will make some joins in MySQL faster. You can check the calculated distribution.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"block-search", 'b',
"No help available.",
0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -336,13 +332,10 @@ static struct my_option my_long_options[] =
};
-#include <help_start.h>
-
static void print_version(void)
{
printf("%s Ver 2.7 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
}
@@ -364,7 +357,7 @@ static void usage(void)
-?, --help Display this help and exit.\n\
-t, --tmpdir=path Path for temporary files. Multiple paths can be\n\
specified, separated by ");
-#if defined( __WIN__) || defined(__NETWARE__)
+#if defined( __WIN__)
printf("semicolon (;)");
#else
printf("colon (:)");
@@ -460,7 +453,6 @@ static void usage(void)
my_print_variables(my_long_options);
}
-#include <help_end.h>
const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal",
"nulls_ignored", NullS};
@@ -476,11 +468,6 @@ get_one_option(int optid,
char *argument)
{
switch (optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case 'a':
if (argument == disabled_my_option)
check_param.testflag&= ~T_STATISTICS;
@@ -1629,11 +1616,10 @@ err:
{
my_afree((uchar*) temp_buff);
}
- my_free(mi_get_rec_buff_ptr(info, sort_param.record),
- MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mi_get_rec_buff_ptr(info, sort_param.record));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
(void) end_io_cache(&info->rec_cache);
- my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sort_info.buff);
sort_info.buff=0;
share->state.sortkey=sort_key;
DBUG_RETURN(flush_blocks(param, share->key_cache, share->kfile) |
@@ -1673,7 +1659,6 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info,
endpos=buff+used_length;
for ( ;; )
{
- _sanity(__FILE__,__LINE__);
if (nod_flag)
{
next_page=_mi_kpos(nod_flag,keypos);
@@ -1689,7 +1674,6 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info,
new_file, update_index))
goto err;
}
- _sanity(__FILE__,__LINE__);
if (keypos >= endpos ||
(key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,lastkey))
== 0)
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index d88ebdf5f12..130a96bc9e0 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -347,11 +347,11 @@ typedef struct st_mi_sort_param
int (*key_read)(struct st_mi_sort_param *,void *);
int (*key_write)(struct st_mi_sort_param *, const void *);
void (*lock_in_memory)(MI_CHECK *);
- NEAR int (*write_keys)(struct st_mi_sort_param *, register uchar **,
- uint , struct st_buffpek *, IO_CACHE *);
- NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint);
- NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *,
- uint, uint);
+ int (*write_keys)(struct st_mi_sort_param *, register uchar **,
+ uint , struct st_buffpek *, IO_CACHE *);
+ uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint);
+ int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *,
+ uint, uint);
} MI_SORT_PARAM;
/* Some defines used by isam-funktions */
@@ -475,8 +475,8 @@ extern mysql_mutex_t THR_LOCK_myisam;
/* Some extern variables */
extern LIST *myisam_open_list;
-extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[];
-extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[];
+extern uchar myisam_file_magic[], myisam_pack_file_magic[];
+extern uint myisam_read_vec[], myisam_readnext_vec[];
extern uint myisam_quick_table_bits;
extern File myisam_log_file;
extern ulong myisam_pid;
@@ -774,9 +774,9 @@ void _mi_report_crashed(MI_INFO *file, const char *message,
/* Functions needed by mi_check */
volatile int *killed_ptr(MI_CHECK *param);
-void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...));
-void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...));
-void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...));
+void mi_check_print_error(MI_CHECK *param, const char *fmt,...);
+void mi_check_print_warning(MI_CHECK *param, const char *fmt,...);
+void mi_check_print_info(MI_CHECK *param, const char *fmt,...);
int flush_pending_blocks(MI_SORT_PARAM *param);
int sort_ft_buf_flush(MI_SORT_PARAM *sort_param);
int thr_write_keys(MI_SORT_PARAM *sort_param);
diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c
index 089e3480da6..d3da0eab22c 100644
--- a/storage/myisam/myisamlog.c
+++ b/storage/myisam/myisamlog.c
@@ -248,7 +248,6 @@ static void get_options(register int *argc, register char ***argv)
/* Fall through */
case 'I':
case '?':
-#include <help_start.h>
printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
puts("By Monty, for your professional use\n");
@@ -270,7 +269,6 @@ static void get_options(register int *argc, register char ***argv)
puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted.");
puts("If one gives table names as arguments only these tables will be updated\n");
help=1;
-#include <help_end.h>
break;
default:
printf("illegal option: \"-%c\"\n",*pos);
@@ -616,7 +614,7 @@ static int examine_log(char * file_name, char **table_names)
}
}
}
- my_free(buff,MYF(0));
+ my_free(buff);
break;
case MI_LOG_LOCK:
if (my_b_read(&cache,(uchar*) head,sizeof(lock_command)))
@@ -683,12 +681,12 @@ static int read_string(IO_CACHE *file, register uchar* *to, register uint length
DBUG_ENTER("read_string");
if (*to)
- my_free((uchar*) *to,MYF(0));
+ my_free(*to);
if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) ||
my_b_read(file,(uchar*) *to,length))
{
if (*to)
- my_free(*to,MYF(0));
+ my_free(*to);
*to= 0;
DBUG_RETURN(1);
}
@@ -759,10 +757,10 @@ static void file_info_free(struct file_info *fileinfo)
if (!fileinfo->closed)
(void) mi_close(fileinfo->isam);
if (fileinfo->record)
- my_free(fileinfo->record,MYF(0));
+ my_free(fileinfo->record);
}
- my_free(fileinfo->name,MYF(0));
- my_free(fileinfo->show_name,MYF(0));
+ my_free(fileinfo->name);
+ my_free(fileinfo->show_name);
DBUG_VOID_RETURN;
}
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index 18810a60166..4cd305fdc69 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -23,9 +23,6 @@
#include <queues.h>
#include <my_tree.h>
#include "mysys_err.h"
-#ifdef MSDOS
-#include <io.h>
-#endif
#ifndef __GNU_LIBRARY__
#define __GNU_LIBRARY__ /* Skip warnings in getopt.h */
#endif
@@ -256,14 +253,10 @@ int main(int argc, char **argv)
#endif
}
-enum options_mp {OPT_CHARSETS_DIR_MP=256, OPT_AUTO_CLOSE};
+enum options_mp {OPT_CHARSETS_DIR_MP=256};
static struct my_option my_long_options[] =
{
-#ifdef __NETWARE__
- {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"backup", 'b', "Make a backup of the table as table_name.OLD.",
&backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR_MP,
@@ -295,13 +288,11 @@ static struct my_option my_long_options[] =
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-#include <help_start.h>
static void print_version(void)
{
printf("%s Ver 1.23 for %s on %s\n",
my_progname, SYSTEM_TYPE, MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
}
@@ -323,7 +314,6 @@ static void usage(void)
my_print_variables(my_long_options);
}
-#include <help_end.h>
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
@@ -332,11 +322,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
uint length;
switch(optid) {
-#ifdef __NETWARE__
- case OPT_AUTO_CLOSE:
- setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
- break;
-#endif
case 'f':
force_pack= 1;
tmpfile_createflag= O_RDWR | O_TRUNC;
@@ -486,7 +471,7 @@ static my_bool open_isam_files(PACK_MRG_INFO *mrg, char **names, uint count)
error:
while (i--)
mi_close(mrg->file[i]);
- my_free((uchar*) mrg->file,MYF(0));
+ my_free(mrg->file);
return 1;
}
@@ -534,10 +519,10 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
my_write(join_isam_file,buff,length,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)))
{
- my_free(buff,MYF(0));
+ my_free(buff);
goto err;
}
- my_free(buff,MYF(0));
+ my_free(buff);
(void) fn_format(new_name,result_table,"",MI_NAME_DEXT,2);
}
else if (!tmp_dir[0])
@@ -564,7 +549,6 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
}
trees=fields=share->base.fields;
huff_counts=init_huff_count(isam_file,mrg->records);
- QUICK_SAFEMALLOC;
/*
Read the whole data file(s) for statistics.
@@ -574,7 +558,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
printf("- Calculating statistics\n");
if (get_statistic(mrg,huff_counts))
goto err;
- NORMAL_SAFEMALLOC;
+
old_length=0;
for (i=0; i < mrg->count ; i++)
old_length+= (mrg->file[i]->s->state.state.data_file_length -
@@ -857,11 +841,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
for (i=0 ; i < trees ; i++)
{
if (huff_trees[i].element_buffer)
- my_free((uchar*) huff_trees[i].element_buffer,MYF(0));
+ my_free(huff_trees[i].element_buffer);
if (huff_trees[i].code)
- my_free((uchar*) huff_trees[i].code,MYF(0));
+ my_free(huff_trees[i].code);
}
- my_free((uchar*) huff_trees,MYF(0));
+ my_free(huff_trees);
}
if (huff_counts)
{
@@ -869,11 +853,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
{
if (huff_counts[i].tree_buff)
{
- my_free((uchar*) huff_counts[i].tree_buff,MYF(0));
+ my_free(huff_counts[i].tree_buff);
delete_tree(&huff_counts[i].int_tree);
}
}
- my_free((uchar*) huff_counts,MYF(0));
+ my_free(huff_counts);
}
delete_queue(&queue); /* This is safe to free */
return;
@@ -977,7 +961,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
count->int_tree.elements_in_tree > 1))
{
delete_tree(&count->int_tree);
- my_free(count->tree_buff,MYF(0));
+ my_free(count->tree_buff);
count->tree_buff=0;
}
else
@@ -1374,12 +1358,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
}
else
{
- my_free((uchar*) huff_counts->tree_buff,MYF(0));
+ my_free(huff_counts->tree_buff);
delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff=0;
}
if (tree.element_buffer)
- my_free((uchar*) tree.element_buffer,MYF(0));
+ my_free(tree.element_buffer);
}
if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS)
space_fields++;
@@ -1496,8 +1480,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees)
if (make_huff_tree(huff_tree+tree,huff_counts+tree))
{
while (tree--)
- my_free((uchar*) huff_tree[tree].element_buffer,MYF(0));
- my_free((uchar*) huff_tree,MYF(0));
+ my_free(huff_tree[tree].element_buffer);
+ my_free(huff_tree);
DBUG_RETURN(0);
}
}
@@ -1907,7 +1891,7 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees)
{
memcpy_fixed((uchar*) i->counts,(uchar*) count.counts,
sizeof(count.counts[0])*256);
- my_free((uchar*) j->tree->element_buffer,MYF(0));
+ my_free(j->tree->element_buffer);
j->tree->element_buffer=0;
j->tree=i->tree;
bmove((uchar*) i->counts,(uchar*) count.counts,
@@ -2913,7 +2897,7 @@ static int flush_buffer(ulong neaded_length)
static void end_file_buffer(void)
{
- my_free((uchar*) file_buffer.buffer,MYF(0));
+ my_free(file_buffer.buffer);
}
/* output `bits` low bits of `value' */
@@ -3117,7 +3101,7 @@ static int mrg_close(PACK_MRG_INFO *mrg)
for (i=0 ; i < mrg->count ; i++)
error|=mi_close(mrg->file[i]);
if (mrg->free_file)
- my_free((uchar*) mrg->file,MYF(0));
+ my_free(mrg->file);
return error;
}
@@ -3180,7 +3164,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count)
*/
if (huff_counts->tree_buff)
{
- my_free((uchar*) huff_counts->tree_buff, MYF(0));
+ my_free(huff_counts->tree_buff);
delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff= NULL;
DBUG_PRINT("fakebigcodes", ("freed distinct column values"));
diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c
index 410badd3145..32cf1fd924d 100644
--- a/storage/myisam/rt_index.c
+++ b/storage/myisam/rt_index.c
@@ -972,7 +972,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
goto err1;
}
if (ReinsertList.pages)
- my_free((uchar*) ReinsertList.pages, MYF(0));
+ my_free(ReinsertList.pages);
/* check for redundant root (not leaf, 1 child) and eliminate */
if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index 539630899f4..9532b9f0474 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -19,7 +19,7 @@
*/
#include "fulltext.h"
-#if defined(MSDOS) || defined(__WIN__)
+#if defined(__WIN__)
#include <fcntl.h>
#else
#include <stddef.h>
@@ -41,46 +41,46 @@
Pointers of functions for store and read keys from temp file
*/
-extern void print_error _VARARGS((const char *fmt,...));
+extern void print_error(const char *fmt,...);
/* Functions defined in this file */
-static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info,uint keys,
- uchar **sort_keys,
- DYNAMIC_ARRAY *buffpek,int *maxbuffer,
- IO_CACHE *tempfile,
- IO_CACHE *tempfile_for_exceptions);
-static int NEAR_F write_keys(MI_SORT_PARAM *info,uchar **sort_keys,
- uint count, BUFFPEK *buffpek,IO_CACHE *tempfile);
-static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key,
- IO_CACHE *tempfile);
-static int NEAR_F write_index(MI_SORT_PARAM *info,uchar * *sort_keys,
- uint count);
-static int NEAR_F merge_many_buff(MI_SORT_PARAM *info,uint keys,
- uchar * *sort_keys,
- BUFFPEK *buffpek,int *maxbuffer,
- IO_CACHE *t_file);
-static uint NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
- uint sort_length);
-static int NEAR_F merge_buffers(MI_SORT_PARAM *info,uint keys,
- IO_CACHE *from_file, IO_CACHE *to_file,
- uchar * *sort_keys, BUFFPEK *lastbuff,
- BUFFPEK *Fb, BUFFPEK *Tb);
-static int NEAR_F merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int,
- IO_CACHE *);
+static ha_rows find_all_keys(MI_SORT_PARAM *info,uint keys,
+ uchar **sort_keys,
+ DYNAMIC_ARRAY *buffpek,int *maxbuffer,
+ IO_CACHE *tempfile,
+ IO_CACHE *tempfile_for_exceptions);
+static int write_keys(MI_SORT_PARAM *info,uchar **sort_keys,
+ uint count, BUFFPEK *buffpek,IO_CACHE *tempfile);
+static int write_key(MI_SORT_PARAM *info, uchar *key,
+ IO_CACHE *tempfile);
+static int write_index(MI_SORT_PARAM *info,uchar * *sort_keys,
+ uint count);
+static int merge_many_buff(MI_SORT_PARAM *info,uint keys,
+ uchar * *sort_keys,
+ BUFFPEK *buffpek,int *maxbuffer,
+ IO_CACHE *t_file);
+static uint read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
+ uint sort_length);
+static int merge_buffers(MI_SORT_PARAM *info,uint keys,
+ IO_CACHE *from_file, IO_CACHE *to_file,
+ uchar * *sort_keys, BUFFPEK *lastbuff,
+ BUFFPEK *Fb, BUFFPEK *Tb);
+static int merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int,
+ IO_CACHE *);
static int flush_ft_buf(MI_SORT_PARAM *info);
-static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys,
- uint count, BUFFPEK *buffpek,
- IO_CACHE *tempfile);
-static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek,
- uint sort_length);
-static int NEAR_F write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file,
- uchar *key, uint sort_length, uint count);
-static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
- IO_CACHE *to_file,
- uchar* key, uint sort_length,
- uint count);
+static int write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys,
+ uint count, BUFFPEK *buffpek,
+ IO_CACHE *tempfile);
+static uint read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek,
+ uint sort_length);
+static int write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file,
+ uchar *key, uint sort_length, uint count);
+static int write_merge_key_varlen(MI_SORT_PARAM *info,
+ IO_CACHE *to_file,
+ uchar* key, uint sort_length,
+ uint count);
static inline int
my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs);
@@ -162,7 +162,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer,
maxbuffer/2))
{
- my_free((uchar*) sort_keys,MYF(0));
+ my_free(sort_keys);
sort_keys= 0;
}
else
@@ -242,8 +242,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
error =0;
err:
- if (sort_keys)
- my_free((uchar*) sort_keys,MYF(0));
+ my_free(sort_keys);
delete_dynamic(&buffpek);
close_cached_file(&tempfile);
close_cached_file(&tempfile_for_exceptions);
@@ -254,10 +253,10 @@ err:
/* Search after all keys and place them in a temp. file */
-static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys,
- uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
- int *maxbuffer, IO_CACHE *tempfile,
- IO_CACHE *tempfile_for_exceptions)
+static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys,
+ uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
+ int *maxbuffer, IO_CACHE *tempfile,
+ IO_CACHE *tempfile_for_exceptions)
{
int error;
uint idx;
@@ -382,7 +381,7 @@ pthread_handler_t thr_find_all_keys(void *arg)
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, maxbuffer/2))
{
- my_free((uchar*) sort_keys,MYF(0));
+ my_free(sort_keys);
sort_keys= (uchar **) NULL; /* for err: label */
}
else
@@ -451,8 +450,7 @@ pthread_handler_t thr_find_all_keys(void *arg)
err:
DBUG_PRINT("error", ("got some error"));
sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
- if (sort_keys)
- my_free((uchar*) sort_keys,MYF(0));
+ my_free(sort_keys);
sort_param->sort_keys= 0;
delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile);
@@ -509,8 +507,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
if (!sinfo->sort_keys)
{
got_error=1;
- my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff),
- MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff));
continue;
}
if (!got_error)
@@ -528,9 +525,8 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
got_error=1;
}
}
- my_free((uchar*) sinfo->sort_keys,MYF(0));
- my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff),
- MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sinfo->sort_keys);
+ my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff));
sinfo->sort_keys=0;
}
@@ -638,15 +634,15 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
sinfo->notnull : NULL,
(ulonglong) info->state->records);
}
- my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mergebuf);
DBUG_RETURN(got_error);
}
#endif /* THREAD */
/* Write all keys in memory to file for later merge */
-static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
- uint count, BUFFPEK *buffpek, IO_CACHE *tempfile)
+static int write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
+ uint count, BUFFPEK *buffpek, IO_CACHE *tempfile)
{
uchar **end;
uint sort_length=info->key_length;
@@ -686,10 +682,10 @@ my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs)
}
-static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,
- register uchar **sort_keys,
- uint count, BUFFPEK *buffpek,
- IO_CACHE *tempfile)
+static int write_keys_varlen(MI_SORT_PARAM *info,
+ register uchar **sort_keys,
+ uint count, BUFFPEK *buffpek,
+ IO_CACHE *tempfile)
{
uchar **end;
int err;
@@ -713,8 +709,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,
} /* write_keys_varlen */
-static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key,
- IO_CACHE *tempfile)
+static int write_key(MI_SORT_PARAM *info, uchar *key, IO_CACHE *tempfile)
{
uint key_length=info->real_key_length;
DBUG_ENTER("write_key");
@@ -733,8 +728,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key,
/* Write index */
-static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
- register uint count)
+static int write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
+ register uint count)
{
DBUG_ENTER("write_index");
@@ -751,9 +746,9 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
/* Merge buffers to make < MERGEBUFF2 buffers */
-static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys,
- uchar **sort_keys, BUFFPEK *buffpek,
- int *maxbuffer, IO_CACHE *t_file)
+static int merge_many_buff(MI_SORT_PARAM *info, uint keys,
+ uchar **sort_keys, BUFFPEK *buffpek,
+ int *maxbuffer, IO_CACHE *t_file)
{
register int i;
IO_CACHE t_file2, *from_file, *to_file, *temp;
@@ -814,8 +809,8 @@ cleanup:
-1 Error
*/
-static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
- uint sort_length)
+static uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
+ uint sort_length)
{
register uint count;
uint length;
@@ -834,8 +829,8 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
return (count*sort_length);
} /* read_to_buffer */
-static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
- uint sort_length)
+static uint read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
+ uint sort_length)
{
register uint count;
uint16 length_of_key = 0;
@@ -866,9 +861,9 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
} /* read_to_buffer_varlen */
-static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
- IO_CACHE *to_file, uchar* key,
- uint sort_length, uint count)
+static int write_merge_key_varlen(MI_SORT_PARAM *info,
+ IO_CACHE *to_file, uchar* key,
+ uint sort_length, uint count)
{
uint idx;
uchar *bufs = key;
@@ -884,9 +879,9 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
}
-static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)),
- IO_CACHE *to_file, uchar *key,
- uint sort_length, uint count)
+static int write_merge_key(MI_SORT_PARAM *info __attribute__((unused)),
+ IO_CACHE *to_file, uchar *key,
+ uint sort_length, uint count)
{
return my_b_write(to_file, key, (size_t) sort_length*count);
}
@@ -896,7 +891,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)),
If to_file == 0 then use info->key_write
*/
-static int NEAR_F
+static int
merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
IO_CACHE *to_file, uchar **sort_keys, BUFFPEK *lastbuff,
BUFFPEK *Fb, BUFFPEK *Tb)
@@ -1039,7 +1034,7 @@ err:
/* Do a merge to output-file (save only positions) */
-static int NEAR_F
+static int
merge_index(MI_SORT_PARAM *info, uint keys, uchar **sort_keys,
BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile)
{
@@ -1057,7 +1052,7 @@ flush_ft_buf(MI_SORT_PARAM *info)
if (info->sort_info->ft_buf)
{
err=sort_ft_buf_flush(info);
- my_free((uchar*)info->sort_info->ft_buf, MYF(0));
+ my_free(info->sort_info->ft_buf);
info->sort_info->ft_buf=0;
}
return err;
diff --git a/storage/myisammrg/CMakeLists.txt b/storage/myisammrg/CMakeLists.txt
index 739bcd565bc..739bcd565bc 100755..100644
--- a/storage/myisammrg/CMakeLists.txt
+++ b/storage/myisammrg/CMakeLists.txt
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 63d20f127a1..bac8cb7a0b7 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -103,6 +103,7 @@
#include "myrg_def.h"
#include "thr_malloc.h" // int_sql_alloc
#include "sql_class.h" // THD
+#include "debug_sync.h"
static handler *myisammrg_create_handler(handlerton *hton,
TABLE_SHARE *table,
@@ -298,9 +299,8 @@ extern "C" int myisammrg_parent_open_callback(void *callback_param,
if (! db || ! table_name)
DBUG_RETURN(1);
- DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", db_length, db,
- table_name_length, table_name));
-
+ DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int) db_length, db,
+ (int) table_name_length, table_name));
/* Convert to lowercase if required. */
if (lower_case_table_names && table_name_length)
@@ -755,6 +755,7 @@ int ha_myisammrg::attach_children(void)
/* Must not call this with attached children. */
DBUG_ASSERT(!this->file->children_attached);
+ DEBUG_SYNC(current_thd, "before_myisammrg_attach");
/* Must call this with children list in place. */
DBUG_ASSERT(this->table->pos_in_table_list->next_global == this->children_l);
@@ -829,7 +830,7 @@ int ha_myisammrg::attach_children(void)
error= HA_ERR_WRONG_MRG_TABLE_DEF;
if (!(this->test_if_locked & HA_OPEN_FOR_REPAIR))
{
- my_free((uchar*) recinfo, MYF(0));
+ my_free(recinfo);
goto err;
}
/* purecov: begin inspected */
@@ -837,7 +838,7 @@ int ha_myisammrg::attach_children(void)
/* purecov: end */
}
}
- my_free((uchar*) recinfo, MYF(0));
+ my_free(recinfo);
if (error == HA_ERR_WRONG_MRG_TABLE_DEF)
goto err; /* purecov: inspected */
diff --git a/storage/myisammrg/myrg_close.c b/storage/myisammrg/myrg_close.c
index 45e0a82913a..066a09cadbc 100644
--- a/storage/myisammrg/myrg_close.c
+++ b/storage/myisammrg/myrg_close.c
@@ -53,13 +53,13 @@ int myrg_close(MYRG_INFO *info)
}
}
else
- my_free((uchar*) info->rec_per_key_part, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(info->rec_per_key_part);
delete_queue(&info->by_key);
mysql_mutex_lock(&THR_LOCK_open);
myrg_open_list=list_delete(myrg_open_list,&info->open_list);
mysql_mutex_unlock(&THR_LOCK_open);
mysql_mutex_destroy(&info->mutex);
- my_free((uchar*) info,MYF(0));
+ my_free(info);
if (error)
{
DBUG_RETURN(my_errno=error);
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index 915680ab64c..c9e19d32e96 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -18,9 +18,6 @@
#include "myrg_def.h"
#include <stddef.h>
#include <errno.h>
-#ifdef VMS
-#include "mrg_static.c"
-#endif
/*
open a MyISAM MERGE table
@@ -186,7 +183,7 @@ err:
case 3:
while (files)
(void) mi_close(m_info->open_tables[--files].table);
- my_free((char*) m_info,MYF(0));
+ my_free(m_info);
/* Fall through */
case 2:
end_io_cache(&file);
@@ -339,7 +336,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
save_errno= my_errno;
switch (errpos) {
case 3:
- my_free((char*) m_info, MYF(0));
+ my_free(m_info);
/* Fall through */
case 2:
end_io_cache(&file_cache);
@@ -422,7 +419,7 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
key_parts= myisam->s->base.key_parts;
if (*need_compat_check && m_info->rec_per_key_part)
{
- my_free((char *) m_info->rec_per_key_part, MYF(0));
+ my_free(m_info->rec_per_key_part);
m_info->rec_per_key_part= NULL;
}
if (!m_info->rec_per_key_part)
@@ -491,7 +488,7 @@ err:
save_errno= my_errno;
switch (errpos) {
case 1:
- my_free((char*) m_info->rec_per_key_part, MYF(0));
+ my_free(m_info->rec_per_key_part);
m_info->rec_per_key_part= NULL;
}
mysql_mutex_unlock(&m_info->mutex);
diff --git a/storage/ndb/config/win-lib.am b/storage/ndb/config/win-lib.am
index 05ac1ec8a40..1e7bbfae19b 100644
--- a/storage/ndb/config/win-lib.am
+++ b/storage/ndb/config/win-lib.am
@@ -68,7 +68,7 @@ LIB32=xilink6.exe -lib
# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /D "WIN32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /D "WIN32" /D "_DEBUG" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c
# ADD BASE CPP @includes@
# ADD CPP @includes@
# SUBTRACT CPP /YX
diff --git a/storage/ndb/config/win-prg.am b/storage/ndb/config/win-prg.am
index 70c19a70c6d..5d56d79c41e 100644
--- a/storage/ndb/config/win-prg.am
+++ b/storage/ndb/config/win-prg.am
@@ -71,7 +71,7 @@ LINK32=xilink6.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "NDB_WIN32" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# ADD BASE CPP @includes@
# ADD CPP @includes@
# SUBTRACT CPP /Fr /YX
diff --git a/storage/ndb/include/util/NdbAutoPtr.hpp b/storage/ndb/include/util/NdbAutoPtr.hpp
index 5210fbc6dde..f11b8f0d5bc 100644
--- a/storage/ndb/include/util/NdbAutoPtr.hpp
+++ b/storage/ndb/include/util/NdbAutoPtr.hpp
@@ -51,8 +51,8 @@ class My_auto_ptr {
T * m_obj;
public:
My_auto_ptr(T * obj = 0){ m_obj = obj;}
- void reset(T * obj = 0) { if (m_obj) my_free(m_obj,MYF(0)); m_obj = obj; }
- ~My_auto_ptr() { if (m_obj) my_free(m_obj,MYF(0));}
+ void reset(T * obj = 0) { if (m_obj) my_free(m_obj); m_obj = obj; }
+ ~My_auto_ptr() { if (m_obj) my_free(m_obj);}
};
#endif
diff --git a/storage/ndb/src/common/portlib/NdbMutex.c b/storage/ndb/src/common/portlib/NdbMutex.c
index c9184e5d1f2..5595baba7c4 100644
--- a/storage/ndb/src/common/portlib/NdbMutex.c
+++ b/storage/ndb/src/common/portlib/NdbMutex.c
@@ -24,36 +24,31 @@ NdbMutex* NdbMutex_Create(void)
{
NdbMutex* pNdbMutex;
int result;
- DBUG_ENTER("NdbMutex_Create");
-
+
pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex));
- DBUG_PRINT("info",("NdbMem_Allocate 0x%lx", (long) pNdbMutex));
-
+
if (pNdbMutex == NULL)
- DBUG_RETURN(NULL);
-
+ return NULL;
+
result = pthread_mutex_init(pNdbMutex, NULL);
assert(result == 0);
-
- DBUG_RETURN(pNdbMutex);
+
+ return pNdbMutex;
}
int NdbMutex_Destroy(NdbMutex* p_mutex)
{
int result;
- DBUG_ENTER("NdbMutex_Destroy");
if (p_mutex == NULL)
- DBUG_RETURN(-1);
+ return -1;
result = pthread_mutex_destroy(p_mutex);
- DBUG_PRINT("info",("NdbMem_Free 0x%lx", (long) p_mutex));
NdbMem_Free(p_mutex);
-
- DBUG_RETURN(result);
+ return result;
}
diff --git a/storage/ndb/src/mgmapi/mgmapi.cpp b/storage/ndb/src/mgmapi/mgmapi.cpp
index 662e5c22f48..78c767c31c6 100644
--- a/storage/ndb/src/mgmapi/mgmapi.cpp
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp
@@ -212,7 +212,7 @@ extern "C"
void
ndb_mgm_set_name(NdbMgmHandle handle, const char *name)
{
- my_free(handle->m_name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(handle->m_name);
handle->m_name= my_strdup(name, MYF(MY_WME));
}
@@ -278,10 +278,10 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
}
#endif
(*handle)->cfg.~LocalConfig();
- my_free((*handle)->m_name, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((*handle)->m_name);
if ((*handle)->m_bindaddress)
free((*handle)->m_bindaddress);
- my_free((char*)* handle,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(* handle);
* handle = 0;
DBUG_VOID_RETURN;
}
diff --git a/storage/ndb/src/mgmapi/ndb_logevent.cpp b/storage/ndb/src/mgmapi/ndb_logevent.cpp
index fbf026fd79d..c372f852144 100644
--- a/storage/ndb/src/mgmapi/ndb_logevent.cpp
+++ b/storage/ndb/src/mgmapi/ndb_logevent.cpp
@@ -82,7 +82,7 @@ void ndb_mgm_destroy_logevent_handle(NdbLogEventHandle * h)
if ( *h )
close((*h)->socket);
- my_free((char*)* h,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(* h);
* h = 0;
}
diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp
index fbd81c71700..980530953ad 100644
--- a/storage/ndb/src/mgmclient/main.cpp
+++ b/storage/ndb/src/mgmclient/main.cpp
@@ -20,7 +20,7 @@
extern "C" {
#if defined( __WIN__)
#include <conio.h>
-#elif !defined(__NETWARE__)
+#else
#include <readline/readline.h>
extern "C" int add_history(const char *command); /* From readline directory */
extern "C" int read_history(const char *command);
diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp
index 16c560868ef..26198a44a23 100644
--- a/storage/ndb/src/mgmsrv/main.cpp
+++ b/storage/ndb/src/mgmsrv/main.cpp
@@ -48,7 +48,7 @@ const char *load_default_groups[]= { "mysql_cluster","ndb_mgmd",0 };
extern "C" {
#if defined( __WIN__)
#include <conio.h>
-#elif !defined(__NETWARE__)
+#else
#include <readline/readline.h>
extern "C" int add_history(const char *command); /* From readline directory */
#define HAVE_READLINE
diff --git a/storage/ndb/src/ndbapi/DictCache.cpp b/storage/ndb/src/ndbapi/DictCache.cpp
index 04be3711847..9c66b2be9d2 100644
--- a/storage/ndb/src/ndbapi/DictCache.cpp
+++ b/storage/ndb/src/ndbapi/DictCache.cpp
@@ -20,8 +20,10 @@
#include <NdbCondition.h>
#include <NdbSleep.h>
-static NdbTableImpl f_invalid_table;
-static NdbTableImpl f_altered_table;
+static NdbTableImpl * f_invalid_table = 0;
+static NdbTableImpl * f_altered_table = 0;
+
+static int ndb_dict_cache_count = 0;
Ndb_local_table_info *
Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz)
@@ -93,11 +95,29 @@ GlobalDictCache::GlobalDictCache(){
DBUG_ENTER("GlobalDictCache::GlobalDictCache");
m_tableHash.createHashTable();
m_waitForTableCondition = NdbCondition_Create();
+ if (f_invalid_table == NULL)
+ f_invalid_table = new NdbTableImpl();
+ if (f_altered_table == NULL)
+ f_altered_table = new NdbTableImpl();
+ ndb_dict_cache_count++;
DBUG_VOID_RETURN;
}
GlobalDictCache::~GlobalDictCache(){
DBUG_ENTER("GlobalDictCache::~GlobalDictCache");
+ if (--ndb_dict_cache_count == 0)
+ {
+ if (f_invalid_table)
+ {
+ delete f_invalid_table;
+ f_invalid_table = 0;
+ }
+ if (f_altered_table)
+ {
+ delete f_altered_table;
+ f_altered_table = 0;
+ }
+ }
NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
while(curr != 0){
Vector<TableVersion> * vers = curr->theData;
@@ -254,7 +274,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
TableVersion & ver = vers->back();
if(ver.m_status != RETREIVING ||
!(ver.m_impl == 0 ||
- ver.m_impl == &f_invalid_table || ver.m_impl == &f_altered_table) ||
+ ver.m_impl == f_invalid_table || ver.m_impl == f_altered_table) ||
ver.m_version != 0 ||
ver.m_refCount == 0){
abort();
@@ -271,7 +291,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
ver.m_version = tab->m_version;
ver.m_status = OK;
}
- else if (ver.m_impl == &f_invalid_table)
+ else if (ver.m_impl == f_invalid_table)
{
DBUG_PRINT("info", ("Table DROPPED invalid"));
ver.m_impl = tab;
@@ -279,7 +299,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
ver.m_status = DROPPED;
ver.m_impl->m_status = NdbDictionary::Object::Invalid;
}
- else if(ver.m_impl == &f_altered_table)
+ else if(ver.m_impl == f_altered_table)
{
DBUG_PRINT("info", ("Table DROPPED altered"));
ver.m_impl = tab;
@@ -440,7 +460,7 @@ GlobalDictCache::alter_table_rep(const char * name,
if(i == sz - 1 && ver.m_status == RETREIVING)
{
- ver.m_impl = altered ? &f_altered_table : &f_invalid_table;
+ ver.m_impl = altered ? f_altered_table : f_invalid_table;
DBUG_VOID_RETURN;
}
}
diff --git a/storage/ndb/test/ndbapi/testIndexStat.cpp b/storage/ndb/test/ndbapi/testIndexStat.cpp
index 0e15cdd80d1..559fade3132 100644
--- a/storage/ndb/test/ndbapi/testIndexStat.cpp
+++ b/storage/ndb/test/ndbapi/testIndexStat.cpp
@@ -404,9 +404,9 @@ static void
freekeys()
{
if (g_keys != 0)
- my_free((char*)g_keys, MYF(0));
+ my_free(g_keys);
if (g_sortkeys != 0)
- my_free((char*)g_sortkeys, MYF(0));
+ my_free(g_sortkeys);
g_keys = 0;
g_sortkeys = 0;
}
@@ -896,7 +896,7 @@ static void
freeranges()
{
if (g_ranges != 0)
- my_free((char*)g_ranges, MYF(0));
+ my_free(g_ranges);
g_ranges = 0;
}
diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp
index e8e8d584f09..f63cbdd2aa2 100644
--- a/storage/ndb/tools/restore/consumer_restore.cpp
+++ b/storage/ndb/tools/restore/consumer_restore.cpp
@@ -449,13 +449,13 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table)
}
if (map_in_frm(new_data, (const char*)data, data_len, &new_data_len))
{
- my_free(new_data, MYF(0));
+ my_free(new_data);
DBUG_RETURN(TRUE);
}
if (packfrm((uchar*) new_data, new_data_len,
&new_pack_data, &new_pack_len))
{
- my_free(new_data, MYF(0));
+ my_free(new_data);
DBUG_RETURN(TRUE);
}
table->setFrm(new_pack_data, new_pack_len);
diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt
index 6c7731f2d07..5cd651a35bd 100644
--- a/storage/perfschema/CMakeLists.txt
+++ b/storage/perfschema/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc.
+# Copyright (c) 2009, 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
@@ -10,9 +10,8 @@
# 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
-
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
diff --git a/storage/perfschema/Makefile.am b/storage/perfschema/Makefile.am
index 8c30c812bc6..374415cfdfd 100644
--- a/storage/perfschema/Makefile.am
+++ b/storage/perfschema/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2009 Sun Microsystems, Inc
+# 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
@@ -10,8 +10,8 @@
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
#called from the top level Makefile
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 588ba5edec1..0fac734f7a0 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,18 +10,19 @@
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 */
+ 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/ha_perfschema.cc
Performance schema storage engine (implementation).
*/
-#include "sql_priv.h"
-#include "unireg.h"
-#include "ha_perfschema.h"
+#include "my_global.h"
+#include "my_pthread.h"
+#include "sql_plugin.h"
#include "mysql/plugin.h"
+#include "ha_perfschema.h"
#include "pfs_engine_table.h"
#include "pfs_column_values.h"
#include "pfs_instr_class.h"
@@ -145,7 +146,7 @@ mysql_declare_plugin(perfschema)
MYSQL_STORAGE_ENGINE_PLUGIN,
&pfs_storage_engine,
pfs_engine_name,
- "Marc Alff, Sun Microsystems",
+ "Marc Alff, Oracle", /* Formerly Sun Microsystems, formerly MySQL */
"Performance Schema",
PLUGIN_LICENSE_GPL,
pfs_init_func, /* Plugin Init */
diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h
index 92cc0476e73..2c7b45fbbf7 100644
--- a/storage/perfschema/ha_perfschema.h
+++ b/storage/perfschema/ha_perfschema.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef HA_PERFSCHEMA_H
#define HA_PERFSCHEMA_H
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index f5901540ab0..93c9cf14e9d 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs.cc
@@ -1009,7 +1009,7 @@ void* pfs_spawn_thread(void *arg)
*/
user_start_routine= typed_arg->m_user_start_routine;
user_arg= typed_arg->m_user_arg;
- my_free(typed_arg, MYF(0));
+ my_free(typed_arg);
/* Then, execute the user code for this thread. */
(*user_start_routine)(user_arg);
@@ -1037,7 +1037,7 @@ static int spawn_thread_v1(PSI_thread_key key,
int result= pthread_create(thread, attr, pfs_spawn_thread, psi_arg);
if (unlikely(result != 0))
- my_free(psi_arg, MYF(0));
+ my_free(psi_arg);
return result;
}
@@ -1093,7 +1093,8 @@ static void delete_thread_v1(PSI_thread *thread)
}
static PSI_mutex_locker*
-get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op)
+get_thread_mutex_locker_v1(PSI_mutex_locker_state *state,
+ PSI_mutex *mutex, PSI_mutex_operation op)
{
PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
DBUG_ASSERT((int) op >= 0);
@@ -1138,7 +1139,8 @@ get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op)
}
static PSI_rwlock_locker*
-get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op)
+get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state,
+ PSI_rwlock *rwlock, PSI_rwlock_operation op)
{
PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock);
DBUG_ASSERT(static_cast<int> (op) >= 0);
@@ -1184,7 +1186,8 @@ get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op)
}
static PSI_cond_locker*
-get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */,
+get_thread_cond_locker_v1(PSI_cond_locker_state *state,
+ PSI_cond *cond, PSI_mutex * /* unused: mutex */,
PSI_cond_operation op)
{
/*
@@ -1242,7 +1245,8 @@ get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */,
}
static PSI_table_locker*
-get_thread_table_locker_v1(PSI_table *table)
+get_thread_table_locker_v1(PSI_table_locker_state *state,
+ PSI_table *table)
{
PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
DBUG_ASSERT(pfs_table != NULL);
@@ -1284,7 +1288,8 @@ get_thread_table_locker_v1(PSI_table *table)
}
static PSI_file_locker*
-get_thread_file_name_locker_v1(PSI_file_key key,
+get_thread_file_name_locker_v1(PSI_file_locker_state *state,
+ PSI_file_key key,
PSI_file_operation op,
const char *name, const void *identity)
{
@@ -1341,7 +1346,8 @@ get_thread_file_name_locker_v1(PSI_file_key key,
}
static PSI_file_locker*
-get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op)
+get_thread_file_stream_locker_v1(PSI_file_locker_state *state,
+ PSI_file *file, PSI_file_operation op)
{
PFS_file *pfs_file= reinterpret_cast<PFS_file*> (file);
@@ -1392,7 +1398,8 @@ get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op)
}
static PSI_file_locker*
-get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op)
+get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state,
+ File file, PSI_file_operation op)
{
int index= static_cast<int> (file);
@@ -1462,7 +1469,7 @@ get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op)
return NULL;
}
-static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex)
+static void unlock_mutex_v1(PSI_mutex *mutex)
{
PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
DBUG_ASSERT(pfs_mutex != NULL);
@@ -1501,7 +1508,7 @@ static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex)
#endif
}
-static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock)
+static void unlock_rwlock_v1(PSI_rwlock *rwlock)
{
PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock);
DBUG_ASSERT(pfs_rwlock != NULL);
@@ -1577,7 +1584,7 @@ static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock)
#endif
}
-static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond)
+static void signal_cond_v1(PSI_cond* cond)
{
PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
DBUG_ASSERT(pfs_cond != NULL);
@@ -1585,7 +1592,7 @@ static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond)
pfs_cond->m_cond_stat.m_signal_count++;
}
-static void broadcast_cond_v1(PSI_thread *thread, PSI_cond* cond)
+static void broadcast_cond_v1(PSI_cond* cond)
{
PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
DBUG_ASSERT(pfs_cond != NULL);
diff --git a/storage/perfschema/pfs.h b/storage/perfschema/pfs.h
index f529d09a05c..4e11736b1b9 100644
--- a/storage/perfschema/pfs.h
+++ b/storage/perfschema/pfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_H
#define PFS_H
@@ -23,9 +23,8 @@
#define HAVE_PSI_1
-#include <sql_priv.h>
#include <my_global.h>
-#include <unireg.h>
+#include <my_pthread.h>
#include <mysql/psi/psi.h>
extern struct PSI_bootstrap PFS_bootstrap;
diff --git a/storage/perfschema/pfs_atomic.cc b/storage/perfschema/pfs_atomic.cc
index c33bb251767..06090accdc6 100644
--- a/storage/perfschema/pfs_atomic.cc
+++ b/storage/perfschema/pfs_atomic.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Sun Microsystems, Inc
+/* Copyright (c) 2009, 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_atomic.cc
diff --git a/storage/perfschema/pfs_atomic.h b/storage/perfschema/pfs_atomic.h
index 7833c5f1c7a..b0070f7b8d0 100644
--- a/storage/perfschema/pfs_atomic.h
+++ b/storage/perfschema/pfs_atomic.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Sun Microsystems, Inc
+/* Copyright (c) 2009, 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_ATOMIC_H
#define PFS_ATOMIC_H
diff --git a/storage/perfschema/pfs_check.cc b/storage/perfschema/pfs_check.cc
index 4ef4b8bdbc6..c52be6f0da2 100644
--- a/storage/perfschema/pfs_check.cc
+++ b/storage/perfschema/pfs_check.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Sun Microsystems, Inc
+/* Copyright (c) 2009, 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_check.cc
@@ -23,7 +23,6 @@
*/
#include "my_global.h"
-#include "sql_priv.h"
#include "pfs_server.h"
#include "pfs_engine_table.h"
diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h
index c6f652d57a0..96b33636ff9 100644
--- a/storage/perfschema/pfs_column_types.h
+++ b/storage/perfschema/pfs_column_types.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_COLUMN_TYPES_H
#define PFS_COLUMN_TYPES_H
diff --git a/storage/perfschema/pfs_column_values.cc b/storage/perfschema/pfs_column_values.cc
index 6da1e04e63a..ea65441b8c6 100644
--- a/storage/perfschema/pfs_column_values.cc
+++ b/storage/perfschema/pfs_column_values.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_column_values.cc
@@ -19,7 +19,6 @@
schema tables (implementation).
*/
-#include "sql_priv.h"
#include "pfs_column_values.h"
LEX_STRING PERFORMANCE_SCHEMA_str=
diff --git a/storage/perfschema/pfs_column_values.h b/storage/perfschema/pfs_column_values.h
index 0172ddd1d18..f9e7f90dbc9 100644
--- a/storage/perfschema/pfs_column_values.h
+++ b/storage/perfschema/pfs_column_values.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_COLUMN_VALUES_H
#define PFS_COLUMN_VALUES_H
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 857b8a66de7..7b6fd055729 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,15 +10,14 @@
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 */
+ 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/pfs_engine_table.cc
Performance schema tables (implementation).
*/
-#include "sql_priv.h"
#include "pfs_engine_table.h"
#include "table_events_waits.h"
@@ -36,6 +35,7 @@
/* For show status */
#include "pfs_column_values.h"
#include "pfs_instr.h"
+#include "pfs_global.h"
#include "sql_base.h" // close_thread_tables
#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
@@ -108,7 +108,12 @@ void PFS_check_intact::report_error(uint code, const char *fmt, ...)
my_vsnprintf(buff, sizeof(buff), fmt, args);
va_end(args);
- my_message(code, buff, MYF(0));
+ /*
+ This is an install/upgrade issue:
+ - do not report it in the user connection, there is none in main(),
+ - report it in the server error log.
+ */
+ sql_print_error("%s", buff);
}
/**
@@ -139,6 +144,9 @@ void PFS_engine_table_share::check_one_table(THD *thd)
m_checked= true;
close_thread_tables(thd);
}
+ else
+ sql_print_error(ER(ER_WRONG_NATIVE_TABLE_STRUCTURE),
+ PERFORMANCE_SCHEMA_str.str, m_name.str);
lex_end(&dummy_lex);
thd->lex= old_lex;
@@ -327,10 +335,10 @@ ulonglong PFS_engine_table::get_field_enum(Field *f)
return f2->val_int();
}
-int PFS_readonly_table::update_row_values(TABLE *,
- const unsigned char *,
- unsigned char *,
- Field **)
+int PFS_engine_table::update_row_values(TABLE *,
+ const unsigned char *,
+ unsigned char *,
+ Field **)
{
my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
return HA_ERR_WRONG_COMMAND;
@@ -466,7 +474,22 @@ PFS_unknown_acl pfs_unknown_acl;
ACL_internal_access_result
PFS_unknown_acl::check(ulong want_access, ulong *save_priv) const
{
- return ACL_INTERNAL_ACCESS_DENIED;
+ const ulong always_forbidden= INSERT_ACL | UPDATE_ACL | DELETE_ACL
+ | CREATE_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL
+ | CREATE_VIEW_ACL | TRIGGER_ACL | LOCK_TABLES_ACL;
+
+ if (unlikely(want_access & always_forbidden))
+ return ACL_INTERNAL_ACCESS_DENIED;
+
+ /*
+ There is no point in hidding (by enforcing ACCESS_DENIED for SELECT_ACL
+ on performance_schema.*) tables that do not exist anyway.
+ When SELECT_ACL is granted on performance_schema.* or *.*,
+ SELECT * from performance_schema.wrong_table
+ will fail with a more understandable ER_NO_SUCH_TABLE error,
+ instead of ER_TABLEACCESS_DENIED_ERROR.
+ */
+ return ACL_INTERNAL_ACCESS_CHECK_GRANT;
}
/**
@@ -678,6 +701,7 @@ bool pfs_show_status(handlerton *hton, THD *thd,
case 40:
name= "(PFS_FILE_HANDLE).MEMORY";
size= file_handle_max * sizeof(PFS_file*);
+ total_memory+= size;
break;
case 41:
name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.ROW_SIZE";
@@ -692,13 +716,41 @@ bool pfs_show_status(handlerton *hton, THD *thd,
size= thread_max * instr_class_per_thread * sizeof(PFS_single_stat_chain);
total_memory+= size;
break;
+ case 44:
+ name= "(PFS_TABLE_SHARE).ROW_SIZE";
+ size= sizeof(PFS_table_share);
+ break;
+ case 45:
+ name= "(PFS_TABLE_SHARE).ROW_COUNT";
+ size= table_share_max;
+ break;
+ case 46:
+ name= "(PFS_TABLE_SHARE).MEMORY";
+ size= table_share_max * sizeof(PFS_table_share);
+ total_memory+= size;
+ break;
+ case 47:
+ name= "(PFS_TABLE).ROW_SIZE";
+ size= sizeof(PFS_table);
+ break;
+ case 48:
+ name= "(PFS_TABLE).ROW_COUNT";
+ size= table_max;
+ break;
+ case 49:
+ name= "(PFS_TABLE).MEMORY";
+ size= table_max * sizeof(PFS_table);
+ total_memory+= size;
+ break;
/*
This case must be last,
for aggregation in total_memory.
*/
- case 44:
+ case 50:
name= "PERFORMANCE_SCHEMA.MEMORY";
size= total_memory;
+ /* This will fail if something is not advertised here */
+ DBUG_ASSERT(size == pfs_allocated_memory);
break;
default:
goto end;
diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h
index b4c7a4ee866..ec73c5a3688 100644
--- a/storage/perfschema/pfs_engine_table.h
+++ b/storage/perfschema/pfs_engine_table.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_ENGINE_TABLE_H
#define PFS_ENGINE_TABLE_H
@@ -81,7 +81,7 @@ protected:
@param fields Table fields
*/
virtual int update_row_values(TABLE *table, const unsigned char *old_buf,
- unsigned char *new_buf, Field **fields)= 0;
+ unsigned char *new_buf, Field **fields);
/**
Constructor.
@@ -151,27 +151,6 @@ struct PFS_engine_table_share
bool m_checked;
};
-/** Adapter for read only PERFORMANCE_SCHEMA tables. */
-class PFS_readonly_table : public PFS_engine_table
-{
-protected:
- /**
- Constructor.
- @param share table share
- @param pos address of the m_pos position member
- */
- PFS_readonly_table(const PFS_engine_table_share *share, void *pos)
- : PFS_engine_table(share, pos)
- {}
-
- ~PFS_readonly_table()
- {}
-
- virtual int update_row_values(TABLE *table, const unsigned char *old_buf,
- unsigned char *new_buf, Field **fields);
-
-};
-
class PFS_readonly_acl : public ACL_internal_table_access
{
public:
diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc
index 22448af7c5f..aae8f9dc8c1 100644
--- a/storage/perfschema/pfs_events_waits.cc
+++ b/storage/perfschema/pfs_events_waits.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_events_waits.cc
diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h
index c677e83ad34..9a5ed8644f3 100644
--- a/storage/perfschema/pfs_events_waits.h
+++ b/storage/perfschema/pfs_events_waits.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_EVENTS_WAITS_H
#define PFS_EVENTS_WAITS_H
diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc
index cac7d0b06e7..fa57f335325 100644
--- a/storage/perfschema/pfs_global.cc
+++ b/storage/perfschema/pfs_global.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_global.cc
@@ -26,6 +26,7 @@
#include <string.h>
bool pfs_initialized= false;
+ulonglong pfs_allocated_memory= 0;
/**
Memory allocation for the performance schema.
@@ -38,7 +39,9 @@ void *pfs_malloc(size_t size, myf flags)
DBUG_ASSERT(size > 0);
void *ptr= malloc(size);
- if (ptr && (flags & MY_ZEROFILL))
+ if (likely(ptr != NULL))
+ pfs_allocated_memory+= size;
+ if (likely((ptr != NULL) && (flags & MY_ZEROFILL)))
memset(ptr, 0, size);
return ptr;
}
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index 37809f8cc2e..6050612e24c 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_GLOBAL_H
#define PFS_GLOBAL_H
@@ -22,6 +22,7 @@
*/
extern bool pfs_initialized;
+extern ulonglong pfs_allocated_memory;
void *pfs_malloc(size_t size, myf flags);
#define PFS_MALLOC_ARRAY(n, T, f) \
@@ -30,27 +31,50 @@ void pfs_free(void *ptr);
inline uint randomized_index(const void *ptr, uint max_size)
{
+ static uint seed1= 0;
+ static uint seed2= 0;
+ uint result;
+ register intptr value;
+
if (unlikely(max_size == 0))
return 0;
/*
- ptr is typically an aligned structure,
- so the last bits are not really random, but this has no effect.
- Apply a factor A*x to spread
- close values of ptr further apart (which helps with arrays),
- and to spread values way beyond a typical max_size.
- Then, apply a modulo to end within [0, max_size - 1].
- A is big prime numbers, to avoid resonating with max_size,
- to have a uniform distribution in [0, max_size - 1].
- The value of A is chosen so that index(ptr) and index(ptr + N) (for arrays)
- are likely to be not similar for typical values of max_size
- (50, 100, 1000, etc).
- In other words, (sizeof(T)*A % max_size) should not be a small number,
- to avoid that with 'T array[max_size]', index(array[i])
- and index(array[i + 1]) end up pointing in the same area in [0, max_size - 1].
+ ptr is typically an aligned structure, and can be in an array.
+ - The last bits are not random because of alignment,
+ so we divide by 8.
+ - The high bits are mostly constant, especially with 64 bits architectures,
+ but we keep most of them anyway, by doing computation in intptr.
+ The high bits are significant depending on where the data is
+ stored (the data segment, the stack, the heap, ...).
+ - To spread consecutive cells in an array further, we multiply by
+ a factor A. This factor should not be too high, which would cause
+ an overflow and cause loss of randomness (droping the top high bits).
+ The factor is a prime number, to help spread the distribution.
+ - To add more noise, and to be more robust if the calling code is
+ passing a constant value instead of a random identity,
+ we add the previous results, for hysteresys, with a degree 2 polynom,
+ X^2 + X + 1.
+ - Last, a modulo is applied to be within the [0, max_size - 1] range.
+ Note that seed1 and seed2 are static, and are *not* thread safe,
+ which is even better.
+ Effect with arrays: T array[N]
+ - ptr(i) = & array[i] = & array[0] + i * sizeof(T)
+ - ptr(i+1) = ptr(i) + sizeof(T).
+ What we want here, is to have index(i) and index(i+1) fall into
+ very different areas in [0, max_size - 1], to avoid locality.
*/
- return static_cast<uint>
- (((reinterpret_cast<intptr> (ptr)) * 2166179) % max_size);
+ value= (reinterpret_cast<intptr> (ptr)) >> 3;
+ value*= 1789;
+ value+= seed2 + seed1 + 1;
+
+ result= (static_cast<uint> (value)) % max_size;
+
+ seed2= seed1*seed1;
+ seed1= result;
+
+ DBUG_ASSERT(result < max_size);
+ return result;
}
void pfs_print_error(const char *format, ...);
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index 9507e2d2582..0c7b25a03de 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_instr.cc
@@ -21,8 +21,8 @@
#include <string.h>
#include "my_global.h"
-#include "sql_priv.h"
#include "my_sys.h"
+#include "pfs.h"
#include "pfs_stat.h"
#include "pfs_instr.h"
#include "pfs_global.h"
@@ -411,6 +411,8 @@ void cleanup_instruments(void)
thread_instr_class_waits_array= NULL;
}
+extern "C"
+{
static uchar *filename_hash_get_key(const uchar *entry, size_t *length,
my_bool)
{
@@ -425,6 +427,7 @@ static uchar *filename_hash_get_key(const uchar *entry, size_t *length,
result= file->m_filename;
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
}
+}
/**
Initialize the file name hash.
@@ -451,6 +454,75 @@ void cleanup_file_hash(void)
}
}
+void PFS_scan::init(uint random, uint max_size)
+{
+ m_pass= 0;
+
+ if (max_size == 0)
+ {
+ /* Degenerated case, no buffer */
+ m_pass_max= 0;
+ return;
+ }
+
+ DBUG_ASSERT(random < max_size);
+
+ if (PFS_MAX_ALLOC_RETRY < max_size)
+ {
+ /*
+ The buffer is big compared to PFS_MAX_ALLOC_RETRY,
+ scan it only partially.
+ */
+ if (random + PFS_MAX_ALLOC_RETRY < max_size)
+ {
+ /*
+ Pass 1: [random, random + PFS_MAX_ALLOC_RETRY - 1]
+ Pass 2: not used.
+ */
+ m_pass_max= 1;
+ m_first[0]= random;
+ m_last[0]= random + PFS_MAX_ALLOC_RETRY;
+ m_first[1]= 0;
+ m_last[1]= 0;
+ }
+ else
+ {
+ /*
+ Pass 1: [random, max_size - 1]
+ Pass 2: [0, ...]
+ The combined length of pass 1 and 2 is PFS_MAX_ALLOC_RETRY.
+ */
+ m_pass_max= 2;
+ m_first[0]= random;
+ m_last[0]= max_size;
+ m_first[1]= 0;
+ m_last[1]= PFS_MAX_ALLOC_RETRY - (max_size - random);
+ }
+ }
+ else
+ {
+ /*
+ The buffer is small compared to PFS_MAX_ALLOC_RETRY,
+ scan it in full in two passes.
+ Pass 1: [random, max_size - 1]
+ Pass 2: [0, random - 1]
+ */
+ m_pass_max= 2;
+ m_first[0]= random;
+ m_last[0]= max_size;
+ m_first[1]= 0;
+ m_last[1]= random;
+ }
+
+ DBUG_ASSERT(m_first[0] < max_size);
+ DBUG_ASSERT(m_first[1] < max_size);
+ DBUG_ASSERT(m_last[1] <= max_size);
+ DBUG_ASSERT(m_last[1] <= max_size);
+ /* The combined length of all passes should not exceed PFS_MAX_ALLOC_RETRY. */
+ DBUG_ASSERT((m_last[0] - m_first[0]) +
+ (m_last[1] - m_first[1]) <= PFS_MAX_ALLOC_RETRY);
+}
+
/**
Create instrumentation for a mutex instance.
@param klass the mutex class
@@ -459,17 +531,15 @@ void cleanup_file_hash(void)
*/
PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity)
{
- int pass;
- uint i= randomized_index(identity, mutex_max);
+ PFS_scan scan;
+ uint random= randomized_index(identity, mutex_max);
- /*
- Pass 1: [random, mutex_max - 1]
- Pass 2: [0, mutex_max - 1]
- */
- for (pass= 1; pass <= 2; i=0, pass++)
+ for (scan.init(random, mutex_max);
+ scan.has_pass();
+ scan.next_pass())
{
- PFS_mutex *pfs= mutex_array + i;
- PFS_mutex *pfs_last= mutex_array + mutex_max;
+ PFS_mutex *pfs= mutex_array + scan.first();
+ PFS_mutex *pfs_last= mutex_array + scan.last();
for ( ; pfs < pfs_last; pfs++)
{
if (pfs->m_lock.is_free())
@@ -517,17 +587,15 @@ void destroy_mutex(PFS_mutex *pfs)
*/
PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity)
{
- int pass;
- uint i= randomized_index(identity, rwlock_max);
+ PFS_scan scan;
+ uint random= randomized_index(identity, rwlock_max);
- /*
- Pass 1: [random, rwlock_max - 1]
- Pass 2: [0, rwlock_max - 1]
- */
- for (pass= 1; pass <= 2; i=0, pass++)
+ for (scan.init(random, rwlock_max);
+ scan.has_pass();
+ scan.next_pass())
{
- PFS_rwlock *pfs= rwlock_array + i;
- PFS_rwlock *pfs_last= rwlock_array + rwlock_max;
+ PFS_rwlock *pfs= rwlock_array + scan.first();
+ PFS_rwlock *pfs_last= rwlock_array + scan.last();
for ( ; pfs < pfs_last; pfs++)
{
if (pfs->m_lock.is_free())
@@ -581,17 +649,15 @@ void destroy_rwlock(PFS_rwlock *pfs)
*/
PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
{
- int pass;
- uint i= randomized_index(identity, cond_max);
+ PFS_scan scan;
+ uint random= randomized_index(identity, cond_max);
- /*
- Pass 1: [random, cond_max - 1]
- Pass 2: [0, cond_max - 1]
- */
- for (pass= 1; pass <= 2; i=0, pass++)
+ for (scan.init(random, cond_max);
+ scan.has_pass();
+ scan.next_pass())
{
- PFS_cond *pfs= cond_array + i;
- PFS_cond *pfs_last= cond_array + cond_max;
+ PFS_cond *pfs= cond_array + scan.first();
+ PFS_cond *pfs_last= cond_array + scan.last();
for ( ; pfs < pfs_last; pfs++)
{
if (pfs->m_lock.is_free())
@@ -639,17 +705,15 @@ void destroy_cond(PFS_cond *pfs)
PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
ulong thread_id)
{
- int pass;
- uint i= randomized_index(identity, thread_max);
+ PFS_scan scan;
+ uint random= randomized_index(identity, thread_max);
- /*
- Pass 1: [random, thread_max - 1]
- Pass 2: [0, thread_max - 1]
- */
- for (pass= 1; pass <= 2; i=0, pass++)
+ for (scan.init(random, thread_max);
+ scan.has_pass();
+ scan.next_pass())
{
- PFS_thread *pfs= thread_array + i;
- PFS_thread *pfs_last= thread_array + thread_max;
+ PFS_thread *pfs= thread_array + scan.first();
+ PFS_thread *pfs_last= thread_array + scan.last();
for ( ; pfs < pfs_last; pfs++)
{
if (pfs->m_lock.is_free())
@@ -733,7 +797,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
const char *filename, uint len)
{
PFS_file *pfs;
- int pass;
+ PFS_scan scan;
if (! filename_hash_inited)
{
@@ -765,7 +829,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
- it fits into pfs->m_filename
- it is safe to use mysys apis to normalize the file name.
*/
- memcpy(safe_buffer, filename, FN_REFLEN - 2);
+ memcpy(safe_buffer, filename, FN_REFLEN - 1);
safe_buffer[FN_REFLEN - 1]= 0;
safe_filename= safe_buffer;
}
@@ -776,16 +840,58 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
Normalize the file name to avoid duplicates when using aliases:
- absolute or relative paths
- symbolic links
+ Names are resolved as follows:
+ - /real/path/to/real_file ==> same
+ - /path/with/link/to/real_file ==> /real/path/to/real_file
+ - real_file ==> /real/path/to/real_file
+ - ./real_file ==> /real/path/to/real_file
+ - /real/path/to/sym_link ==> same
+ - /path/with/link/to/sym_link ==> /real/path/to/sym_link
+ - sym_link ==> /real/path/to/sym_link
+ - ./sym_link ==> /real/path/to/sym_link
+ When the last component of a file is a symbolic link,
+ the last component is *not* resolved, so that all file io
+ operations on a link (create, read, write, delete) are counted
+ against the link itself, not the target file.
+ Resolving the name would lead to create counted against the link,
+ and read/write/delete counted against the target, leading to
+ incoherent results and instrumentation leaks.
+ Also note that, when creating files, this name resolution
+ works properly for files that do not exist (yet) on the file system.
*/
char buffer[FN_REFLEN];
+ char dirbuffer[FN_REFLEN];
+ size_t dirlen;
const char *normalized_filename;
int normalized_length;
- /*
- Ignore errors, the file may not exist.
- my_realpath always provide a best effort result in buffer.
- */
- (void) my_realpath(buffer, safe_filename, MYF(0));
+ dirlen= dirname_length(safe_filename);
+ if (dirlen == 0)
+ {
+ dirbuffer[0]= FN_CURLIB;
+ dirbuffer[1]= FN_LIBCHAR;
+ dirbuffer[2]= '\0';
+ }
+ else
+ {
+ memcpy(dirbuffer, safe_filename, dirlen);
+ dirbuffer[dirlen]= '\0';
+ }
+
+ if (my_realpath(buffer, dirbuffer, MYF(0)) != 0)
+ {
+ file_lost++;
+ return NULL;
+ }
+
+ /* Append the unresolved file name to the resolved path */
+ char *ptr= buffer + strlen(buffer);
+ char *buf_end= &buffer[sizeof(buffer)-1];
+ if (buf_end > ptr)
+ *ptr++= FN_LIBCHAR;
+ if (buf_end > ptr)
+ strncpy(ptr, safe_filename + dirlen, buf_end - ptr);
+ *buf_end= '\0';
normalized_filename= buffer;
normalized_length= strlen(normalized_filename);
@@ -806,17 +912,14 @@ search:
}
/* filename is not constant, just using it for noise on create */
- uint i= randomized_index(filename, file_max);
+ uint random= randomized_index(filename, file_max);
- /*
- Pass 1: [random, file_max - 1]
- Pass 2: [0, file_max - 1]
- */
- for (pass= 1; pass <= 2; i=0, pass++)
+ for (scan.init(random, file_max);
+ scan.has_pass();
+ scan.next_pass())
{
- pfs= file_array + i;
- PFS_file *pfs_last= file_array + file_max;
-
+ pfs= file_array + scan.first();
+ PFS_file *pfs_last= file_array + scan.last();
for ( ; pfs < pfs_last; pfs++)
{
if (pfs->m_lock.is_free())
@@ -901,17 +1004,15 @@ void destroy_file(PFS_thread *thread, PFS_file *pfs)
*/
PFS_table* create_table(PFS_table_share *share, const void *identity)
{
- int pass;
- uint i= randomized_index(identity, table_max);
+ PFS_scan scan;
+ uint random= randomized_index(identity, table_max);
- /*
- Pass 1: [random, table_max - 1]
- Pass 2: [0, table_max - 1]
- */
- for (pass= 1; pass <= 2; i=0, pass++)
+ for (scan.init(random, table_max);
+ scan.has_pass();
+ scan.next_pass())
{
- PFS_table *pfs= table_array + i;
- PFS_table *pfs_last= table_array + table_max;
+ PFS_table *pfs= table_array + scan.first();
+ PFS_table *pfs_last= table_array + scan.last();
for ( ; pfs < pfs_last; pfs++)
{
if (pfs->m_lock.is_free())
diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h
index a509d054d69..791e2cd1f8d 100644
--- a/storage/perfschema/pfs_instr.h
+++ b/storage/perfschema/pfs_instr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_INSTR_H
#define PFS_INSTR_H
@@ -21,7 +21,6 @@
Performance schema instruments (declarations).
*/
-#include <sql_priv.h>
#include "pfs_lock.h"
#include "pfs_instr_class.h"
#include "pfs_events_waits.h"
@@ -136,6 +135,48 @@ struct PFS_table : public PFS_instr
*/
#define LOCKER_STACK_SIZE 3
+/**
+ @def PFS_MAX_ALLOC_RETRY
+ Maximum number of times the code attempts to allocate an item
+ from internal buffers, before giving up.
+*/
+#define PFS_MAX_ALLOC_RETRY 1000
+
+#define PFS_MAX_SCAN_PASS 2
+
+/**
+ Helper to scan circular buffers.
+ Given a buffer of size [0, max_size - 1],
+ and a random starting point in the buffer,
+ this helper returns up to two [first, last -1] intervals that:
+ - fit into the [0, max_size - 1] range,
+ - have a maximum combined length of at most PFS_MAX_ALLOC_RETRY.
+*/
+struct PFS_scan
+{
+public:
+ void init(uint random, uint max_size);
+
+ bool has_pass() const
+ { return (m_pass < m_pass_max); }
+
+ void next_pass()
+ { m_pass++; }
+
+ uint first() const
+ { return m_first[m_pass]; }
+
+ uint last() const
+ { return m_last[m_pass]; }
+
+private:
+ uint m_pass;
+ uint m_pass_max;
+ uint m_first[PFS_MAX_SCAN_PASS];
+ uint m_last[PFS_MAX_SCAN_PASS];
+};
+
+
/** Instrumented thread implementation. @see PSI_thread. */
struct PFS_thread
{
diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc
index d1535aa851b..48547f73628 100644
--- a/storage/perfschema/pfs_instr_class.cc
+++ b/storage/perfschema/pfs_instr_class.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_instr_class.cc
diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h
index fa82bceb0c1..bd6560dbb55 100644
--- a/storage/perfschema/pfs_instr_class.h
+++ b/storage/perfschema/pfs_instr_class.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_INSTR_CLASS_H
#define PFS_INSTR_CLASS_H
@@ -38,7 +38,6 @@
*/
#define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32
-#include <sql_priv.h>
#include <my_global.h>
#include <mysql/psi/psi.h>
#include "pfs_lock.h"
diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h
index 46d7d33617b..5c74d3944ba 100644
--- a/storage/perfschema/pfs_lock.h
+++ b/storage/perfschema/pfs_lock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Sun Microsystems, Inc
+/* Copyright (c) 2009, 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_LOCK_H
#define PFS_LOCK_H
diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc
index f852a9fe732..0f322a9cb76 100644
--- a/storage/perfschema/pfs_server.cc
+++ b/storage/perfschema/pfs_server.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_server.cc
@@ -21,7 +21,6 @@
#include "my_global.h"
#include "my_sys.h"
#include "mysys_err.h"
-#include "sql_priv.h"
#include "pfs_server.h"
#include "pfs.h"
#include "pfs_global.h"
diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h
index acf483e1f86..a7af27c1038 100644
--- a/storage/perfschema/pfs_server.h
+++ b/storage/perfschema/pfs_server.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_SERVER_H
#define PFS_SERVER_H
diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h
index 654f292d82c..c78d5c83039 100644
--- a/storage/perfschema/pfs_stat.h
+++ b/storage/perfschema/pfs_stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_STAT_H
#define PFS_STAT_H
diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc
index 65883b62c32..f30a9f8e865 100644
--- a/storage/perfschema/pfs_timer.cc
+++ b/storage/perfschema/pfs_timer.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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/pfs_timer.cc
diff --git a/storage/perfschema/pfs_timer.h b/storage/perfschema/pfs_timer.h
index beba263f45a..cd2a8df9be3 100644
--- a/storage/perfschema/pfs_timer.h
+++ b/storage/perfschema/pfs_timer.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_TIMER_H
#define PFS_TIMER_H
diff --git a/storage/perfschema/plug.in b/storage/perfschema/plug.in
index e6539dc1260..36a1c1e8bda 100644
--- a/storage/perfschema/plug.in
+++ b/storage/perfschema/plug.in
@@ -1,6 +1,6 @@
dnl -*- ksh -*-
-# Copyright (C) 2008-2009 Sun Microsystems, Inc
+# 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
@@ -12,8 +12,8 @@ dnl -*- ksh -*-
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
dnl This file is part of the configure scripts used by autoconf.
diff --git a/storage/perfschema/table_all_instr.cc b/storage/perfschema/table_all_instr.cc
index ffbe31bbadd..f29a006107a 100644
--- a/storage/perfschema/table_all_instr.cc
+++ b/storage/perfschema/table_all_instr.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,22 +10,21 @@
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 */
+ 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_all_instr.cc
Abstract tables for all instruments (implementation).
*/
-#include "sql_priv.h"
#include "my_global.h"
#include "my_pthread.h"
#include "table_all_instr.h"
#include "pfs_global.h"
table_all_instr::table_all_instr(const PFS_engine_table_share *share)
- : PFS_readonly_table(share, &m_pos),
+ : PFS_engine_table(share, &m_pos),
m_pos(), m_next_pos()
{}
@@ -154,7 +153,7 @@ int table_all_instr::rnd_pos(const void *pos)
table_all_instr_class::table_all_instr_class
(const PFS_engine_table_share *share)
- : PFS_readonly_table(share, &m_pos),
+ : PFS_engine_table(share, &m_pos),
m_pos(), m_next_pos()
{}
diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h
index a8767695602..6e404659030 100644
--- a/storage/perfschema/table_all_instr.h
+++ b/storage/perfschema/table_all_instr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef TABLE_ALL_INSTR_H
#define TABLE_ALL_INSTR_H
@@ -63,7 +63,7 @@ struct pos_all_instr_class : public PFS_double_index,
- a view on all cond classes,
- a view on all file classes
*/
-class table_all_instr_class : public PFS_readonly_table
+class table_all_instr_class : public PFS_engine_table
{
public:
virtual int rnd_next();
@@ -122,7 +122,7 @@ struct pos_all_instr : public PFS_double_index,
- a view on all cond instances,
- a view on all file instances
*/
-class table_all_instr : public PFS_readonly_table
+class table_all_instr : public PFS_engine_table
{
public:
virtual int rnd_next();
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index cb565373bd8..a09d7f1ba30 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,15 +10,16 @@
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 */
+ 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_events_waits.cc
Table EVENTS_WAITS_xxx (implementation).
*/
-#include "sql_priv.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "table_events_waits.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
@@ -165,7 +166,7 @@ table_events_waits_history_long::m_share=
table_events_waits_common::table_events_waits_common
(const PFS_engine_table_share *share, void *pos)
- : PFS_readonly_table(share, pos),
+ : PFS_engine_table(share, pos),
m_row_exists(false)
{}
diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h
index 5aa16cc0cab..2aa88b54be4 100644
--- a/storage/perfschema/table_events_waits.h
+++ b/storage/perfschema/table_events_waits.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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_H
#define TABLE_EVENTS_WAITS_H
@@ -121,7 +121,7 @@ struct pos_events_waits_history : public PFS_double_index
Adapter, for table sharing the structure of
PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
*/
-class table_events_waits_common : public PFS_readonly_table
+class table_events_waits_common : public PFS_engine_table
{
protected:
virtual int read_row_values(TABLE *table,
diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc
index 0eca9f6722e..9d0d6fe0f67 100644
--- a/storage/perfschema/table_events_waits_summary.cc
+++ b/storage/perfschema/table_events_waits_summary.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,16 +10,16 @@
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 */
+ 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_events_waits_summary.cc
Table EVENTS_WAITS_SUMMARY_BY_xxx (implementation).
*/
-#include "sql_priv.h"
-#include "unireg.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
@@ -101,7 +101,7 @@ table_events_waits_summary_by_thread_by_event_name::delete_all_rows(void)
table_events_waits_summary_by_thread_by_event_name
::table_events_waits_summary_by_thread_by_event_name()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(), m_next_pos()
{}
diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h
index 28c820e5c81..47ec9523d68 100644
--- a/storage/perfschema/table_events_waits_summary.h
+++ b/storage/perfschema/table_events_waits_summary.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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_H
#define TABLE_EVENTS_WAITS_SUMMARY_H
@@ -96,7 +96,7 @@ struct pos_events_waits_summary_by_thread_by_event_name
/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. */
class table_events_waits_summary_by_thread_by_event_name
- : public PFS_readonly_table
+ : public PFS_engine_table
{
public:
/** Table share */
diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc
index 3de5cbe4b47..f1676421616 100644
--- a/storage/perfschema/table_file_instances.cc
+++ b/storage/perfschema/table_file_instances.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,16 +10,16 @@
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 */
+ 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_file_instances.cc
Table FILE_INSTANCES (implementation).
*/
-#include "sql_priv.h"
-#include "unireg.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "pfs_instr.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
@@ -72,7 +72,7 @@ PFS_engine_table* table_file_instances::create(void)
}
table_file_instances::table_file_instances()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(0), m_next_pos(0)
{}
diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h
index fb5298f37b3..7365000b21f 100644
--- a/storage/perfschema/table_file_instances.h
+++ b/storage/perfschema/table_file_instances.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef TABLE_FILE_INSTANCES_H
#define TABLE_FILE_INSTANCES_H
@@ -45,7 +45,7 @@ struct row_file_instances
};
/** Table PERFORMANCE_SCHEMA.FILE_INSTANCES. */
-class table_file_instances : public PFS_readonly_table
+class table_file_instances : public PFS_engine_table
{
public:
/** Table share */
diff --git a/storage/perfschema/table_file_summary.cc b/storage/perfschema/table_file_summary.cc
index 16942e73916..f8b9e66118b 100644
--- a/storage/perfschema/table_file_summary.cc
+++ b/storage/perfschema/table_file_summary.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,16 +10,16 @@
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 */
+ 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_file_summary.cc
Table FILE_SUMMARY_BY_xxx (implementation).
*/
-#include "sql_priv.h"
-#include "unireg.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
@@ -88,7 +88,7 @@ int table_file_summary_by_event_name::delete_all_rows(void)
}
table_file_summary_by_event_name::table_file_summary_by_event_name()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_pos(1), m_next_pos(1)
{}
@@ -251,7 +251,7 @@ int table_file_summary_by_instance::delete_all_rows(void)
}
table_file_summary_by_instance::table_file_summary_by_instance()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(0), m_next_pos(0)
{}
diff --git a/storage/perfschema/table_file_summary.h b/storage/perfschema/table_file_summary.h
index e962292a725..92837189f1f 100644
--- a/storage/perfschema/table_file_summary.h
+++ b/storage/perfschema/table_file_summary.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef TABLE_FILE_SUMMARY_H
#define TABLE_FILE_SUMMARY_H
@@ -46,7 +46,7 @@ struct row_file_summary_by_event_name
};
/** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */
-class table_file_summary_by_event_name : public PFS_readonly_table
+class table_file_summary_by_event_name : public PFS_engine_table
{
public:
/** Table share */
@@ -105,7 +105,7 @@ struct row_file_summary_by_instance
};
/** Table PERFORMANCE_SCHEMA.FILE_UMMARY_BY_INSTANCE. */
-class table_file_summary_by_instance : public PFS_readonly_table
+class table_file_summary_by_instance : public PFS_engine_table
{
public:
/** Table share */
diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc
index 7a20e7e18e0..f400e37366c 100644
--- a/storage/perfschema/table_performance_timers.cc
+++ b/storage/perfschema/table_performance_timers.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,16 +10,16 @@
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 */
+ 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_performance_timers.cc
Table PERFORMANCE_TIMERS (implementation).
*/
-#include "sql_priv.h"
#include "my_global.h"
+#include "my_pthread.h"
#include "table_performance_timers.h"
#include "pfs_timer.h"
#include "pfs_global.h"
@@ -76,7 +76,7 @@ PFS_engine_table* table_performance_timers::create(void)
}
table_performance_timers::table_performance_timers()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_row(NULL), m_pos(0), m_next_pos(0)
{
int index;
diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h
index 0818a0af2fe..dbd47665ff6 100644
--- a/storage/perfschema/table_performance_timers.h
+++ b/storage/perfschema/table_performance_timers.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef TABLE_PERFORMANCE_TIMERS_H
#define TABLE_PERFORMANCE_TIMERS_H
@@ -43,7 +43,7 @@ struct row_performance_timers
};
/** Table PERFORMANCE_SCHEMA.PERFORMANCE_TIMERS. */
-class table_performance_timers : public PFS_readonly_table
+class table_performance_timers : public PFS_engine_table
{
public:
/** Table share. */
diff --git a/storage/perfschema/table_processlist.cc b/storage/perfschema/table_processlist.cc
index 7518882ccea..06c628c5f80 100644
--- a/storage/perfschema/table_processlist.cc
+++ b/storage/perfschema/table_processlist.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,15 +10,16 @@
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 */
+ 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_processlist.cc
Table PROCESSLIST (implementation).
*/
-#include "sql_priv.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "table_processlist.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
@@ -69,7 +70,7 @@ PFS_engine_table* table_processlist::create(void)
}
table_processlist::table_processlist()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(0), m_next_pos(0)
{}
diff --git a/storage/perfschema/table_processlist.h b/storage/perfschema/table_processlist.h
index 2c6d5160f41..d4fe5e4af1a 100644
--- a/storage/perfschema/table_processlist.h
+++ b/storage/perfschema/table_processlist.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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
@@ -45,7 +45,7 @@ struct row_processlist
};
/** Table PERFORMANCE_SCHEMA.PROCESSLIST. */
-class table_processlist : public PFS_readonly_table
+class table_processlist : public PFS_engine_table
{
public:
/** Table share. */
diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc
index ff74e7d3f28..3cc6a1441c1 100644
--- a/storage/perfschema/table_setup_consumers.cc
+++ b/storage/perfschema/table_setup_consumers.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,15 +10,16 @@
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 */
+ 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_setup_consumers.cc
Table SETUP_CONSUMERS (implementation).
*/
-#include "sql_priv.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "table_setup_consumers.h"
#include "pfs_instr.h"
#include "pfs_events_waits.h"
diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h
index f54f69fcef5..4d007645db2 100644
--- a/storage/perfschema/table_setup_consumers.h
+++ b/storage/perfschema/table_setup_consumers.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef TABLE_SETUP_CONSUMERS_H
#define TABLE_SETUP_CONSUMERS_H
diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc
index 095299c4b69..259ccee3c84 100644
--- a/storage/perfschema/table_setup_instruments.cc
+++ b/storage/perfschema/table_setup_instruments.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,16 +10,16 @@
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 */
+ 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_setup_instruments.cc
Table SETUP_INSTRUMENTS (implementation).
*/
-#include "sql_priv.h"
-#include "unireg.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h
index 549fe4fa5f9..b9df2dd3e0b 100644
--- a/storage/perfschema/table_setup_instruments.h
+++ b/storage/perfschema/table_setup_instruments.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef TABLE_SETUP_INSTRUMENTS_H
#define TABLE_SETUP_INSTRUMENTS_H
diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc
index 98e27808e0a..8ca218913bb 100644
--- a/storage/perfschema/table_setup_timers.cc
+++ b/storage/perfschema/table_setup_timers.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,15 +10,16 @@
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 */
+ 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_setup_timers.cc
Table SETUP_TIMERS (implementation).
*/
-#include "sql_priv.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "table_setup_timers.h"
#include "pfs_column_values.h"
#include "pfs_timer.h"
diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h
index 96af76ae05c..a81e6fefaaf 100644
--- a/storage/perfschema/table_setup_timers.h
+++ b/storage/perfschema/table_setup_timers.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef TABLE_SETUP_TIMERS_H
#define TABLE_SETUP_TIMERS_H
diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc
index c76c62cc9fd..82587ce493d 100644
--- a/storage/perfschema/table_sync_instances.cc
+++ b/storage/perfschema/table_sync_instances.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ 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_sync_instances.cc
@@ -19,8 +19,8 @@
and COND_INSTANCES (implementation).
*/
-#include "sql_priv.h"
-#include "unireg.h"
+#include "my_global.h"
+#include "my_pthread.h"
#include "pfs_instr.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
@@ -73,7 +73,7 @@ PFS_engine_table* table_mutex_instances::create(void)
}
table_mutex_instances::table_mutex_instances()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(0), m_next_pos(0)
{}
@@ -241,7 +241,7 @@ PFS_engine_table* table_rwlock_instances::create(void)
}
table_rwlock_instances::table_rwlock_instances()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(0), m_next_pos(0)
{}
@@ -406,7 +406,7 @@ PFS_engine_table* table_cond_instances::create(void)
}
table_cond_instances::table_cond_instances()
- : PFS_readonly_table(&m_share, &m_pos),
+ : PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(0), m_next_pos(0)
{}
diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h
index a8a9cdaa071..3c359852338 100644
--- a/storage/perfschema/table_sync_instances.h
+++ b/storage/perfschema/table_sync_instances.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef TABLE_SYNC_INSTANCE_H
#define TABLE_SYNC_INSTANCE_H
@@ -49,7 +49,7 @@ struct row_mutex_instances
};
/** Table PERFORMANCE_SCHEMA.MUTEX_INSTANCES. */
-class table_mutex_instances : public PFS_readonly_table
+class table_mutex_instances : public PFS_engine_table
{
public:
/** Table share. */
@@ -108,7 +108,7 @@ struct row_rwlock_instances
};
/** Table PERFORMANCE_SCHEMA.RWLOCK_INSTANCES. */
-class table_rwlock_instances : public PFS_readonly_table
+class table_rwlock_instances : public PFS_engine_table
{
public:
/** Table share */
@@ -161,7 +161,7 @@ struct row_cond_instances
};
/** Table PERFORMANCE_SCHEMA.COND_INSTANCES. */
-class table_cond_instances : public PFS_readonly_table
+class table_cond_instances : public PFS_engine_table
{
public:
/** Table share. */
diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt
index 8a72b25b5b7..501cf82d23a 100644
--- a/storage/perfschema/unittest/CMakeLists.txt
+++ b/storage/perfschema/unittest/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 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
@@ -10,8 +10,8 @@
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/mysql
diff --git a/storage/perfschema/unittest/conf.txt b/storage/perfschema/unittest/conf.txt
index a3bee9c3be5..8afd0b4dca7 100644
--- a/storage/perfschema/unittest/conf.txt
+++ b/storage/perfschema/unittest/conf.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 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
@@ -10,8 +10,8 @@
# 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
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
Performance schema test configurations.
(Used internally for performance testing)
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index 2f3fb2792fc..c51f358c4d8 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Sun Microsystems, Inc
+/* 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
@@ -10,12 +10,11 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#include <my_pthread.h>
-#include <sql_priv.h>
#include <my_global.h>
+#include <my_pthread.h>
#include <pfs_server.h>
#include <pfs_instr_class.h>
#include <pfs_instr.h>
@@ -941,9 +940,13 @@ void test_locker_disabled()
ok(file_A1 != NULL, "instrumented");
PSI_mutex_locker *mutex_locker;
+ PSI_mutex_locker_state mutex_state;
PSI_rwlock_locker *rwlock_locker;
+ PSI_rwlock_locker_state rwlock_state;
PSI_cond_locker *cond_locker;
+ PSI_cond_locker_state cond_state;
PSI_file_locker *file_locker;
+ PSI_file_locker_state file_state;
/* Pretend thread T-1 is disabled */
/* ------------------------------ */
@@ -955,17 +958,17 @@ void test_locker_disabled()
cond_class_A->m_enabled= true;
file_class_A->m_enabled= true;
- mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
+ mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker == NULL, "no locker");
- rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
+ rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker == NULL, "no locker");
- cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
+ cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
+ file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
/* Pretend the consumer is disabled */
@@ -978,17 +981,17 @@ void test_locker_disabled()
cond_class_A->m_enabled= true;
file_class_A->m_enabled= true;
- mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
+ mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker == NULL, "no locker");
- rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
+ rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker == NULL, "no locker");
- cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
+ cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
+ file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
/* Pretend the instrument is disabled */
@@ -1001,17 +1004,17 @@ void test_locker_disabled()
cond_class_A->m_enabled= false;
file_class_A->m_enabled= false;
- mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
+ mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker == NULL, "no locker");
- rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
+ rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker == NULL, "no locker");
- cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
+ cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
+ file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
/* Pretend everything is enabled */
@@ -1024,27 +1027,27 @@ void test_locker_disabled()
cond_class_A->m_enabled= true;
file_class_A->m_enabled= true;
- mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
+ mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker != NULL, "locker");
psi->start_mutex_wait(mutex_locker, __FILE__, __LINE__);
psi->end_mutex_wait(mutex_locker, 0);
- rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
+ rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker != NULL, "locker");
psi->start_rwlock_rdwait(rwlock_locker, __FILE__, __LINE__);
psi->end_rwlock_rdwait(rwlock_locker, 0);
- cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
+ cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker != NULL, "locker");
psi->start_cond_wait(cond_locker, __FILE__, __LINE__);
psi->end_cond_wait(cond_locker, 0);
- file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
+ file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker != NULL, "locker");
psi->start_file_open_wait(file_locker, __FILE__, __LINE__);
psi->end_file_open_wait(file_locker);
- file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker != NULL, "locker");
psi->start_file_wait(file_locker, 10, __FILE__, __LINE__);
psi->end_file_wait(file_locker, 10);
- file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker != NULL, "locker");
psi->start_file_wait(file_locker, 10, __FILE__, __LINE__);
psi->end_file_wait(file_locker, 10);
@@ -1059,17 +1062,17 @@ void test_locker_disabled()
cond_class_A->m_enabled= true;
file_class_A->m_enabled= true;
- mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
+ mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker == NULL, "no locker");
- rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
+ rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker == NULL, "no locker");
- cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
+ cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
+ file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
- file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
shutdown_performance_schema();
@@ -1102,6 +1105,7 @@ void test_file_instrumentation_leak()
PFS_file_class *file_class_A;
PFS_file_class *file_class_B;
+ PSI_file_locker_state file_state;
PSI_thread *thread_1;
/* Preparation */
@@ -1130,24 +1134,24 @@ void test_file_instrumentation_leak()
/* Simulate OPEN + READ of 100 bytes + CLOSE on descriptor 12 */
- file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "AAA", NULL);
+ file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "AAA", NULL);
ok(file_locker != NULL, "locker");
psi->start_file_open_wait(file_locker, __FILE__, __LINE__);
psi->end_file_open_wait_and_bind_to_descriptor(file_locker, 12);
- file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker != NULL, "locker");
psi->start_file_wait(file_locker, 100, __FILE__, __LINE__);
psi->end_file_wait(file_locker, 100);
- file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_CLOSE);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_CLOSE);
ok(file_locker != NULL, "locker");
psi->start_file_wait(file_locker, 0, __FILE__, __LINE__);
psi->end_file_wait(file_locker, 0);
/* Simulate uninstrumented-OPEN + WRITE on descriptor 24 */
- file_locker= psi->get_thread_file_descriptor_locker((File) 24, PSI_FILE_WRITE);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 24, PSI_FILE_WRITE);
ok(file_locker == NULL, "no locker, since the open was not instrumented");
/*
@@ -1155,7 +1159,7 @@ void test_file_instrumentation_leak()
the instrumentation should not leak (don't charge the file io on unknown B to "AAA")
*/
- file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_WRITE);
+ file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE);
ok(file_locker == NULL, "no locker, no leak");
shutdown_performance_schema();
diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc
index 7b3df877133..9a3b179aa56 100644
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,12 +10,11 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#include <my_pthread.h>
-#include <sql_priv.h>
#include <my_global.h>
+#include <my_pthread.h>
#include <pfs_instr.h>
#include <pfs_stat.h>
#include <pfs_global.h>
diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc
index 157031cb234..7dcc8cec7f8 100644
--- a/storage/perfschema/unittest/pfs_instr-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,12 +10,11 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#include <my_pthread.h>
-#include <sql_priv.h>
#include <my_global.h>
+#include <my_pthread.h>
#include <pfs_instr.h>
#include <pfs_stat.h>
#include <pfs_global.h>
diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
index 064c8c062a4..20fa0f3e6ff 100644
--- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,12 +10,11 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#include <my_pthread.h>
-#include <sql_priv.h>
#include <my_global.h>
+#include <my_pthread.h>
#include <pfs_instr_class.h>
#include <pfs_global.h>
#include <tap.h>
diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc
index c8dce2fd7fb..c5a199727d5 100644
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,13 +10,11 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#include <my_pthread.h>
#include <my_global.h>
-#include <sql_priv.h>
-
+#include <my_pthread.h>
#include <string.h> // strncpy
#include <pfs_instr_class.h>
#include <pfs_instr.h>
diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc
index 46efe3fd7b1..d8663c5ccda 100644
--- a/storage/perfschema/unittest/pfs_timer-t.cc
+++ b/storage/perfschema/unittest/pfs_timer-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,11 +10,11 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-#include <sql_priv.h>
#include <my_global.h>
+#include <my_pthread.h>
#include <pfs_timer.h>
#include "my_sys.h"
#include <tap.h>
diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h
index 85088061d3f..300d3cb6fa0 100644
--- a/storage/perfschema/unittest/stub_pfs_global.h
+++ b/storage/perfschema/unittest/stub_pfs_global.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#include <my_global.h>
#include <my_sys.h>
diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h
index 12dabb46ceb..caad24e5257 100644
--- a/storage/perfschema/unittest/stub_print_error.h
+++ b/storage/perfschema/unittest/stub_print_error.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* 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
@@ -10,8 +10,8 @@
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 */
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#include <my_global.h>
#include <my_sys.h>
diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt
index bb32f0d3f84..abc03302b64 100755..100644
--- a/strings/CMakeLists.txt
+++ b/strings/CMakeLists.txt
@@ -15,7 +15,7 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-SET(STRINGS_SOURCES bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
+SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c
ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c
ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c
diff --git a/strings/Makefile.am b/strings/Makefile.am
index 9b32f42c49a..fd884a1296a 100644
--- a/strings/Makefile.am
+++ b/strings/Makefile.am
@@ -30,19 +30,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
-CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c strmov.c
+CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c strmov.c
else
if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
-CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c strmov.c
+CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c strmov.c
else
#no assembler
ASRCS =
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
-CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c
+CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c
endif
endif
@@ -66,7 +66,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc
CHARSET_INFO.txt
libmystrings_a_LIBADD=
-conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c
+conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c
conf_to_src_LDADD=
#force static linking of conf_to_src - essential when linking against
#custom installation of libc
diff --git a/strings/bcmp.c b/strings/bcmp.c
deleted file mode 100644
index 1b6ed22fc22..00000000000
--- a/strings/bcmp.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are
- identical to the "len" bytes starting at "s2", non-zero if they are
- different.
- Now only used with purify because purify gives wrong warnings when
- comparing a shorter string with bcmp.
-*/
-
-#include <my_global.h>
-#include "m_string.h"
-
-#ifdef HAVE_purify
-#undef bcmp
-#undef HAVE_BCMP
-#endif
-
-#if !defined(bcmp) && !defined(HAVE_BCMP)
-
-#if defined(MC68000) && defined(DS90)
-
-int bcmp(s1,s2, len)
-const char *s1;
-const char *s2;
-uint len; /* 0 <= len <= 65535 */
-{
- asm(" movl 12(a7),d0 ");
- asm(" subqw #1,d0 ");
- asm(" blt .L5 ");
- asm(" movl 4(a7),a1 ");
- asm(" movl 8(a7),a0 ");
- asm(".L4: cmpmb (a0)+,(a1)+ ");
- asm(" dbne d0,.L4 ");
- asm(".L5: addqw #1,d0 ");
-}
-
-#else
-
-#ifndef HAVE_purify
-size_t bcmp(register const uchar *s1,register const uchar *s2,
- register size_t len)
-#else
-size_t my_bcmp(register const uchar *s1,register const uchar *s2,
- register size_t len)
-#endif
-{
- while (len-- != 0 && *s1++ == *s2++) ;
- return len+1;
-}
-
-#endif
-#endif /* BSD_FUNCS */
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 966acdfa8f0..f5221bb3a21 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -47,7 +47,7 @@
#define big5head(e) ((uchar)(e>>8))
#define big5tail(e) ((uchar)(e&0xff))
-static uchar NEAR ctype_big5[257] =
+static uchar ctype_big5[257] =
{
0, /* For standard library */
32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -68,7 +68,7 @@ static uchar NEAR ctype_big5[257] =
3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,
};
-static uchar NEAR to_lower_big5[]=
+static uchar to_lower_big5[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -104,7 +104,7 @@ static uchar NEAR to_lower_big5[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR to_upper_big5[]=
+static uchar to_upper_big5[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -140,7 +140,7 @@ static uchar NEAR to_upper_big5[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR sort_order_big5[]=
+static uchar sort_order_big5[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 2e405eeaf06..67555ac4384 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -31,7 +31,7 @@
* .configure. mbmaxlen_cp932=2
*/
-static uchar NEAR ctype_cp932[257] =
+static uchar ctype_cp932[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@@ -68,7 +68,7 @@ static uchar NEAR ctype_cp932[257] =
0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000
};
-static uchar NEAR to_lower_cp932[]=
+static uchar to_lower_cp932[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -104,7 +104,7 @@ static uchar NEAR to_lower_cp932[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-static uchar NEAR to_upper_cp932[]=
+static uchar to_upper_cp932[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -140,7 +140,7 @@ static uchar NEAR to_upper_cp932[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-static uchar NEAR sort_order_cp932[]=
+static uchar sort_order_cp932[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index a5df86cc6b3..0095fe7f995 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -430,7 +430,7 @@ static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
#include <my_global.h>
#include "m_string.h"
-static uchar NEAR ctype_czech[257] = {
+static uchar ctype_czech[257] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -450,7 +450,7 @@ static uchar NEAR ctype_czech[257] = {
2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 16,
};
-static uchar NEAR to_lower_czech[] = {
+static uchar to_lower_czech[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -469,7 +469,7 @@ static uchar NEAR to_lower_czech[] = {
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
};
-static uchar NEAR to_upper_czech[] = {
+static uchar to_upper_czech[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -488,7 +488,7 @@ static uchar NEAR to_upper_czech[] = {
240,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255,
};
-static uchar NEAR sort_order_czech[] = {
+static uchar sort_order_czech[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index 154d49ed085..c2067ac6f6b 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -32,7 +32,7 @@
#ifdef HAVE_CHARSET_euckr
-static uchar NEAR ctype_euc_kr[257] =
+static uchar ctype_euc_kr[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@@ -69,7 +69,7 @@ static uchar NEAR ctype_euc_kr[257] =
0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000,
};
-static uchar NEAR to_lower_euc_kr[]=
+static uchar to_lower_euc_kr[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -105,7 +105,7 @@ static uchar NEAR to_lower_euc_kr[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR to_upper_euc_kr[]=
+static uchar to_upper_euc_kr[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -141,7 +141,7 @@ static uchar NEAR to_upper_euc_kr[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR sort_order_euc_kr[]=
+static uchar sort_order_euc_kr[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 0a7f6be71cc..25c15a08d4e 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -33,7 +33,7 @@ ctype-ujis.c file.
#ifdef HAVE_CHARSET_eucjpms
-static uchar NEAR ctype_eucjpms[257] =
+static uchar ctype_eucjpms[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@@ -70,7 +70,7 @@ static uchar NEAR ctype_eucjpms[257] =
0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000,
};
-static uchar NEAR to_lower_eucjpms[]=
+static uchar to_lower_eucjpms[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -106,7 +106,7 @@ static uchar NEAR to_lower_eucjpms[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-static uchar NEAR to_upper_eucjpms[]=
+static uchar to_upper_eucjpms[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -142,7 +142,7 @@ static uchar NEAR to_upper_eucjpms[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-static uchar NEAR sort_order_eucjpms[]=
+static uchar sort_order_eucjpms[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index c3a52047977..46f3e9c6da5 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -29,7 +29,7 @@
#ifdef HAVE_CHARSET_gb2312
-static uchar NEAR ctype_gb2312[257] =
+static uchar ctype_gb2312[257] =
{
0, /* For standard library */
32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -50,7 +50,7 @@ static uchar NEAR ctype_gb2312[257] =
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,
};
-static uchar NEAR to_lower_gb2312[]=
+static uchar to_lower_gb2312[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -86,7 +86,7 @@ static uchar NEAR to_lower_gb2312[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR to_upper_gb2312[]=
+static uchar to_upper_gb2312[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -122,7 +122,7 @@ static uchar NEAR to_upper_gb2312[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR sort_order_gb2312[]=
+static uchar sort_order_gb2312[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 52a8d994fa4..609bc2ecd27 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -44,7 +44,7 @@
#define gbkhead(e) ((uchar)(e>>8))
#define gbktail(e) ((uchar)(e&0xff))
-static uchar NEAR ctype_gbk[257] =
+static uchar ctype_gbk[257] =
{
0, /* For standard library */
32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -65,7 +65,7 @@ static uchar NEAR ctype_gbk[257] =
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,
};
-static uchar NEAR to_lower_gbk[]=
+static uchar to_lower_gbk[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -101,7 +101,7 @@ static uchar NEAR to_lower_gbk[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR to_upper_gbk[]=
+static uchar to_upper_gbk[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -995,7 +995,7 @@ static MY_UNICASE_INFO *my_caseinfo_gbk[256]=
-static uchar NEAR sort_order_gbk[]=
+static uchar sort_order_gbk[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -1031,7 +1031,7 @@ static uchar NEAR sort_order_gbk[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uint16 NEAR gbk_order[]=
+static uint16 gbk_order[]=
{
8653,14277,17116,11482,11160,2751,14613,3913,13337,9827,
19496,1759,8105,7103,7836,5638,2223,21433,5878,8006,
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 6ff8c83dcf7..8a3d3d7425c 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1385,19 +1385,6 @@ int my_mb_ctype_8bit(CHARSET_INFO *cs, int *ctype,
}
-#undef ULONGLONG_MAX
-/*
- Needed under MetroWerks Compiler, since MetroWerks compiler does not
- properly handle a constant expression containing a mod operator
-*/
-#if defined(__NETWARE__) && defined(__MWERKS__)
-static ulonglong ulonglong_max= ~(ulonglong) 0;
-#define ULONGLONG_MAX ulonglong_max
-#else
-#define ULONGLONG_MAX (~(ulonglong) 0)
-#endif /* __NETWARE__ && __MWERKS__ */
-
-
#define CUTOFF (ULONGLONG_MAX / 10)
#define CUTLIM (ULONGLONG_MAX % 10)
#define DIGITS_IN_ULONGLONG 20
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 4face391f5e..90c76dc3c79 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -31,7 +31,7 @@
* .configure. mbmaxlen_sjis=2
*/
-static uchar NEAR ctype_sjis[257] =
+static uchar ctype_sjis[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@@ -68,7 +68,7 @@ static uchar NEAR ctype_sjis[257] =
0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000
};
-static uchar NEAR to_lower_sjis[]=
+static uchar to_lower_sjis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -104,7 +104,7 @@ static uchar NEAR to_lower_sjis[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-static uchar NEAR to_upper_sjis[]=
+static uchar to_upper_sjis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -140,7 +140,7 @@ static uchar NEAR to_upper_sjis[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-static uchar NEAR sort_order_sjis[]=
+static uchar sort_order_sjis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index a8c05dc4fd0..14b661ab0fc 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -323,7 +323,7 @@ static int t_ctype[][TOT_LEVELS] = {
/*0xFF*/ { 255 /*IGNORE*/, IGNORE, IGNORE, IGNORE, X },
};
-static uchar NEAR ctype_tis620[257] =
+static uchar ctype_tis620[257] =
{
0, /* For standard library */
32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -344,7 +344,7 @@ static uchar NEAR ctype_tis620[257] =
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
-static uchar NEAR to_lower_tis620[]=
+static uchar to_lower_tis620[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -380,7 +380,7 @@ static uchar NEAR to_lower_tis620[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR to_upper_tis620[]=
+static uchar to_upper_tis620[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -416,7 +416,7 @@ static uchar NEAR to_upper_tis620[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-static uchar NEAR sort_order_tis620[]=
+static uchar sort_order_tis620[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index 0ea4a2617cb..4fabbdbaeb3 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -32,7 +32,7 @@
#ifdef HAVE_CHARSET_ujis
-static uchar NEAR ctype_ujis[257] =
+static uchar ctype_ujis[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@@ -69,7 +69,7 @@ static uchar NEAR ctype_ujis[257] =
0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000,
};
-static uchar NEAR to_lower_ujis[]=
+static uchar to_lower_ujis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -105,7 +105,7 @@ static uchar NEAR to_lower_ujis[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-static uchar NEAR to_upper_ujis[]=
+static uchar to_upper_ujis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -141,7 +141,7 @@ static uchar NEAR to_upper_ujis[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-static uchar NEAR sort_order_ujis[]=
+static uchar sort_order_ujis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index b22b4364e8a..d9d092beb8f 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -152,7 +152,7 @@ static MY_UNI_IDX idx_uni_cp1250[]={
};
-static uchar NEAR ctype_win1250ch[] = {
+static uchar ctype_win1250ch[] = {
0x00,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x28, 0x28, 0x28, 0x28, 0x28, 0x20, 0x20,
@@ -188,7 +188,7 @@ static uchar NEAR ctype_win1250ch[] = {
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x10
};
-static uchar NEAR to_lower_win1250ch[] = {
+static uchar to_lower_win1250ch[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -223,7 +223,7 @@ static uchar NEAR to_lower_win1250ch[] = {
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
-static uchar NEAR to_upper_win1250ch[] = {
+static uchar to_upper_win1250ch[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -260,7 +260,7 @@ static uchar NEAR to_upper_win1250ch[] = {
-static uchar NEAR sort_order_win1250ch[] = {
+static uchar sort_order_win1250ch[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -279,7 +279,7 @@ static uchar NEAR sort_order_win1250ch[] = {
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
};
-static uchar NEAR _sort_order_win1250ch1[] = {
+static uchar _sort_order_win1250ch1[] = {
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
@@ -339,7 +339,7 @@ static uchar NEAR _sort_order_win1250ch1[] = {
0xb8, 0xbd, 0xbd, 0xbd, 0xbd, 0xc1, 0xbc, 0xf5
};
-static uchar NEAR _sort_order_win1250ch2[] = {
+static uchar _sort_order_win1250ch2[] = {
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
@@ -513,7 +513,7 @@ static size_t my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)),
#ifdef REAL_MYSQL
-static uchar NEAR like_range_prefix_min_win1250ch[]=
+static uchar like_range_prefix_min_win1250ch[]=
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
@@ -557,7 +557,7 @@ static uchar NEAR like_range_prefix_min_win1250ch[]=
For all other characters: prefix_max[i] == i
*/
-static uchar NEAR like_range_prefix_max_win1250ch[]=
+static uchar like_range_prefix_max_win1250ch[]=
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
diff --git a/strings/do_ctype.c b/strings/do_ctype.c
index f33ddc5eb81..d038d313a98 100644
--- a/strings/do_ctype.c
+++ b/strings/do_ctype.c
@@ -25,8 +25,8 @@
#include <my_sys.h>
#include "m_string.h"
-uchar NEAR to_upper[256];
-uchar NEAR to_lower[256],NEAR sort_order[256];
+uchar to_upper[256];
+uchar to_lower[256], sort_order[256];
static int ascii_output=1;
static string tab_names[]={ "to_lower[]={","to_upper[]={","sort_order[]={" };
@@ -47,7 +47,7 @@ char *argv[];
puts("Tabells for caseconverts and sorttest of characters\n");
for (i=0 ; i < 3 ; i++)
{
- printf("uchar NEAR %s\n",tab_names[i]);
+ printf("uchar %s\n",tab_names[i]);
for (j=0 ; j <= 255 ; j++)
{
ch=(int) tabell[i][j];
@@ -140,10 +140,6 @@ void init_case_convert()
to_upper[i]= sort_order[i]= to_lower[i]= (char) i;
#endif
-#ifdef MSDOS
- higher_pos= (uchar *) "\217\216\231\232\220"; /* Extra chars to konv. */
- lower_pos= (uchar *) "\206\204\224\201\202";
-#else
#if defined(HPUX10) && ASCII_BITS_USED == 8
higher_pos= (uchar *) "\xd0\xd8\xda\xdb\xdc\xd3";
lower_pos= (uchar *) "\xd4\xcc\xce\xdf\xc9\xd7";
@@ -160,7 +156,6 @@ void init_case_convert()
#endif
#endif /* USE_INTERNAL_CTYPE */
#endif /* HPUX10 */
-#endif /* MSDOS */
while (*higher_pos)
{
@@ -171,10 +166,6 @@ void init_case_convert()
/* sets upp sortorder; higer_pos character (upper and lower) is */
/* changed to lower_pos character */
-#ifdef MSDOS
- higher_pos= (uchar *) "\217\216\231\232\220";
- lower_pos= (uchar *) "\216\217\231YE";
-#else
#if defined(HPUX10) && ASCII_BITS_USED == 8
higher_pos= lower_pos= (uchar *) ""; /* Tecknen i r{tt ordning */
#else
@@ -186,7 +177,6 @@ void init_case_convert()
lower_pos= (uchar *) "[\\]YE"; /* Ordning enligt ascii */
#endif /* USE_ISO_8859_1 */
#endif /* HPUX10 */
-#endif /* MSDOS */
while (*higher_pos)
{
diff --git a/strings/int2str.c b/strings/int2str.c
index fba98aac3f1..ecc214d58d5 100644
--- a/strings/int2str.c
+++ b/strings/int2str.c
@@ -19,9 +19,9 @@
/*
_dig_vec arrays are public because they are used in several outer places.
*/
-char NEAR _dig_vec_upper[] =
+char _dig_vec_upper[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-char NEAR _dig_vec_lower[] =
+char _dig_vec_lower[] =
"0123456789abcdefghijklmnopqrstuvwxyz";
diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c
index 4f73b1f8e71..b9fc4b4be8e 100644
--- a/strings/my_strtoll10.c
+++ b/strings/my_strtoll10.c
@@ -17,17 +17,6 @@
#include <my_sys.h> /* Needed for MY_ERRNO_ERANGE */
#include <m_string.h>
-#undef ULONGLONG_MAX
-/*
- Needed under MetroWerks Compiler, since MetroWerks compiler does not
- properly handle a constant expression containing a mod operator
-*/
-#if defined(__NETWARE__) && defined(__MWERKS__)
-static ulonglong ulonglong_max= ~(ulonglong) 0;
-#define ULONGLONG_MAX ulonglong_max
-#else
-#define ULONGLONG_MAX (~(ulonglong) 0)
-#endif /* __NETWARE__ && __MWERKS__ */
#define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000))
#define INIT_CNT 9
#define LFACTOR ULL(1000000000)
diff --git a/strings/str_test.c b/strings/str_test.c
index e4358196f27..0814647472c 100644
--- a/strings/str_test.c
+++ b/strings/str_test.c
@@ -50,10 +50,10 @@ int main(void)
errors=tests=0;
init_strings();
- test_arg("bcmp(from,to,5)",(long) my_test(bcmp(from,to,5)),1L);
- test_arg("bcmp(from,from,5)",(long) bcmp(from,from,5),0L);
+ test_arg("memcmp(from,to,5)",(long) my_test(memcmp(from,to,5)),1L);
+ test_arg("memcmp(from,from,5)",(long) memcmp(from,from,5),0L);
- test_arg("bcmp(from,to,0)",(long) bcmp(from,to,0),0L);
+ test_arg("memcmp(from,to,0)",(long) memcmp(from,to,0),0L);
test_arg("strend(from)",(long) strend(from),(long) from+F_LEN);
test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1);
test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4);
@@ -93,7 +93,7 @@ int main(void)
test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32,
3,T_CHAR,3,F_CHAR,0,0);
test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0);
- test_strarg("bmove_align(to,from,8)",(bmove_align(to,from,8),0L),INT_MAX32,
+ test_strarg("memcpy(to,from,8)",(memcpy(to,from,8),0L),INT_MAX32,
8,F_CHAR,0,0);
test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32,
3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0);
@@ -233,7 +233,7 @@ int compare_buff(const char *message, char * b1, char * b2, int length,
{
int i,error=0;
- if (bcmp(b1,b2,length))
+ if (memcmp(b1,b2,length))
{
errors++;
printf("func: '%s' Buffers differ\nIs: ",message);
diff --git a/strings/strtol.c b/strings/strtol.c
index 42476b0226a..2f0a5286ee9 100644
--- a/strings/strtol.c
+++ b/strings/strtol.c
@@ -23,6 +23,6 @@
#include <my_global.h>
#include <m_string.h>
-#if !defined(MSDOS) && !defined(HAVE_STRTOL) && !defined(__WIN__)
+#if !defined(HAVE_STRTOL) && !defined(__WIN__)
#include "strto.c"
#endif
diff --git a/strings/strtoul.c b/strings/strtoul.c
index 3e2b51bc982..df5c46c220f 100644
--- a/strings/strtoul.c
+++ b/strings/strtoul.c
@@ -23,7 +23,7 @@
#include <my_global.h>
#include <m_string.h>
-#if !defined(MSDOS) && !defined(HAVE_STRTOUL)
+#if !defined(HAVE_STRTOUL)
#define USE_UNSIGNED
#include "strto.c"
#endif
diff --git a/strings/xml.c b/strings/xml.c
index 1b697ec6b26..f3cfaad54fa 100644
--- a/strings/xml.c
+++ b/strings/xml.c
@@ -123,16 +123,16 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
a->beg=p->cur;
a->end=p->cur;
- if ((p->end - p->cur > 3) && !bcmp(p->cur,"<!--",4))
+ if ((p->end - p->cur > 3) && !memcmp(p->cur,"<!--",4))
{
- for (; (p->cur < p->end) && bcmp(p->cur, "-->", 3); p->cur++)
+ for (; (p->cur < p->end) && memcmp(p->cur, "-->", 3); p->cur++)
{}
- if (!bcmp(p->cur, "-->", 3))
+ if (!memcmp(p->cur, "-->", 3))
p->cur+=3;
a->end=p->cur;
lex=MY_XML_COMMENT;
}
- else if (!bcmp(p->cur, "<![CDATA[",9))
+ else if (!memcmp(p->cur, "<![CDATA[",9))
{
p->cur+= 9;
for (; p->cur < p->end - 2 ; p->cur++)
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index ff522ac1d35..72c4d1ab2d0 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -32,6 +32,8 @@ ELSE()
SET(HOSTNAME "hostname")
ENDIF()
+# XXX: shouldn't we just have variables for all this stuff and centralise
+# XXX: their configuration in install_layout.cmake?
IF(WIN32)
SET(inst_location ${INSTALL_DOCREADMEDIR})
ELSE()
@@ -41,10 +43,13 @@ ENDIF()
FOREACH(inifile my-huge my-innodb-heavy-4G my-large my-medium my-small)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${inifile}.cnf.sh
${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension} @ONLY)
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension} DESTINATION ${inst_location})
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension}
+ DESTINATION ${inst_location} COMPONENT IniFiles)
ENDFOREACH()
IF(UNIX)
+ # XXX: again, used elsewhere (scripts/), should be standardised in
+ # XXX: install_layout.cmake
IF(INSTALL_LAYOUT MATCHES "STANDALONE")
SET(prefix ".")
ELSE()
@@ -64,7 +69,7 @@ IF(UNIX)
INSTALL(FILES magic DESTINATION ${inst_location})
ENDIF()
- INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal)
+ INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
CONFIGURE_FILE(MySQL-shared-compat.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/MySQL-shared-compat.spec @ONLY)
CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql.spec @ONLY)
CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql.${VERSION}.spec @ONLY)
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index bb15b27cd1f..b4295027725 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -121,43 +121,62 @@
%define distro_specific 0
%endif
%if %{distro_specific}
- %if %(test -f /etc/redhat-release && echo 1 || echo 0)
- %define rhelver %(rpm -qf --qf '%%{version}\\n' /etc/redhat-release | sed -e 's/^\\([0-9]*\\).*/\\1/g')
- %if "%rhelver" == "4"
- %define distro_description Red Hat Enterprise Linux 4
- %define distro_releasetag rhel4
+ %if %(test -f /etc/enterprise-release && echo 1 || echo 0)
+ %define oelver %(rpm -qf --qf '%%{version}\\n' /etc/enterprise-release | sed -e 's/^\\([0-9]*\\).*/\\1/g')
+ %if "%oelver" == "4"
+ %define distro_description Oracle Enterprise Linux 4
+ %define distro_releasetag oel4
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
%define distro_requires chkconfig coreutils grep procps shadow-utils
%else
- %if "%rhelver" == "5"
- %define distro_description Red Hat Enterprise Linux 5
- %define distro_releasetag rhel5
+ %if "%oelver" == "5"
+ %define distro_description Oracle Enterprise Linux 5
+ %define distro_releasetag oel5
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
%define distro_requires chkconfig coreutils grep procps shadow-utils
%else
- %{error:Red Hat Enterprise Linux %{rhelver} is unsupported}
+ %{error:Oracle Enterprise Linux %{oelver} is unsupported}
%endif
%endif
%else
- %if %(test -f /etc/SuSE-release && echo 1 || echo 0)
- %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release)
- %if "%susever" == "10"
- %define distro_description SUSE Linux Enterprise Server 10
- %define distro_releasetag sles10
- %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client readline-devel zlib-devel
- %define distro_requires aaa_base coreutils grep procps pwdutils
+ %if %(test -f /etc/redhat-release && echo 1 || echo 0)
+ %define rhelver %(rpm -qf --qf '%%{version}\\n' /etc/redhat-release | sed -e 's/^\\([0-9]*\\).*/\\1/g')
+ %if "%rhelver" == "4"
+ %define distro_description Red Hat Enterprise Linux 4
+ %define distro_releasetag rhel4
+ %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
+ %define distro_requires chkconfig coreutils grep procps shadow-utils
%else
- %if "%susever" == "11"
- %define distro_description SUSE Linux Enterprise Server 11
- %define distro_releasetag sles11
- %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client procps pwdutils readline-devel zlib-devel
- %define distro_requires aaa_base coreutils grep procps pwdutils
+ %if "%rhelver" == "5"
+ %define distro_description Red Hat Enterprise Linux 5
+ %define distro_releasetag rhel5
+ %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
+ %define distro_requires chkconfig coreutils grep procps shadow-utils
%else
- %{error:SuSE %{susever} is unsupported}
+ %{error:Red Hat Enterprise Linux %{rhelver} is unsupported}
%endif
%endif
%else
- %{error:Unsupported distribution}
+ %if %(test -f /etc/SuSE-release && echo 1 || echo 0)
+ %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release)
+ %if "%susever" == "10"
+ %define distro_description SUSE Linux Enterprise Server 10
+ %define distro_releasetag sles10
+ %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client readline-devel zlib-devel
+ %define distro_requires aaa_base coreutils grep procps pwdutils
+ %else
+ %if "%susever" == "11"
+ %define distro_description SUSE Linux Enterprise Server 11
+ %define distro_releasetag sles11
+ %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client procps pwdutils readline-devel zlib-devel
+ %define distro_requires aaa_base coreutils grep procps pwdutils
+ %else
+ %{error:SuSE %{susever} is unsupported}
+ %endif
+ %endif
+ %else
+ %{error:Unsupported distribution}
+ %endif
%endif
%endif
%else
@@ -396,30 +415,30 @@ mkdir debug
-e 's/ -ip / /' \
-e 's/^ //' \
-e 's/ $//'`
- # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included
- # XXX: before install_layout so we can't just set it based on
- # XXX: INSTALL_LAYOUT=RPM
+ # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before
+ # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM
${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \
-DCMAKE_BUILD_TYPE=Debug \
-DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
-DFEATURE_SET="%{feature_set}" \
-DCOMPILATION_COMMENT="%{compilation_comment_debug}" \
-DMYSQL_SERVER_SUFFIX="%{server_suffix}"
+ echo BEGIN_DEBUG_CONFIG ; egrep '^#define' include/config.h ; echo END_DEBUG_CONFIG
make VERBOSE=1
)
# Build full release
mkdir release
(
cd release
- # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included
- # XXX: before install_layout so we can't just set it based on
- # XXX: INSTALL_LAYOUT=RPM
+ # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before
+ # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM
${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
-DFEATURE_SET="%{feature_set}" \
-DCOMPILATION_COMMENT="%{compilation_comment_release}" \
-DMYSQL_SERVER_SUFFIX="%{server_suffix}"
+ echo BEGIN_NORMAL_CONFIG ; egrep '^#define' include/config.h ; echo END_NORMAL_CONFIG
make VERBOSE=1
)
@@ -470,10 +489,8 @@ install -d $RBR%{_sbindir}
mv -v $RBR/%{_libdir}/*.a $RBR/%{_libdir}/mysql/
# Install logrotate and autostart
-install -m 644 $MBD/release/support-files/mysql-log-rotate \
- $RBR%{_sysconfdir}/logrotate.d/mysql
-install -m 755 $MBD/release/support-files/mysql.server \
- $RBR%{_sysconfdir}/init.d/mysql
+install -m 644 $MBD/release/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate.d/mysql
+install -m 755 $MBD/release/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql
# Create a symlink "rcmysql", pointing to the init.script. SuSE users
# will appreciate that, as all services usually offer this.
@@ -504,6 +521,7 @@ rm -f $RBR%{_mandir}/man1/make_win_bin_dist.1*
##############################################################################
%pre -n MySQL-server%{product_suffix}
+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.
@@ -576,32 +594,115 @@ HERE
fi
fi
+# We assume that if there is exactly one ".pid" file,
+# it contains the valid PID of a running MySQL server.
+NR_PID_FILES=`ls $mysql_datadir/*.pid 2>/dev/null | wc -l`
+case $NR_PID_FILES in
+ 0 ) SERVER_TO_START='' ;; # No "*.pid" file == no running server
+ 1 ) SERVER_TO_START='true' ;;
+ * ) SERVER_TO_START='' # Situation not clear
+ SEVERAL_PID_FILES=true ;;
+esac
+# That logic may be debated: We might check whether it is non-empty,
+# contains exactly one number (possibly a PID), and whether "ps" finds it.
+# OTOH, if there is no such process, it means a crash without a cleanup -
+# is that a reason not to start a new server after upgrade?
+
+STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
+
+if [ -f $STATUS_FILE ]; then
+ echo "Some previous upgrade was not finished:"
+ ls -ld $STATUS_FILE
+ echo "Please check its status, then do"
+ echo " rm $STATUS_FILE"
+ echo "before repeating the MySQL upgrade."
+ exit 1
+elif [ -n "$SEVERAL_PID_FILES" ] ; then
+ echo "Your MySQL directory '$mysql_datadir' has more than one PID file:"
+ ls -ld $mysql_datadir/*.pid
+ echo "Please check which one (if any) corresponds to a running server"
+ echo "and delete all others before repeating the MySQL upgrade."
+ exit 1
+fi
+
+NEW_VERSION=%{mysql_version}-%{release}
+
+# The "pre" section code is also run on a first installation,
+# when there is no data directory yet. Protect against error messages.
+if [ -d $mysql_datadir ] ; then
+ echo "MySQL RPM upgrade to version $NEW_VERSION" > $STATUS_FILE
+ echo "'pre' step running at `date`" >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "ERR file(s):" >> $STATUS_FILE
+ ls -ltr $mysql_datadir/*.err >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "Latest 'Version' line in latest file:" >> $STATUS_FILE
+ grep '^Version' `ls -tr $mysql_datadir/*.err | tail -1` | \
+ tail -1 >> $STATUS_FILE
+ echo >> $STATUS_FILE
+
+ if [ -n "$SERVER_TO_START" ] ; then
+ # There is only one PID file, race possibility ignored
+ echo "PID file:" >> $STATUS_FILE
+ ls -l $mysql_datadir/*.pid >> $STATUS_FILE
+ cat $mysql_datadir/*.pid >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "Server process:" >> $STATUS_FILE
+ ps -fp `cat $mysql_datadir/*.pid` >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "SERVER_TO_START=$SERVER_TO_START" >> $STATUS_FILE
+ else
+ # Take a note we checked it ...
+ echo "PID file:" >> $STATUS_FILE
+ ls -l $mysql_datadir/*.pid >> $STATUS_FILE 2>&1
+ fi
+fi
+
# Shut down a previously installed server first
+# Note we *could* make that depend on $SERVER_TO_START, but we rather don't,
+# so a "stop" is attempted even if there is no PID file.
+# (Maybe the "stop" doesn't work then, but we might fix that in itself.)
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
- %{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
- echo "Giving mysqld 5 seconds to exit nicely"
- sleep 5
+ %{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
+ echo "Giving mysqld 5 seconds to exit nicely"
+ sleep 5
fi
%post -n MySQL-server%{product_suffix}
mysql_datadir=%{mysqldatadir}
+NEW_VERSION=%{mysql_version}-%{release}
+STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
# ----------------------------------------------------------------------
-# Create data directory if needed
+# Create data directory if needed, check whether upgrade or install
# ----------------------------------------------------------------------
if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
-if [ ! -d $mysql_datadir/mysql ] ; then mkdir $mysql_datadir/mysql; fi
+if [ -f $STATUS_FILE ] ; then
+ SERVER_TO_START=`grep '^SERVER_TO_START=' $STATUS_FILE | cut -c17-`
+else
+ SERVER_TO_START=''
+fi
+# echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
+if [ ! -d $mysql_datadir/mysql ] ; then
+ mkdir $mysql_datadir/mysql;
+ echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE
+else
+ # If the directory exists, we may assume it is an upgrade.
+ echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE
+fi
if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# Make MySQL start/shutdown automatically when the machine does it.
# ----------------------------------------------------------------------
+# NOTE: This still needs to be debated. Should we check whether these links
+# for the other run levels exist(ed) before the upgrade?
# use insserv for older SuSE Linux versions
if [ -x /sbin/insserv ] ; then
- /sbin/insserv %{_sysconfdir}/init.d/mysql
+ /sbin/insserv %{_sysconfdir}/init.d/mysql
# use chkconfig on Enterprise Linux and newer SuSE releases
elif [ -x /sbin/chkconfig ] ; then
- /sbin/chkconfig --add mysql
+ /sbin/chkconfig --add mysql
fi
# ----------------------------------------------------------------------
@@ -677,30 +778,49 @@ if [ -x sbin/restorecon ] ; then
sbin/restorecon -R var/lib/mysql
fi
-# 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
+# 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 2 seconds to start"
+ sleep 2
+ fi
+
+ # Allow mysqld_safe to start mysqld and print a message before we exit
+ sleep 2
fi
-# Allow mysqld_safe to start mysqld and print a message before we exit
-sleep 2
+# Collect an upgrade history ...
+echo "Upgrade/install finished at `date`" >> $STATUS_FILE
+echo >> $STATUS_FILE
+echo "=====" >> $STATUS_FILE
+STATUS_HISTORY=$mysql_datadir/RPM_UPGRADE_HISTORY
+cat $STATUS_FILE >> $STATUS_HISTORY
+rm $STATUS_FILE
+
+
+#echo "Thank you for installing the MySQL Community Server! For Production
+#systems, we recommend MySQL Enterprise, which contains enterprise-ready
+#software, intelligent advisory services, and full production support with
+#scheduled service packs and more. Visit www.mysql.com/enterprise for more
+#information."
%preun -n MySQL-server%{product_suffix}
+
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
- /sbin/chkconfig --del mysql
- fi
- fi
+ # 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
+ /sbin/chkconfig --del mysql
+ fi
+ fi
fi
# We do not remove the mysql user since it may still own a lot of
@@ -786,13 +906,13 @@ fi
%attr(755, root, root) %{_sbindir}/mysqld
%attr(755, root, root) %{_sbindir}/mysqld-debug
%attr(755, root, root) %{_sbindir}/rcmysql
-%attr(755, root, root) %{_libdir}/mysql/plugin/audit_null.so
-%attr(755, root, root) %{_libdir}/mysql/plugin/daemon_example.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/adt_null.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/libdaemon_example.so
%attr(755, root, root) %{_libdir}/mysql/plugin/mypluglib.so
%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_master.so
%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_slave.so
-%attr(755, root, root) %{_libdir}/mysql/plugin/debug/audit_null.so
-%attr(755, root, root) %{_libdir}/mysql/plugin/debug/daemon_example.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/adt_null.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/libdaemon_example.so
%attr(755, root, root) %{_libdir}/mysql/plugin/debug/mypluglib.so
%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_master.so
%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_slave.so
@@ -892,6 +1012,17 @@ fi
# merging BK trees)
##############################################################################
%changelog
+* Tue Jun 15 2010 Joerg Bruehe <joerg.bruehe@sun.com>
+
+- Change the behaviour on installation and upgrade:
+ On installation, do not autostart the server.
+ *Iff* the server was stopped before the upgrade is started, this is taken as a
+ sign the administrator is handling that manually, and so the new server will
+ not be started automatically at the end of the upgrade.
+ The start/stop scripts will still be installed, so the server will be started
+ on the next machine boot.
+ This is the 5.5 version of fixing bug#27072 (RPM autostarting the server).
+
* Tue Jun 1 2010 Jonathan Perkin <jonathan.perkin@oracle.com>
- Implement SELinux checks from distribution-specific spec file.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ea2f41abb73..b0e3342b1bc 100755..100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -27,4 +27,4 @@ IF(WITH_UNIT_TESTS)
SET_TARGET_PROPERTIES(bug25714 PROPERTIES LINKER_LANGUAGE CXX)
ENDIF()
-INSTALL(TARGETS mysql_client_test DESTINATION bin)
+INSTALL(TARGETS mysql_client_test DESTINATION ${INSTALL_BINDIR} COMPONENT Test)
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index a490cac054d..a3640077889 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -2270,7 +2270,7 @@ static void test_prepare()
/* now, execute the prepared statement to insert 10 records.. */
for (tiny_data= 0; tiny_data < 100; tiny_data++)
{
- length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data));
+ length[1]= sprintf(str_data, "MySQL%d", int_data);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
int_data += 25;
@@ -2309,7 +2309,7 @@ static void test_prepare()
/* now, execute the prepared statement to insert 10 records.. */
for (o_tiny_data= 0; o_tiny_data < 100; o_tiny_data++)
{
- len= my_sprintf(data, (data, "MySQL%d", o_int_data));
+ len= sprintf(data, "MySQL%d", o_int_data);
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
@@ -3675,7 +3675,7 @@ static void test_simple_update()
my_bind[0].buffer= szData; /* string data */
my_bind[0].buffer_length= sizeof(szData);
my_bind[0].length= &length[0];
- length[0]= my_sprintf(szData, (szData, "updated-data"));
+ length[0]= sprintf(szData, "updated-data");
my_bind[1].buffer= (void *) &nData;
my_bind[1].buffer_type= MYSQL_TYPE_LONG;
@@ -3871,7 +3871,7 @@ static void test_long_data_str()
DIE_UNLESS(rc == 1);
mysql_free_result(result);
- my_sprintf(data, (data, "%d", i*5));
+ sprintf(data, "%d", i*5);
verify_col_data("test_long_data_str", "LENGTH(longstr)", data);
data[0]= '\0';
while (i--)
@@ -3929,7 +3929,7 @@ static void test_long_data_str1()
rc= mysql_stmt_bind_param(stmt, my_bind);
check_execute(stmt, rc);
- length= my_sprintf(data, (data, "MySQL AB"));
+ length= sprintf(data, "MySQL AB");
/* supply data in pieces */
for (i= 0; i < 3; i++)
@@ -3969,10 +3969,10 @@ static void test_long_data_str1()
DIE_UNLESS(rc == 1);
mysql_free_result(result);
- my_sprintf(data, (data, "%ld", (long)i*length));
+ sprintf(data, "%ld", (long)i*length);
verify_col_data("test_long_data_str", "length(longstr)", data);
- my_sprintf(data, (data, "%d", i*2));
+ sprintf(data, "%d", i*2);
verify_col_data("test_long_data_str", "length(blb)", data);
/* Test length of field->max_length */
@@ -4244,7 +4244,7 @@ static void test_update()
my_bind[0].buffer= szData;
my_bind[0].buffer_length= sizeof(szData);
my_bind[0].length= &length[0];
- length[0]= my_sprintf(szData, (szData, "inserted-data"));
+ length[0]= sprintf(szData, "inserted-data");
my_bind[1].buffer= (void *)&nData;
my_bind[1].buffer_type= MYSQL_TYPE_LONG;
@@ -4273,7 +4273,7 @@ static void test_update()
my_bind[0].buffer= szData;
my_bind[0].buffer_length= sizeof(szData);
my_bind[0].length= &length[0];
- length[0]= my_sprintf(szData, (szData, "updated-data"));
+ length[0]= sprintf(szData, "updated-data");
my_bind[1].buffer= (void *)&nData;
my_bind[1].buffer_type= MYSQL_TYPE_LONG;
@@ -4842,7 +4842,7 @@ static void bind_fetch(int row_count)
/* CHAR */
{
char buff[20];
- long len= my_sprintf(buff, (buff, "%d", rc));
+ long len= sprintf(buff, "%d", rc);
DIE_UNLESS(strcmp(s_data, buff) == 0);
DIE_UNLESS(length[6] == (ulong) len);
}
@@ -5435,7 +5435,7 @@ static void test_insert()
/* now, execute the prepared statement to insert 10 records.. */
for (tiny_data= 0; tiny_data < 3; tiny_data++)
{
- length= my_sprintf(str_data, (str_data, "MySQL%d", tiny_data));
+ length= sprintf(str_data, "MySQL%d", tiny_data);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
}
@@ -18097,7 +18097,7 @@ static void test_wl4166_1()
/* now, execute the prepared statement to insert 10 records.. */
for (tiny_data= 0; tiny_data < 10; tiny_data++)
{
- length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data));
+ length[1]= sprintf(str_data, "MySQL%d", int_data);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
int_data += 25;
@@ -18120,7 +18120,7 @@ static void test_wl4166_1()
for (tiny_data= 50; tiny_data < 60; tiny_data++)
{
- length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data));
+ length[1]= sprintf(str_data, "MySQL%d", int_data);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
int_data += 25;
@@ -19060,6 +19060,63 @@ static void test_bug42373()
}
+/**
+ Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
+*/
+
+static void test_bug54041()
+{
+ int rc;
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind;
+
+ DBUG_ENTER("test_bug54041");
+ myheader("test_bug54041");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (a) VALUES (?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 1);
+
+ memset(&bind, 0, sizeof(bind));
+
+ /* Any type that does not support long data handling. */
+ bind.buffer_type= MYSQL_TYPE_LONG;
+
+ rc= mysql_stmt_bind_param(stmt, &bind);
+ check_execute(stmt, rc);
+
+ /*
+ Trick the client API into sending a long data packet for
+ the parameter. Long data is only supported for string and
+ binary types.
+ */
+ stmt->params[0].buffer_type= MYSQL_TYPE_STRING;
+
+ rc= mysql_stmt_send_long_data(stmt, 0, "data", 5);
+ check_execute(stmt, rc);
+
+ /* Undo API violation. */
+ stmt->params[0].buffer_type= MYSQL_TYPE_LONG;
+
+ rc= mysql_stmt_execute(stmt);
+ /* Incorrect arguments. */
+ check_execute_r(stmt, rc);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ DBUG_VOID_RETURN;
+}
+
+
/*
Bug#49972: Crash in prepared statements.
@@ -19500,6 +19557,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug44495", test_bug44495 },
{ "test_bug49972", test_bug49972 },
{ "test_bug42373", test_bug42373 },
+ { "test_bug54041", test_bug54041 },
{ 0, 0 }
};
@@ -19519,7 +19577,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument)
{
char *start=argument;
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password);
opt_password= my_strdup(argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
@@ -19676,7 +19734,7 @@ int main(int argc, char **argv)
print_test_output();
while (embedded_server_arg_count > 1)
- my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
+ my_free(embedded_server_args[--embedded_server_arg_count]);
mysql_server_end();
diff --git a/tests/thread_test.c b/tests/thread_test.c
index def133f4a3f..1a3dd60c1fd 100644
--- a/tests/thread_test.c
+++ b/tests/thread_test.c
@@ -150,7 +150,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'p':
if (argument)
{
- my_free(password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(password);
password= my_strdup(argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
}
diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt
index 3bf23df6066..56a3d67f25f 100644
--- a/unittest/mysys/CMakeLists.txt
+++ b/unittest/mysys/CMakeLists.txt
@@ -27,6 +27,6 @@ MACRO (MY_ADD_TEST name)
ENDMACRO()
-FOREACH(testname bitmap base64 my_vsnprintf my_atomic my_rdtsc lf)
+FOREACH(testname bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc)
MY_ADD_TEST(${testname})
ENDFOREACH()
diff --git a/unittest/mysys/Makefile.am b/unittest/mysys/Makefile.am
index 25b30e331b0..64d2749987e 100644
--- a/unittest/mysys/Makefile.am
+++ b/unittest/mysys/Makefile.am
@@ -23,7 +23,7 @@ LDADD = $(top_builddir)/unittest/mytap/libmytap.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a
-noinst_PROGRAMS = bitmap-t base64-t lf-t my_rdtsc-t my_vsnprintf-t
+noinst_PROGRAMS = bitmap-t base64-t lf-t my_rdtsc-t my_vsnprintf-t my_malloc-t
if NEED_THREAD
# my_atomic-t is used to check thread functions, so it is safe to
diff --git a/unittest/mysys/my_malloc-t.c b/unittest/mysys/my_malloc-t.c
new file mode 100644
index 00000000000..00cac0d21b7
--- /dev/null
+++ b/unittest/mysys/my_malloc-t.c
@@ -0,0 +1,43 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <my_global.h>
+#include <my_sys.h>
+#include "tap.h"
+
+int main(void)
+{
+ void *p;
+ MY_INIT("my_malloc-t");
+
+ plan(4);
+
+ p= my_malloc(0, MYF(0));
+ ok(p != NULL, "Zero-sized block allocation.");
+
+ p= my_realloc(p, 32, MYF(0));
+ ok(p != NULL, "Reallocated zero-sized block.");
+
+ p= my_realloc(p, 16, MYF(0));
+ ok(p != NULL, "Trimmed block.");
+
+ my_free(p);
+ p= NULL;
+
+ ok((my_free(p), 1), "Free NULL pointer.");
+
+ return exit_status();
+}
+
diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt
index dae2ed2bb2f..dae2ed2bb2f 100755..100644
--- a/vio/CMakeLists.txt
+++ b/vio/CMakeLists.txt
diff --git a/vio/test-ssl.c b/vio/test-ssl.c
index 855dc5fbb3e..1e846727d00 100644
--- a/vio/test-ssl.c
+++ b/vio/test-ssl.c
@@ -14,7 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
-#if defined(HAVE_OPENSSL) && !defined(__NETWARE__)
+#if defined(HAVE_OPENSSL)
#include <my_sys.h>
#include <m_string.h>
#include <m_ctype.h>
@@ -106,8 +106,8 @@ main(int argc, char** argv)
child_pid = fork();
if (child_pid==-1) {
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
fatal_error("fork");
}
if (child_pid==0)
@@ -116,28 +116,28 @@ main(int argc, char** argv)
char xbuf[100];
int r = vio_read(client_vio,xbuf, sizeof(xbuf));
if (r<=0) {
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
fatal_error("client:SSL_read");
}
xbuf[r] = 0;
printf("client:got %s\n", xbuf);
- my_free((uchar*)client_vio,MYF(0));
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(client_vio);
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
}
else
{
const char* s = "Huhuhuh";
int r = vio_write(server_vio,(uchar*)s, strlen(s));
if (r<=0) {
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
fatal_error("server:SSL_write");
}
- my_free((uchar*)server_vio,MYF(0));
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(server_vio);
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
}
return 0;
}
diff --git a/vio/test-sslclient.c b/vio/test-sslclient.c
index e1b8461397b..643dcbf2c8e 100644
--- a/vio/test-sslclient.c
+++ b/vio/test-sslclient.c
@@ -84,13 +84,13 @@ main( int argc __attribute__((unused)),
sslconnect(ssl_connector,client_vio,60L);
err = vio_read(client_vio,xbuf, sizeof(xbuf));
if (err<=0) {
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(ssl_connector);
fatal_error("client:SSL_read");
}
xbuf[err] = 0;
printf("client:got %s\n", xbuf);
- my_free((uchar*)client_vio,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(client_vio);
+ my_free(ssl_connector);
return 0;
}
#else /* HAVE_OPENSSL */
diff --git a/vio/test-sslserver.c b/vio/test-sslserver.c
index f55b5bae53a..3123a4def2c 100644
--- a/vio/test-sslserver.c
+++ b/vio/test-sslserver.c
@@ -139,12 +139,12 @@ main(int argc __attribute__((unused)), char** argv)
#if 0
if (err<=0) {
- my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free(ssl_acceptor);
fatal_error("server:SSL_write");
}
#endif /* 0 */
- my_free((uchar*)ssl_acceptor,MYF(0));
+ my_free(ssl_acceptor);
return 0;
}
#else /* HAVE_OPENSSL */
diff --git a/vio/vio.c b/vio/vio.c
index 73dd68b938f..67704a56b22 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -164,7 +164,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, uint flags)
{
- my_free(vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(vio->read_buffer);
vio_init(vio, type, sd, hPipe, flags);
}
@@ -263,8 +263,8 @@ void vio_delete(Vio* vio)
if (vio->type != VIO_CLOSED)
vio->vioclose(vio);
- my_free((uchar*) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR));
- my_free((uchar*) vio,MYF(0));
+ my_free(vio->read_buffer);
+ my_free(vio);
}
diff --git a/vio/viossl.c b/vio/viossl.c
index 0651fd8b7a3..79f358b047c 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -24,36 +24,6 @@
#ifdef HAVE_OPENSSL
-#ifdef __NETWARE__
-
-/* yaSSL already uses BSD sockets */
-#ifndef HAVE_YASSL
-
-/*
- The default OpenSSL implementation on NetWare uses WinSock.
- This code allows us to use the BSD sockets.
-*/
-
-static int SSL_set_fd_bsd(SSL *s, int fd)
-{
- int result= -1;
- BIO_METHOD *BIO_s_bsdsocket();
- BIO *bio;
-
- if ((bio= BIO_new(BIO_s_bsdsocket())))
- {
- result= BIO_set_fd(bio, fd, BIO_NOCLOSE);
- SSL_set_bio(s, bio, bio);
- }
- return result;
-}
-
-#define SSL_set_fd(A, B) SSL_set_fd_bsd((A), (B))
-
-#endif /* HAVE_YASSL */
-#endif /* __NETWARE__ */
-
-
static void
report_errors(SSL* ssl)
{
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index d0a0a69f70b..4971dec37fb 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -143,36 +143,6 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file,
}
-#ifdef __NETWARE__
-
-/* NetWare SSL cleanup */
-void netware_ssl_cleanup()
-{
- /* free memory from SSL_library_init() */
- EVP_cleanup();
-
-/* OpenSSL NetWare port specific functions */
-#ifndef HAVE_YASSL
-
- /* free global X509 method */
- X509_STORE_method_cleanup();
-
- /* free the thread_hash error table */
- ERR_free_state_table();
-#endif
-}
-
-
-/* NetWare SSL initialization */
-static void netware_ssl_init()
-{
- /* cleanup OpenSSL library */
- NXVmRegisterExitHandler(netware_ssl_cleanup, NULL);
-}
-
-#endif /* __NETWARE__ */
-
-
static void check_ssl_init()
{
if (!ssl_algorithms_added)
@@ -183,10 +153,6 @@ static void check_ssl_init()
}
-#ifdef __NETWARE__
- netware_ssl_init();
-#endif
-
if (!ssl_error_strings_loaded)
{
ssl_error_strings_loaded= TRUE;
@@ -224,7 +190,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
*error= SSL_INITERR_MEMFAIL;
DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
report_errors();
- my_free((void*)ssl_fd,MYF(0));
+ my_free(ssl_fd);
DBUG_RETURN(0);
}
@@ -240,7 +206,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
report_errors();
SSL_CTX_free(ssl_fd->ssl_context);
- my_free((void*)ssl_fd,MYF(0));
+ my_free(ssl_fd);
DBUG_RETURN(0);
}
@@ -254,7 +220,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
report_errors();
SSL_CTX_free(ssl_fd->ssl_context);
- my_free((void*)ssl_fd,MYF(0));
+ my_free(ssl_fd);
DBUG_RETURN(0);
}
}
@@ -264,7 +230,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
DBUG_PRINT("error", ("vio_set_cert_stuff failed"));
report_errors();
SSL_CTX_free(ssl_fd->ssl_context);
- my_free((void*)ssl_fd,MYF(0));
+ my_free(ssl_fd);
DBUG_RETURN(0);
}
@@ -344,6 +310,6 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd)
{
SSL_CTX_free(fd->ssl_context);
- my_free((uchar*) fd, MYF(0));
+ my_free(fd);
}
#endif /* HAVE_OPENSSL */
diff --git a/vio/viotest-ssl.c b/vio/viotest-ssl.c
index b8abbac4ed6..5c68e861d2a 100644
--- a/vio/viotest-ssl.c
+++ b/vio/viotest-ssl.c
@@ -106,8 +106,8 @@ int main(int argc, char **argv)
child_pid = fork();
if (child_pid==-1)
{
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
fatal_error("fork");
}
if (child_pid==0)
@@ -116,15 +116,15 @@ int main(int argc, char **argv)
char xbuf[100];
int r = vio_ssl_read(client_vio,xbuf, sizeof(xbuf));
if (r<=0) {
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
fatal_error("client:SSL_read");
}
xbuf[r] = 0;
printf("client:got %s\n", xbuf);
- my_free((uchar*)client_vio,MYF(0));
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(client_vio);
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
sleep(1);
}
else
@@ -132,13 +132,13 @@ int main(int argc, char **argv)
const char* s = "Huhuhuh";
int r = vio_ssl_write(server_vio,(uchar*)s, strlen(s));
if (r<=0) {
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
fatal_error("server:SSL_write");
}
- my_free((uchar*)server_vio,MYF(0));
- my_free((uchar*)ssl_acceptor,MYF(0));
- my_free((uchar*)ssl_connector,MYF(0));
+ my_free(server_vio);
+ my_free(ssl_acceptor);
+ my_free(ssl_connector);
sleep(1);
}
return 0;
diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake
index 611553d68ac..611553d68ac 100755..100644
--- a/win/mysql_manifest.cmake
+++ b/win/mysql_manifest.cmake
diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt
index 4be153bfdfa..4be153bfdfa 100755..100644
--- a/zlib/CMakeLists.txt
+++ b/zlib/CMakeLists.txt